feat(eqp): 实现设备管理分页联查功能
-PagePlus 新增 selectVo 接口支持关联查询 - 修改 EquipmentManagement、EquipmentParam 和 TypeParam 的分页查询逻辑 - 在 VO 对象中增加类型名称和设备名称字段用于展示- 更新 Mapper XML 文件中的 SQL 查询语句以支持左连接查询 - 调整 Service 层实现使用新的分页方法获取数据列表
This commit is contained in:
@@ -45,6 +45,12 @@ public class EqpEquipmentManagementVo {
|
||||
@ExcelProperty(value = "设备类型ID")
|
||||
private Long typeId;
|
||||
|
||||
/**
|
||||
* 设备类型名称
|
||||
*/
|
||||
@ExcelProperty(value = "设备类型名称")
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
|
||||
@@ -69,5 +69,8 @@ public class EqpEquipmentParamVo {
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty(value = "设备名称")
|
||||
private String equipmentName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -77,5 +77,8 @@ public class EqpTypeParamVo {
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
//类型名称
|
||||
@ExcelProperty(value = "类型名称")
|
||||
private String typeName;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package com.klp.mes.eqp.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
import com.klp.mes.eqp.domain.EqpEquipmentManagement;
|
||||
import com.klp.mes.eqp.domain.vo.EqpEquipmentManagementVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
@@ -12,4 +17,9 @@ import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
*/
|
||||
public interface EqpEquipmentManagementMapper extends BaseMapperPlus<EqpEquipmentManagementMapper, EqpEquipmentManagement, EqpEquipmentManagementVo> {
|
||||
|
||||
/**
|
||||
* 分页联查设备类型名称
|
||||
*/
|
||||
Page<EqpEquipmentManagementVo> selectVoPagePlus(Page<EqpEquipmentManagementVo> page, @Param("ew") LambdaQueryWrapper<EqpEquipmentManagement> lqw);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
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.EqpEquipmentParam;
|
||||
import com.klp.mes.eqp.domain.vo.EqpEquipmentParamVo;
|
||||
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 EqpEquipmentParamMapper extends BaseMapperPlus<EqpEquipmentParamMapper, EqpEquipmentParam, EqpEquipmentParamVo> {
|
||||
|
||||
Page<EqpEquipmentParamVo> selectVoPagePlus(Page<Object> build,@Param("ew") LambdaQueryWrapper<EqpEquipmentParam> lqw);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
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.EqpTypeParam;
|
||||
import com.klp.mes.eqp.domain.vo.EqpTypeParamVo;
|
||||
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 EqpTypeParamMapper extends BaseMapperPlus<EqpTypeParamMapper, EqpTypeParam, EqpTypeParamVo> {
|
||||
|
||||
Page<EqpTypeParamVo> selectVoPagePlus(Page<Object> build,@Param("ew") LambdaQueryWrapper<EqpTypeParam> lqw);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class EqpEquipmentManagementServiceImpl implements IEqpEquipmentManagemen
|
||||
@Override
|
||||
public TableDataInfo<EqpEquipmentManagementVo> queryPageList(EqpEquipmentManagementBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EqpEquipmentManagement> lqw = buildQueryWrapper(bo);
|
||||
Page<EqpEquipmentManagementVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
Page<EqpEquipmentManagementVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,11 @@ public class EqpEquipmentManagementServiceImpl implements IEqpEquipmentManagemen
|
||||
@Override
|
||||
public List<EqpEquipmentManagementVo> queryList(EqpEquipmentManagementBo bo) {
|
||||
LambdaQueryWrapper<EqpEquipmentManagement> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
// 使用联查类型名称的 SQL
|
||||
Page<EqpEquipmentManagementVo> build = new PageQuery().build();
|
||||
build.setSize(Long.MAX_VALUE);
|
||||
Page<EqpEquipmentManagementVo> eqpEquipmentManagementVoPage = baseMapper.selectVoPagePlus(build, lqw);
|
||||
return eqpEquipmentManagementVoPage.getRecords();
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<EqpEquipmentManagement> buildQueryWrapper(EqpEquipmentManagementBo bo) {
|
||||
|
||||
@@ -45,7 +45,7 @@ public class EqpEquipmentParamServiceImpl implements IEqpEquipmentParamService {
|
||||
@Override
|
||||
public TableDataInfo<EqpEquipmentParamVo> queryPageList(EqpEquipmentParamBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EqpEquipmentParam> lqw = buildQueryWrapper(bo);
|
||||
Page<EqpEquipmentParamVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
Page<EqpEquipmentParamVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,10 @@ public class EqpEquipmentParamServiceImpl implements IEqpEquipmentParamService {
|
||||
@Override
|
||||
public List<EqpEquipmentParamVo> queryList(EqpEquipmentParamBo bo) {
|
||||
LambdaQueryWrapper<EqpEquipmentParam> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
Page<Object> build = new PageQuery().build();
|
||||
build.setSize(Long.MAX_VALUE);
|
||||
Page<EqpEquipmentParamVo> eqpEquipmentParamVoPage = baseMapper.selectVoPagePlus(build, lqw);
|
||||
return eqpEquipmentParamVoPage.getRecords();
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<EqpEquipmentParam> buildQueryWrapper(EqpEquipmentParamBo bo) {
|
||||
|
||||
@@ -45,7 +45,7 @@ public class EqpTypeParamServiceImpl implements IEqpTypeParamService {
|
||||
@Override
|
||||
public TableDataInfo<EqpTypeParamVo> queryPageList(EqpTypeParamBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EqpTypeParam> lqw = buildQueryWrapper(bo);
|
||||
Page<EqpTypeParamVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
Page<EqpTypeParamVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,10 @@ public class EqpTypeParamServiceImpl implements IEqpTypeParamService {
|
||||
@Override
|
||||
public List<EqpTypeParamVo> queryList(EqpTypeParamBo bo) {
|
||||
LambdaQueryWrapper<EqpTypeParam> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
Page<Object> eqpTypeParamVoPage = new Page<>();
|
||||
eqpTypeParamVoPage.setSize(Long.MAX_VALUE);
|
||||
Page<EqpTypeParamVo> eqpTypeParamVoPage1 = baseMapper.selectVoPagePlus(eqpTypeParamVoPage, lqw);
|
||||
return eqpTypeParamVoPage1.getRecords();
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<EqpTypeParam> buildQueryWrapper(EqpTypeParamBo bo) {
|
||||
|
||||
@@ -28,4 +28,33 @@
|
||||
</resultMap>
|
||||
|
||||
|
||||
<!-- 分页查询:联查类型名称 -->
|
||||
<select id="selectVoPagePlus" resultType="com.klp.mes.eqp.domain.vo.EqpEquipmentManagementVo">
|
||||
SELECT
|
||||
em.equipment_id,
|
||||
em.equipment_name,
|
||||
em.model,
|
||||
em.type_id,
|
||||
et.type_name AS type_name,
|
||||
em.equipment_code,
|
||||
em.location,
|
||||
em.quantity,
|
||||
em.manager,
|
||||
em.oss_id,
|
||||
em.status,
|
||||
em.stop_reason,
|
||||
em.equipment_destination,
|
||||
em.enable_time,
|
||||
em.retire_time,
|
||||
em.remark
|
||||
FROM eqp_equipment_management em
|
||||
LEFT JOIN eqp_equipment_type et ON em.type_id = et.type_id
|
||||
<where>
|
||||
em.del_flag = '0'
|
||||
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
|
||||
AND ${ew.sqlSegment}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -19,6 +19,26 @@
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
<select id="selectVoPagePlus" resultType="com.klp.mes.eqp.domain.vo.EqpEquipmentParamVo">
|
||||
SELECT
|
||||
ep.param_id,
|
||||
ep.param_name,
|
||||
ep.equipment_id,
|
||||
ee.equipment_name AS equipment_name,
|
||||
ep.param_type,
|
||||
ep.param_standard,
|
||||
ep.param_unit,
|
||||
ep.param_source,
|
||||
ep.remark
|
||||
FROM eqp_equipment_param ep
|
||||
LEFT JOIN eqp_equipment_management ee ON ep.equipment_id = ee.equipment_id
|
||||
<where>
|
||||
ep.del_flag = '0'
|
||||
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
|
||||
AND ${ew.sqlSegment}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -20,6 +20,27 @@
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
<select id="selectVoPagePlus" resultType="com.klp.mes.eqp.domain.vo.EqpTypeParamVo">
|
||||
SELECT
|
||||
tp.type_param_id,
|
||||
tp.type_id,
|
||||
tp.param_name,
|
||||
tp.param_type,
|
||||
tp.param_standard,
|
||||
tp.param_unit,
|
||||
tp.param_source,
|
||||
tp.is_mandatory,
|
||||
tp.remark,
|
||||
t.type_name AS typeName
|
||||
FROM eqp_type_param tp
|
||||
LEFT JOIN eqp_equipment_type t ON tp.type_id = t.type_id
|
||||
<where>
|
||||
tp.del_flag = 0
|
||||
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
|
||||
AND ${ew.sqlSegment}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user