package com.yzt.airconditionersystem.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yzt.airconditionersystem.bean.Company;
import com.yzt.airconditionersystem.bean.Project;
import com.yzt.airconditionersystem.service.CompanyService;
import com.yzt.airconditionersystem.mapper.CompanyMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author TzZach
* @description 针对表【company】的数据库操作Service实现
* @createDate 2022-05-07 11:50:06
*/
@Service
public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company>
    implements CompanyService{

    @Override
    public Page<Company> getCompanyPageByType(Page<Company> page, Integer type) {
        LambdaQueryWrapper<Company> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Company::getType, type);
        return baseMapper.selectPage(page, wrapper);
    }

    @Override
    public Page<Company> getCompanyPageByType(Page<Company> page, Integer type, String operatorId) {
        LambdaQueryWrapper<Company> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Company::getType, type);
        wrapper.eq(Company::getOperatorId, operatorId);
        return baseMapper.selectPage(page, wrapper);
    }

    @Override
    public List<Company> listByNameAndDistrictAndOperatorName(String name, String district, String operatorName, Integer type) {
        return baseMapper.listByNameAndDistrictAndOperatorName(name, district, operatorName, type);
    }

    @Override
    public List<Company> listByNameAndDistrictAndContact(String name, String district, String contact, Integer type) {
        return baseMapper.listByNameAndDistrictAndContact(name, district, contact, type);
    }

}




