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.AMaintenance;
import com.zksy.property.service.AMaintenanceService;
import com.zksy.property.mapper.AMaintenanceMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【a_maintenance(维修管理表)】的数据库操作Service实现
* @createDate 2025-07-02 10:07:08
*/
@Service
public class AMaintenanceServiceImpl extends ServiceImpl<AMaintenanceMapper, AMaintenance>
    implements AMaintenanceService{

    @Override
    public Page<AMaintenance> findByPage(long pageNum, long pageSize, String assetCode, String equipmentName, String taskTitle, String taskStatus) {
        Page<AMaintenance> page = new Page<>(pageNum,pageSize);
        LambdaQueryWrapper<AMaintenance> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(assetCode != null,AMaintenance::getAssetCode,assetCode);
        queryWrapper.like(equipmentName != null,AMaintenance::getEquipmentName,equipmentName);
        queryWrapper.like(taskTitle != null,AMaintenance::getTaskTitle,taskTitle);
        queryWrapper.like(taskStatus != null,AMaintenance::getTaskStatus,taskStatus);
        queryWrapper.orderByDesc(AMaintenance::getUpdateTime);
        Page<AMaintenance> page1 = this.page(page, queryWrapper);
        return page1;
    }

    @Override
    public List<AMaintenance> getAMaintenanceList(String assetCode, String equipmentName, String taskTitle, String taskStatus) {
        LambdaQueryWrapper<AMaintenance> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(assetCode != null,AMaintenance::getAssetCode,assetCode);
        queryWrapper.like(equipmentName != null,AMaintenance::getEquipmentName,equipmentName);
        queryWrapper.like(taskTitle != null,AMaintenance::getTaskTitle,taskTitle);
        queryWrapper.like(taskStatus != null,AMaintenance::getTaskStatus,taskStatus);
        queryWrapper.orderByDesc(AMaintenance::getUpdateTime);
        List<AMaintenance> list = this.list(queryWrapper);
        return list;
    }

}




