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.EEnterpriseWaterAnnualStatistics;
import com.zksy.info.service.EEnterpriseWaterAnnualStatisticsService;
import com.zksy.info.mapper.EEnterpriseWaterAnnualStatisticsMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【e_enterprise_water_annual_statistics(企业年度用水统计表)】的数据库操作Service实现
* @createDate 2025-07-10 09:59:12
*/
@Service
public class EEnterpriseWaterAnnualStatisticsServiceImpl extends ServiceImpl<EEnterpriseWaterAnnualStatisticsMapper, EEnterpriseWaterAnnualStatistics>
    implements EEnterpriseWaterAnnualStatisticsService{

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

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




