feat(eqp): 增加设备名称和备件名称的关联查询功能

- 在多个Mapper接口中添加selectVoPagePlus方法支持分页查询
- 在XML映射文件中新增selectVoPagePlus查询语句,联查设备管理表或备件表获取设备名称/备件名称- 修改ServiceImpl中的分页查询方法调用selectVoPagePlus替换原有的selectVoPage- 在Vo类中增加equipmentName和partName字段用于展示关联信息- 更新EqpEquipmentManagementMapper.xml中eqp_equipment_type关联查询条件,过滤已删除数据
- 优化queryList方法使用selectVoPagePlus实现列表查询功能
This commit is contained in:
2025-10-18 10:07:33 +08:00
parent c9e6fe6226
commit 843843ae06
18 changed files with 121 additions and 6 deletions

View File

@@ -44,4 +44,6 @@ public class EqpEquipmentTypeVo {
private String remark; private String remark;
} }

View File

@@ -64,5 +64,11 @@ public class EqpInspectedEquipmentVo {
@ExcelProperty(value = "备注") @ExcelProperty(value = "备注")
private String remark; private String remark;
/**
* 设备名称
*/
@ExcelProperty(value = "设备名称")
private String equipmentName;
} }

View File

@@ -64,5 +64,7 @@ public class EqpInspectionRecordVo {
@ExcelProperty(value = "备注") @ExcelProperty(value = "备注")
private String remark; private String remark;
@ExcelProperty(value = "设备名称")
private String equipmentName;
} }

View File

@@ -69,4 +69,8 @@ public class EqpSparePartVo {
private String remark; private String remark;
@ExcelProperty(value = "设备名称")
private String equipmentName;
} }

View File

@@ -64,5 +64,8 @@ public class EqpSparePartsChangeVo {
@ExcelProperty(value = "备注") @ExcelProperty(value = "备注")
private String remark; private String remark;
@ExcelProperty(value = "备件名称")
private String partName;
} }

View File

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

View File

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

View File

@@ -1,8 +1,11 @@
package com.klp.mes.eqp.mapper; package com.klp.mes.eqp.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.klp.mes.eqp.domain.EqpSparePart; import com.klp.mes.eqp.domain.EqpSparePart;
import com.klp.mes.eqp.domain.vo.EqpSparePartVo; import com.klp.mes.eqp.domain.vo.EqpSparePartVo;
import com.klp.common.core.mapper.BaseMapperPlus; import com.klp.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
/** /**
* 备品备件Mapper接口 * 备品备件Mapper接口
@@ -12,4 +15,5 @@ import com.klp.common.core.mapper.BaseMapperPlus;
*/ */
public interface EqpSparePartMapper extends BaseMapperPlus<EqpSparePartMapper, EqpSparePart, EqpSparePartVo> { public interface EqpSparePartMapper extends BaseMapperPlus<EqpSparePartMapper, EqpSparePart, EqpSparePartVo> {
Page<EqpSparePartVo> selectVoPagePlus(Page<Object> build,@Param("ew") LambdaQueryWrapper<EqpSparePart> lqw);
} }

View File

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

View File

@@ -45,7 +45,7 @@ public class EqpInspectedEquipmentServiceImpl implements IEqpInspectedEquipmentS
@Override @Override
public TableDataInfo<EqpInspectedEquipmentVo> queryPageList(EqpInspectedEquipmentBo bo, PageQuery pageQuery) { public TableDataInfo<EqpInspectedEquipmentVo> queryPageList(EqpInspectedEquipmentBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<EqpInspectedEquipment> lqw = buildQueryWrapper(bo); LambdaQueryWrapper<EqpInspectedEquipment> lqw = buildQueryWrapper(bo);
Page<EqpInspectedEquipmentVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); Page<EqpInspectedEquipmentVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
return TableDataInfo.build(result); return TableDataInfo.build(result);
} }
@@ -55,7 +55,10 @@ public class EqpInspectedEquipmentServiceImpl implements IEqpInspectedEquipmentS
@Override @Override
public List<EqpInspectedEquipmentVo> queryList(EqpInspectedEquipmentBo bo) { public List<EqpInspectedEquipmentVo> queryList(EqpInspectedEquipmentBo bo) {
LambdaQueryWrapper<EqpInspectedEquipment> lqw = buildQueryWrapper(bo); LambdaQueryWrapper<EqpInspectedEquipment> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw); Page<Object> build = new PageQuery().build();
build.setSize(Long.MAX_VALUE);
Page<EqpInspectedEquipmentVo> eqpInspectedEquipmentVoPage = baseMapper.selectVoPagePlus(build, lqw);
return eqpInspectedEquipmentVoPage.getRecords();
} }
private LambdaQueryWrapper<EqpInspectedEquipment> buildQueryWrapper(EqpInspectedEquipmentBo bo) { private LambdaQueryWrapper<EqpInspectedEquipment> buildQueryWrapper(EqpInspectedEquipmentBo bo) {

View File

@@ -45,7 +45,7 @@ public class EqpInspectionRecordServiceImpl implements IEqpInspectionRecordServi
@Override @Override
public TableDataInfo<EqpInspectionRecordVo> queryPageList(EqpInspectionRecordBo bo, PageQuery pageQuery) { public TableDataInfo<EqpInspectionRecordVo> queryPageList(EqpInspectionRecordBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<EqpInspectionRecord> lqw = buildQueryWrapper(bo); LambdaQueryWrapper<EqpInspectionRecord> lqw = buildQueryWrapper(bo);
Page<EqpInspectionRecordVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); Page<EqpInspectionRecordVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
return TableDataInfo.build(result); return TableDataInfo.build(result);
} }

View File

@@ -45,7 +45,7 @@ public class EqpSparePartServiceImpl implements IEqpSparePartService {
@Override @Override
public TableDataInfo<EqpSparePartVo> queryPageList(EqpSparePartBo bo, PageQuery pageQuery) { public TableDataInfo<EqpSparePartVo> queryPageList(EqpSparePartBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<EqpSparePart> lqw = buildQueryWrapper(bo); LambdaQueryWrapper<EqpSparePart> lqw = buildQueryWrapper(bo);
Page<EqpSparePartVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); Page<EqpSparePartVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
return TableDataInfo.build(result); return TableDataInfo.build(result);
} }

View File

@@ -45,7 +45,7 @@ public class EqpSparePartsChangeServiceImpl implements IEqpSparePartsChangeServi
@Override @Override
public TableDataInfo<EqpSparePartsChangeVo> queryPageList(EqpSparePartsChangeBo bo, PageQuery pageQuery) { public TableDataInfo<EqpSparePartsChangeVo> queryPageList(EqpSparePartsChangeBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<EqpSparePartsChange> lqw = buildQueryWrapper(bo); LambdaQueryWrapper<EqpSparePartsChange> lqw = buildQueryWrapper(bo);
Page<EqpSparePartsChangeVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); Page<EqpSparePartsChangeVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
return TableDataInfo.build(result); return TableDataInfo.build(result);
} }

View File

@@ -48,7 +48,7 @@
em.retire_time, em.retire_time,
em.remark em.remark
FROM eqp_equipment_management em FROM eqp_equipment_management em
LEFT JOIN eqp_equipment_type et ON em.type_id = et.type_id LEFT JOIN eqp_equipment_type et ON em.type_id = et.type_id and et.del_flag = '0'
<where> <where>
em.del_flag = '0' em.del_flag = '0'
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''"> <if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">

View File

@@ -18,6 +18,25 @@
<result property="delFlag" column="del_flag"/> <result property="delFlag" column="del_flag"/>
<result property="remark" column="remark"/> <result property="remark" column="remark"/>
</resultMap> </resultMap>
<select id="selectVoPagePlus" resultType="com.klp.mes.eqp.domain.vo.EqpInspectedEquipmentVo">
SELECT
ie.inspect_id,
ie.equipment_id,
em.equipment_name AS equipmentName,
ie.inspect_time,
ie.inspect_vendor,
ie.remain_time,
ie.status,
ie.remark
FROM eqp_inspected_equipment ie
LEFT JOIN eqp_equipment_management em ON ie.equipment_id = em.equipment_id and em.del_flag = '0'
<where>
ie.del_flag = '0'
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
AND ${ew.sqlSegment}
</if>
</where>
</select>
</mapper> </mapper>

View File

@@ -18,6 +18,26 @@
<result property="delFlag" column="del_flag"/> <result property="delFlag" column="del_flag"/>
<result property="remark" column="remark"/> <result property="remark" column="remark"/>
</resultMap> </resultMap>
<select id="selectVoPagePlus" resultType="com.klp.mes.eqp.domain.vo.EqpInspectionRecordVo">
-- 联查设备管理表拿设备名称
SELECT
ir.record_id,
ir.equipment_id,
em.equipment_name AS equipmentName,
ir.inspect_time,
ir.inspect_vendor,
ir.inspect_content,
ir.result,
ir.remark
FROM eqp_inspection_record ir
LEFT JOIN eqp_equipment_management em ON ir.equipment_id = em.equipment_id and em.del_flag = '0'
<where>
ir.del_flag = '0'
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
AND ${ew.sqlSegment}
</if>
</where>
</select>
</mapper> </mapper>

View File

@@ -19,6 +19,26 @@
<result property="delFlag" column="del_flag"/> <result property="delFlag" column="del_flag"/>
<result property="remark" column="remark"/> <result property="remark" column="remark"/>
</resultMap> </resultMap>
<select id="selectVoPagePlus" resultType="com.klp.mes.eqp.domain.vo.EqpSparePartVo">
SELECT
sp.part_id,
sp.part_name,
sp.material_category,
sp.model,
sp.unit,
sp.equipment_id,
em.equipment_name AS equipmentName,
sp.quantity,
sp.remark
FROM eqp_spare_part sp
LEFT JOIN eqp_equipment_management em ON sp.equipment_id = em.equipment_id and em.del_flag = '0'
<where>
sp.del_flag = '0'
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
AND ${ew.sqlSegment}
</if>
</where>
</select>
</mapper> </mapper>

View File

@@ -18,6 +18,26 @@
<result property="delFlag" column="del_flag"/> <result property="delFlag" column="del_flag"/>
<result property="remark" column="remark"/> <result property="remark" column="remark"/>
</resultMap> </resultMap>
<select id="selectVoPagePlus" resultType="com.klp.mes.eqp.domain.vo.EqpSparePartsChangeVo">
-- 联查备件表拿备件名称
SELECT
pc.change_id,
pc.part_id,
sp.part_name AS partName,
pc.change_type,
pc.change_quantity,
pc.reason,
pc.change_time,
pc.remark
FROM eqp_spare_parts_change pc
LEFT JOIN eqp_spare_part sp ON pc.part_id = sp.part_id and sp.del_flag = '0'
<where>
pc.del_flag = '0'
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
AND ${ew.sqlSegment}
</if>
</where>
</select>
</mapper> </mapper>