package com.zksy.property.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.property.domain.APropertyReceipt;
import com.zksy.property.service.APropertyReceiptService;
import com.zksy.property.mapper.APropertyReceiptMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【a_property_receipt(标准化厂房收入情况表)】的数据库操作Service实现
* @createDate 2025-06-27 08:58:04
*/
@Service
public class APropertyReceiptServiceImpl extends ServiceImpl<APropertyReceiptMapper, APropertyReceipt>
    implements APropertyReceiptService{

    @Override
    public Page findByPage(long pageNum, long pageSize, String unit, String building) {
        Page<APropertyReceipt> page = new Page<>(pageNum,pageSize);
        LambdaQueryWrapper<APropertyReceipt> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(unit != null,APropertyReceipt::getUnit,unit);
        queryWrapper.like(building != null,APropertyReceipt::getBuilding,building);
        queryWrapper.orderByDesc(APropertyReceipt::getUpdateTime);
        Page<APropertyReceipt> page1 = this.page(page, queryWrapper);
        return page1;
    }

    @Override
    public List<APropertyReceipt> getAPropertyReceiptList(String unit, String building) {
        LambdaQueryWrapper<APropertyReceipt> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(unit != null,APropertyReceipt::getUnit,unit);
        queryWrapper.like(building != null,APropertyReceipt::getBuilding,building);
        queryWrapper.orderByDesc(APropertyReceipt::getUpdateTime);
        List<APropertyReceipt> list = this.list(queryWrapper);
        return list;
    }
}




