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.EEnterpriseGasAnnualStatistics;
import com.zksy.info.service.EEnterpriseGasAnnualStatisticsService;
import com.zksy.info.mapper.EEnterpriseGasAnnualStatisticsMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【e_enterprise_gas_annual_statistics(企业年度用气统计表)】的数据库操作Service实现
* @createDate 2025-07-10 10:06:31
*/
@Service
public class EEnterpriseGasAnnualStatisticsServiceImpl extends ServiceImpl<EEnterpriseGasAnnualStatisticsMapper, EEnterpriseGasAnnualStatistics>
    implements EEnterpriseGasAnnualStatisticsService{

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

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




