package com.zksy.info.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.zksy.info.domain.EQuarterlyElectricityBill;
import com.zksy.info.service.EQuarterlyElectricityBillService;
import com.zksy.info.mapper.EQuarterlyElectricityBillMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【e_quarterly_electricity_bill(季度用电明细表（单位：度）)】的数据库操作Service实现
* @createDate 2025-07-02 09:22:25
*/
@Service
public class EQuarterlyElectricityBillServiceImpl extends ServiceImpl<EQuarterlyElectricityBillMapper, EQuarterlyElectricityBill>
    implements EQuarterlyElectricityBillService{

    @Override
    public Page<EQuarterlyElectricityBill> findByPage(long pageNum, long pageSize, String enterpriseName, String unifiedSocialCreditCode, String gridAccountNumber, String year, String arrearExists) {
        Page<EQuarterlyElectricityBill> page = new Page<>(pageNum,pageSize);
        LambdaQueryWrapper<EQuarterlyElectricityBill> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(enterpriseName != null,EQuarterlyElectricityBill::getEnterpriseName,enterpriseName);
        queryWrapper.like(unifiedSocialCreditCode != null,EQuarterlyElectricityBill::getUnifiedSocialCreditCode,unifiedSocialCreditCode);
        queryWrapper.like(gridAccountNumber != null,EQuarterlyElectricityBill::getGridAccountNumber,gridAccountNumber);
        queryWrapper.like(year != null,EQuarterlyElectricityBill::getYear,year);
        queryWrapper.like(arrearExists != null,EQuarterlyElectricityBill::getArrearExists,arrearExists);
        queryWrapper.orderByDesc(EQuarterlyElectricityBill::getUpdateTime);
        Page<EQuarterlyElectricityBill> page1 = this.page(page, queryWrapper);
        return page1;
    }

    @Override
    public List<EQuarterlyElectricityBill> getEQuarterlyElectricityBillList(String enterpriseName, String unifiedSocialCreditCode, String gridAccountNumber, String year, String arrearExists) {
        LambdaQueryWrapper<EQuarterlyElectricityBill> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(enterpriseName != null,EQuarterlyElectricityBill::getEnterpriseName,enterpriseName);
        queryWrapper.like(unifiedSocialCreditCode != null,EQuarterlyElectricityBill::getUnifiedSocialCreditCode,unifiedSocialCreditCode);
        queryWrapper.like(gridAccountNumber != null,EQuarterlyElectricityBill::getGridAccountNumber,gridAccountNumber);
        queryWrapper.like(year != null,EQuarterlyElectricityBill::getYear,year);
        queryWrapper.like(arrearExists != null,EQuarterlyElectricityBill::getArrearExists,arrearExists);
        queryWrapper.orderByDesc(EQuarterlyElectricityBill::getUpdateTime);
        List<EQuarterlyElectricityBill> list = this.list(queryWrapper);
        return list;
    }
}




