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.AEquipmentManagement;
import com.zksy.property.service.AEquipmentManagementService;
import com.zksy.property.mapper.AEquipmentManagementMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【a_equipment_management(资产附属设施管理表)】的数据库操作Service实现
* @createDate 2025-07-01 08:57:36
*/
@Service
public class AEquipmentManagementServiceImpl extends ServiceImpl<AEquipmentManagementMapper, AEquipmentManagement>
    implements AEquipmentManagementService{

    @Override
    public Page<AEquipmentManagement> findByPage(long pageNum, long pageSize, String assetCode, String equipmentName, String equipmentType, String modelNumber) {
        Page<AEquipmentManagement> page = new Page<>(pageNum,pageSize);
        LambdaQueryWrapper<AEquipmentManagement> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(assetCode != null,AEquipmentManagement::getAssetCode,assetCode);
        queryWrapper.like(equipmentName != null,AEquipmentManagement::getEquipmentName,equipmentName);
        queryWrapper.like(equipmentType != null,AEquipmentManagement::getEquipmentType,equipmentType);
        queryWrapper.like(modelNumber != null,AEquipmentManagement::getModelNumber,modelNumber);
        Page<AEquipmentManagement> page1 = this.page(page, queryWrapper);
        return page1;
    }

    @Override
    public List<AEquipmentManagement> getAEquipmentManagementList(String assetCode, String equipmentName, String equipmentType, String modelNumber) {
        LambdaQueryWrapper<AEquipmentManagement> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(assetCode != null,AEquipmentManagement::getAssetCode,assetCode);
        queryWrapper.like(equipmentName != null,AEquipmentManagement::getEquipmentName,equipmentName);
        queryWrapper.like(equipmentType != null,AEquipmentManagement::getEquipmentType,equipmentType);
        queryWrapper.like(modelNumber != null,AEquipmentManagement::getModelNumber,modelNumber);
        List<AEquipmentManagement> list = this.list(queryWrapper);
        return list;
    }
}




