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.EEnterpriseElectricityAnnualStatistics;
import com.zksy.info.service.EEnterpriseElectricityAnnualStatisticsService;
import com.zksy.info.mapper.EEnterpriseElectricityAnnualStatisticsMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【e_enterprise_electricity_annual_statistics(企业年度用电统计表)】的数据库操作Service实现
* @createDate 2025-07-10 09:13:16
*/
@Service
public class EEnterpriseElectricityAnnualStatisticsServiceImpl extends ServiceImpl<EEnterpriseElectricityAnnualStatisticsMapper, EEnterpriseElectricityAnnualStatistics>
    implements EEnterpriseElectricityAnnualStatisticsService{

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

    @Override
    public List<EEnterpriseElectricityAnnualStatistics> getEEnterpriseElectricityAnnualStatisticsList(String enterpriseName, String unifiedSocialCreditCode, String accountNumber, String year) {
        LambdaQueryWrapper<EEnterpriseElectricityAnnualStatistics> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(enterpriseName != null,EEnterpriseElectricityAnnualStatistics::getEnterpriseName,enterpriseName);
        queryWrapper.like(unifiedSocialCreditCode != null,EEnterpriseElectricityAnnualStatistics::getUnifiedSocialCreditCode,unifiedSocialCreditCode);
        queryWrapper.like(accountNumber != null,EEnterpriseElectricityAnnualStatistics::getAccountNumber,accountNumber);
        queryWrapper.like(year != null,EEnterpriseElectricityAnnualStatistics::getYear,year);
        queryWrapper.orderByDesc(EEnterpriseElectricityAnnualStatistics::getUpdateTime);
        List<EEnterpriseElectricityAnnualStatistics> list = this.list(queryWrapper);
        return list;
    }
}




