feat(mes/eqp): 为设备巡检记录分页查询新增时间范围筛选及关联信息

- 在EqpEquipmentInspectionRecordBo中新增startInspectTime和endInspectTime字段,并添加日期格式化注解,支持按巡检时间范围查询
- 新增Mapper方法selectVoPagePlus及对应的XML映射,通过左连接关联检验清单表以获取checkContent和checkStandard字段
- 在Service层新增buildQueryWrapperPlus方法构建查询条件,支持对新增的时间范围字段进行筛选
- 在EqpEquipmentInspectionRecordVo中新增checkContent和checkStandard字段,用于在分页查询结果中展示关联的检验内容和标准
This commit is contained in:
2026-05-25 15:06:55 +08:00
parent 015ec7d70b
commit bd67df3c05
5 changed files with 63 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import javax.validation.constraints.*;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 设备巡检记录业务对象 eqp_equipment_inspection_record
@@ -64,5 +65,19 @@ public class EqpEquipmentInspectionRecordBo extends BaseEntity {
*/
private String photo;
/**
* 巡检时间开始
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startInspectTime;
/**
* 巡检时间结束
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endInspectTime;
}

View File

@@ -74,5 +74,15 @@ public class EqpEquipmentInspectionRecordVo {
*/
private String photo;
/**
* 检验内容
*/
private String checkContent;
/**
* 检验标准
*/
private String checkStandard;
}

View File

@@ -1,8 +1,11 @@
package com.klp.mes.eqp.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.klp.mes.eqp.domain.EqpEquipmentInspectionRecord;
import com.klp.mes.eqp.domain.vo.EqpEquipmentInspectionRecordVo;
import com.klp.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
/**
* 设备巡检记录Mapper接口
@@ -12,4 +15,5 @@ import com.klp.common.core.mapper.BaseMapperPlus;
*/
public interface EqpEquipmentInspectionRecordMapper extends BaseMapperPlus<EqpEquipmentInspectionRecordMapper, EqpEquipmentInspectionRecord, EqpEquipmentInspectionRecordVo> {
Page<EqpEquipmentInspectionRecordVo> selectVoPagePlus(Page<Object> build, @Param("ew") QueryWrapper<EqpEquipmentInspectionRecord> lqw);
}

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import com.klp.common.core.page.TableDataInfo;
import com.klp.common.core.domain.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.klp.common.utils.StringUtils;
@@ -44,11 +45,25 @@ public class EqpEquipmentInspectionRecordServiceImpl implements IEqpEquipmentIns
*/
@Override
public TableDataInfo<EqpEquipmentInspectionRecordVo> queryPageList(EqpEquipmentInspectionRecordBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<EqpEquipmentInspectionRecord> lqw = buildQueryWrapper(bo);
Page<EqpEquipmentInspectionRecordVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
QueryWrapper<EqpEquipmentInspectionRecord> qw = buildQueryWrapperPlus(bo);
Page<EqpEquipmentInspectionRecordVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), qw);
return TableDataInfo.build(result);
}
private QueryWrapper<EqpEquipmentInspectionRecord> buildQueryWrapperPlus(EqpEquipmentInspectionRecordBo bo) {
QueryWrapper<EqpEquipmentInspectionRecord> qw = new QueryWrapper<>();
qw.eq(bo.getCheckId() != null, "r.check_id", bo.getCheckId());
qw.eq(StringUtils.isNotBlank(bo.getPhoto()), "r.photo", bo.getPhoto());
qw.eq(bo.getShift() != null, "r.shift", bo.getShift());
qw.eq(bo.getRunStatus() != null, "r.run_status", bo.getRunStatus());
qw.eq(StringUtils.isNotBlank(bo.getInspector()), "r.inspector", bo.getInspector());
qw.eq(StringUtils.isNotBlank(bo.getAbnormalDesc()), "r.abnormal_desc", bo.getAbnormalDesc());
qw.ge(bo.getStartInspectTime() != null, "r.inspect_time", bo.getStartInspectTime());
qw.le(bo.getEndInspectTime() != null, "r.inspect_time", bo.getEndInspectTime());
qw.eq("r.del_flag", 0);
return qw;
}
/**
* 查询设备巡检记录列表
*/

View File

@@ -21,5 +21,22 @@
<result property="delFlag" column="del_flag"/>
</resultMap>
<select id="selectVoPagePlus" resultType="com.klp.mes.eqp.domain.vo.EqpEquipmentInspectionRecordVo">
SELECT
r.record_id,
r.check_id,
r.shift,
r.inspect_time,
r.run_status,
r.inspector,
r.abnormal_desc,
r.remark,
r.photo,
c.check_content AS checkContent,
c.check_standard AS checkStandard
FROM eqp_equipment_inspection_record r
LEFT JOIN eqp_equipment_checklist c ON r.check_id = c.check_id AND c.del_flag = '0'
${ew.customSqlSegment}
</select>
</mapper>