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.EGas;
import com.zksy.info.service.EGasService;
import com.zksy.info.mapper.EGasMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【e_gas(燃气表)】的数据库操作Service实现
* @createDate 2025-06-27 10:26:27
*/
@Service
public class EGasServiceImpl extends ServiceImpl<EGasMapper, EGas>
    implements EGasService{

    @Override
    public Page<EGas> findByPage(long pageNum, long pageSize, String company, String userInfo) {
        Page<EGas> page = new Page<>(pageNum,pageSize);
        LambdaQueryWrapper<EGas> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(company != null,EGas::getCompany,company);
        queryWrapper.like(userInfo != null,EGas::getUserInfo,userInfo);
        queryWrapper.orderByDesc(EGas::getUpdateTime);
        Page<EGas> page1 = this.page(page, queryWrapper);
        return page1;
    }

    @Override
    public List<EGas> getEGasList(String company, String userInfo) {
        LambdaQueryWrapper<EGas> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(company != null,EGas::getCompany,company);
        queryWrapper.like(userInfo != null,EGas::getUserInfo,userInfo);
        queryWrapper.orderByDesc(EGas::getUpdateTime);
        List<EGas> list = this.list(queryWrapper);
        return list;
    }
}




