refactor(eqp): 统一使用QueryWrapper替代LambdaQueryWrapper
- 修改多个Mapper接口中的查询条件构造器类型为QueryWrapper - 更新XML映射文件中的查询条件拼接方式为customSqlSegment - 在Service实现类中重构查询条件构建方法,明确指定表别名以避免列名歧义 - 所有涉及设备管理、设备参数、点检设备、检修记录、备品备件及其变动记录的模块均完成适配 -保留逻辑删除条件并确保其正确应用
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.klp.mes.eqp.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
@@ -20,6 +21,6 @@ public interface EqpEquipmentManagementMapper extends BaseMapperPlus<EqpEquipmen
|
||||
/**
|
||||
* 分页联查设备类型名称
|
||||
*/
|
||||
Page<EqpEquipmentManagementVo> selectVoPagePlus(Page<EqpEquipmentManagementVo> page, @Param("ew") LambdaQueryWrapper<EqpEquipmentManagement> lqw);
|
||||
Page<EqpEquipmentManagementVo> selectVoPagePlus(Page<EqpEquipmentManagementVo> page, @Param("ew") QueryWrapper<EqpEquipmentManagement> lqw);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.klp.mes.eqp.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.klp.mes.eqp.domain.EqpEquipmentParam;
|
||||
import com.klp.mes.eqp.domain.vo.EqpEquipmentParamVo;
|
||||
@@ -15,5 +15,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
public interface EqpEquipmentParamMapper extends BaseMapperPlus<EqpEquipmentParamMapper, EqpEquipmentParam, EqpEquipmentParamVo> {
|
||||
|
||||
Page<EqpEquipmentParamVo> selectVoPagePlus(Page<Object> build,@Param("ew") LambdaQueryWrapper<EqpEquipmentParam> lqw);
|
||||
Page<EqpEquipmentParamVo> selectVoPagePlus(Page<Object> build, @Param("ew") QueryWrapper<EqpEquipmentParam> qw);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.klp.mes.eqp.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.klp.mes.eqp.domain.EqpInspectedEquipment;
|
||||
import com.klp.mes.eqp.domain.vo.EqpInspectedEquipmentVo;
|
||||
@@ -15,5 +16,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
public interface EqpInspectedEquipmentMapper extends BaseMapperPlus<EqpInspectedEquipmentMapper, EqpInspectedEquipment, EqpInspectedEquipmentVo> {
|
||||
|
||||
Page<EqpInspectedEquipmentVo> selectVoPagePlus(Page<Object> build,@Param("ew") LambdaQueryWrapper<EqpInspectedEquipment> lqw);
|
||||
Page<EqpInspectedEquipmentVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<EqpInspectedEquipment> lqw);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.klp.mes.eqp.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.klp.mes.eqp.domain.EqpInspectionRecord;
|
||||
import com.klp.mes.eqp.domain.vo.EqpInspectionRecordVo;
|
||||
@@ -15,5 +16,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
public interface EqpInspectionRecordMapper extends BaseMapperPlus<EqpInspectionRecordMapper, EqpInspectionRecord, EqpInspectionRecordVo> {
|
||||
|
||||
Page<EqpInspectionRecordVo> selectVoPagePlus(Page<Object> build,@Param("ew") LambdaQueryWrapper<EqpInspectionRecord> lqw);
|
||||
Page<EqpInspectionRecordVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<EqpInspectionRecord> lqw);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.klp.mes.eqp.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.klp.mes.eqp.domain.EqpSparePart;
|
||||
import com.klp.mes.eqp.domain.vo.EqpSparePartVo;
|
||||
@@ -15,5 +16,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
public interface EqpSparePartMapper extends BaseMapperPlus<EqpSparePartMapper, EqpSparePart, EqpSparePartVo> {
|
||||
|
||||
Page<EqpSparePartVo> selectVoPagePlus(Page<Object> build,@Param("ew") LambdaQueryWrapper<EqpSparePart> lqw);
|
||||
Page<EqpSparePartVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<EqpSparePart> lqw);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.klp.mes.eqp.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.klp.mes.eqp.domain.EqpSparePartsChange;
|
||||
import com.klp.mes.eqp.domain.vo.EqpSparePartsChangeVo;
|
||||
@@ -15,5 +16,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
public interface EqpSparePartsChangeMapper extends BaseMapperPlus<EqpSparePartsChangeMapper, EqpSparePartsChange, EqpSparePartsChangeVo> {
|
||||
|
||||
Page<EqpSparePartsChangeVo> selectVoPagePlus(Page<Object> build,@Param("ew") LambdaQueryWrapper<EqpSparePartsChange> lqw);
|
||||
Page<EqpSparePartsChangeVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<EqpSparePartsChange> lqw);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.klp.mes.eqp.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.klp.mes.eqp.domain.EqpTypeParam;
|
||||
import com.klp.mes.eqp.domain.vo.EqpTypeParamVo;
|
||||
@@ -15,5 +16,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
public interface EqpTypeParamMapper extends BaseMapperPlus<EqpTypeParamMapper, EqpTypeParam, EqpTypeParamVo> {
|
||||
|
||||
Page<EqpTypeParamVo> selectVoPagePlus(Page<Object> build,@Param("ew") LambdaQueryWrapper<EqpTypeParam> lqw);
|
||||
Page<EqpTypeParamVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<EqpTypeParam> lqw);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.klp.mes.eqp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -44,17 +45,38 @@ public class EqpEquipmentManagementServiceImpl implements IEqpEquipmentManagemen
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EqpEquipmentManagementVo> queryPageList(EqpEquipmentManagementBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EqpEquipmentManagement> lqw = buildQueryWrapper(bo);
|
||||
QueryWrapper<EqpEquipmentManagement> lqw = buildQueryWrapperPlus(bo);
|
||||
Page<EqpEquipmentManagementVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
private QueryWrapper<EqpEquipmentManagement> buildQueryWrapperPlus(EqpEquipmentManagementBo bo) {
|
||||
// 使用主表别名 em.,避免联表下的列名歧义
|
||||
QueryWrapper<EqpEquipmentManagement> qw = new QueryWrapper<>();
|
||||
qw.like(StringUtils.isNotBlank(bo.getEquipmentName()), "em.equipment_name", bo.getEquipmentName());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getModel()), "em.model", bo.getModel());
|
||||
qw.eq(bo.getTypeId() != null, "em.type_id", bo.getTypeId());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getEquipmentCode()), "em.equipment_code", bo.getEquipmentCode());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getLocation()), "em.location", bo.getLocation());
|
||||
qw.eq(bo.getQuantity() != null, "em.quantity", bo.getQuantity());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getManager()), "em.manager", bo.getManager());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getOssId()), "em.oss_id", bo.getOssId());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getStatus()), "em.status", bo.getStatus());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getStopReason()), "em.stop_reason", bo.getStopReason());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getEquipmentDestination()), "em.equipment_destination", bo.getEquipmentDestination());
|
||||
qw.eq(bo.getEnableTime() != null, "em.enable_time", bo.getEnableTime());
|
||||
qw.eq(bo.getRetireTime() != null, "em.retire_time", bo.getRetireTime());
|
||||
//逻辑删除
|
||||
qw.eq("em.del_flag", 0);
|
||||
return qw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备管理(合并在役和退役设备)列表
|
||||
*/
|
||||
@Override
|
||||
public List<EqpEquipmentManagementVo> queryList(EqpEquipmentManagementBo bo) {
|
||||
LambdaQueryWrapper<EqpEquipmentManagement> lqw = buildQueryWrapper(bo);
|
||||
QueryWrapper<EqpEquipmentManagement> lqw = buildQueryWrapperPlus(bo);
|
||||
// 使用联查类型名称的 SQL
|
||||
Page<EqpEquipmentManagementVo> build = new PageQuery().build();
|
||||
build.setSize(Long.MAX_VALUE);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.klp.mes.eqp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -44,17 +45,30 @@ public class EqpEquipmentParamServiceImpl implements IEqpEquipmentParamService {
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EqpEquipmentParamVo> queryPageList(EqpEquipmentParamBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EqpEquipmentParam> lqw = buildQueryWrapper(bo);
|
||||
QueryWrapper<EqpEquipmentParam> lqw = buildQueryWrapperPlus(bo);
|
||||
Page<EqpEquipmentParamVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
private QueryWrapper<EqpEquipmentParam> buildQueryWrapperPlus(EqpEquipmentParamBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
QueryWrapper<EqpEquipmentParam> qw = new QueryWrapper<>();
|
||||
// 使用主表别名 ep.,避免联表下的列名歧义
|
||||
qw.like(StringUtils.isNotBlank(bo.getParamName()), "ep.param_name", bo.getParamName());
|
||||
qw.eq(bo.getEquipmentId() != null, "ep.equipment_id", bo.getEquipmentId());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getParamType()), "ep.param_type", bo.getParamType());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getParamStandard()), "ep.param_standard", bo.getParamStandard());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getParamUnit()), "ep.param_unit", bo.getParamUnit());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getParamSource()), "ep.param_source", bo.getParamSource());
|
||||
// 逻辑删除
|
||||
qw.eq("ep.del_flag", 0);
|
||||
return qw;
|
||||
}
|
||||
/**
|
||||
* 查询设备参数列表
|
||||
*/
|
||||
@Override
|
||||
public List<EqpEquipmentParamVo> queryList(EqpEquipmentParamBo bo) {
|
||||
LambdaQueryWrapper<EqpEquipmentParam> lqw = buildQueryWrapper(bo);
|
||||
QueryWrapper<EqpEquipmentParam> lqw = buildQueryWrapperPlus(bo);
|
||||
Page<Object> build = new PageQuery().build();
|
||||
build.setSize(Long.MAX_VALUE);
|
||||
Page<EqpEquipmentParamVo> eqpEquipmentParamVoPage = baseMapper.selectVoPagePlus(build, lqw);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.klp.mes.eqp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -44,17 +45,30 @@ public class EqpInspectedEquipmentServiceImpl implements IEqpInspectedEquipmentS
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EqpInspectedEquipmentVo> queryPageList(EqpInspectedEquipmentBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EqpInspectedEquipment> lqw = buildQueryWrapper(bo);
|
||||
Page<EqpInspectedEquipmentVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
QueryWrapper<EqpInspectedEquipment> lqw = buildQueryWrapperPlus(bo);
|
||||
Page<EqpInspectedEquipmentVo> result = baseMapper.selectVoPagePlus(pageQuery.build(),lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
private QueryWrapper<EqpInspectedEquipment> buildQueryWrapperPlus(EqpInspectedEquipmentBo bo) {
|
||||
// 使用表别名 ie.,避免联表查询时的列名歧义
|
||||
QueryWrapper<EqpInspectedEquipment> qw = new QueryWrapper<>();
|
||||
qw.eq(bo.getEquipmentId() != null, "ie.equipment_id", bo.getEquipmentId());
|
||||
qw.eq(bo.getInspectTime() != null, "ie.inspect_time", bo.getInspectTime());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getInspectVendor()), "ie.inspect_vendor", bo.getInspectVendor());
|
||||
qw.eq(bo.getRemainTime() != null, "ie.remain_time", bo.getRemainTime());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getStatus()), "ie.status", bo.getStatus());
|
||||
//逻辑删除
|
||||
qw.eq("ie.del_flag", 0);
|
||||
return qw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询待检设备列表
|
||||
*/
|
||||
@Override
|
||||
public List<EqpInspectedEquipmentVo> queryList(EqpInspectedEquipmentBo bo) {
|
||||
LambdaQueryWrapper<EqpInspectedEquipment> lqw = buildQueryWrapper(bo);
|
||||
QueryWrapper<EqpInspectedEquipment> lqw = buildQueryWrapperPlus(bo);
|
||||
Page<Object> build = new PageQuery().build();
|
||||
build.setSize(Long.MAX_VALUE);
|
||||
Page<EqpInspectedEquipmentVo> eqpInspectedEquipmentVoPage = baseMapper.selectVoPagePlus(build, lqw);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.klp.mes.eqp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -44,11 +45,24 @@ public class EqpInspectionRecordServiceImpl implements IEqpInspectionRecordServi
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EqpInspectionRecordVo> queryPageList(EqpInspectionRecordBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EqpInspectionRecord> lqw = buildQueryWrapper(bo);
|
||||
QueryWrapper<EqpInspectionRecord> lqw = buildQueryWrapperPlus(bo);
|
||||
Page<EqpInspectionRecordVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
private QueryWrapper<EqpInspectionRecord> buildQueryWrapperPlus(EqpInspectionRecordBo bo) {
|
||||
// 使用表别名 ir.,避免联表查询时的列名歧义
|
||||
QueryWrapper<EqpInspectionRecord> qw = new QueryWrapper<>();
|
||||
qw.eq(bo.getEquipmentId() != null, "ir.equipment_id", bo.getEquipmentId());
|
||||
qw.eq(bo.getInspectTime() != null, "ir.inspect_time", bo.getInspectTime());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getInspectVendor()), "ir.inspect_vendor", bo.getInspectVendor());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getInspectContent()), "ir.inspect_content", bo.getInspectContent());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getResult()), "ir.result", bo.getResult());
|
||||
//逻辑删除
|
||||
qw.eq("ir.del_flag", 0);
|
||||
return qw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询检修记录列表
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.klp.mes.eqp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -44,11 +45,25 @@ public class EqpSparePartServiceImpl implements IEqpSparePartService {
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EqpSparePartVo> queryPageList(EqpSparePartBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EqpSparePart> lqw = buildQueryWrapper(bo);
|
||||
QueryWrapper<EqpSparePart> lqw = buildQueryWrapperPlus(bo);
|
||||
Page<EqpSparePartVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
private QueryWrapper<EqpSparePart> buildQueryWrapperPlus(EqpSparePartBo bo) {
|
||||
// 使用表别名 sp.,避免联表查询时的列名歧义
|
||||
QueryWrapper<EqpSparePart> qw = new QueryWrapper<>();
|
||||
qw.like(StringUtils.isNotBlank(bo.getPartName()), "sp.part_name", bo.getPartName());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getMaterialCategory()), "sp.material_category", bo.getMaterialCategory());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getModel()), "sp.model", bo.getModel());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getUnit()), "sp.unit", bo.getUnit());
|
||||
qw.eq(bo.getEquipmentId() != null, "sp.equipment_id", bo.getEquipmentId());
|
||||
qw.eq(bo.getQuantity() != null, "sp.quantity", bo.getQuantity());
|
||||
//逻辑删除
|
||||
qw.eq("sp.del_flag", 0);
|
||||
return qw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询备品备件列表
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.klp.mes.eqp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -44,11 +45,24 @@ public class EqpSparePartsChangeServiceImpl implements IEqpSparePartsChangeServi
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EqpSparePartsChangeVo> queryPageList(EqpSparePartsChangeBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EqpSparePartsChange> lqw = buildQueryWrapper(bo);
|
||||
QueryWrapper<EqpSparePartsChange> lqw = buildQueryWrapperPlus(bo);
|
||||
Page<EqpSparePartsChangeVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
private QueryWrapper<EqpSparePartsChange> buildQueryWrapperPlus(EqpSparePartsChangeBo bo) {
|
||||
// 使用表别名 pc.,避免联表查询时的列名歧义
|
||||
QueryWrapper<EqpSparePartsChange> qw = new QueryWrapper<>();
|
||||
qw.eq(bo.getPartId() != null, "pc.part_id", bo.getPartId());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getChangeType()), "pc.change_type", bo.getChangeType());
|
||||
qw.eq(bo.getChangeQuantity() != null, "pc.change_quantity", bo.getChangeQuantity());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getReason()), "pc.reason", bo.getReason());
|
||||
qw.eq(bo.getChangeTime() != null, "pc.change_time", bo.getChangeTime());
|
||||
//逻辑删除
|
||||
qw.eq("pc.del_flag", 0);
|
||||
return qw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询备品备件变动记录列表
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.klp.mes.eqp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -44,17 +45,32 @@ public class EqpTypeParamServiceImpl implements IEqpTypeParamService {
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EqpTypeParamVo> queryPageList(EqpTypeParamBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EqpTypeParam> lqw = buildQueryWrapper(bo);
|
||||
QueryWrapper<EqpTypeParam> lqw = buildQueryWrapperPlus(bo);
|
||||
Page<EqpTypeParamVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
private QueryWrapper<EqpTypeParam> buildQueryWrapperPlus(EqpTypeParamBo bo) {
|
||||
// 使用表别名 tp.,避免联表查询时的列名歧义
|
||||
QueryWrapper<EqpTypeParam> qw = new QueryWrapper<>();
|
||||
qw.eq(bo.getTypeId() != null, "tp.type_id", bo.getTypeId());
|
||||
qw.like(StringUtils.isNotBlank(bo.getParamName()), "tp.param_name", bo.getParamName());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getParamType()), "tp.param_type", bo.getParamType());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getParamStandard()), "tp.param_standard", bo.getParamStandard());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getParamUnit()), "tp.param_unit", bo.getParamUnit());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getParamSource()), "tp.param_source", bo.getParamSource());
|
||||
qw.eq(bo.getIsMandatory() != null, "tp.is_mandatory", bo.getIsMandatory());
|
||||
// 逻辑删除
|
||||
qw.eq("tp.del_flag", 0);
|
||||
return qw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备类型参数(某类设备的通用参数标准)列表
|
||||
*/
|
||||
@Override
|
||||
public List<EqpTypeParamVo> queryList(EqpTypeParamBo bo) {
|
||||
LambdaQueryWrapper<EqpTypeParam> lqw = buildQueryWrapper(bo);
|
||||
QueryWrapper<EqpTypeParam> lqw = buildQueryWrapperPlus(bo);
|
||||
Page<Object> eqpTypeParamVoPage = new Page<>();
|
||||
eqpTypeParamVoPage.setSize(Long.MAX_VALUE);
|
||||
Page<EqpTypeParamVo> eqpTypeParamVoPage1 = baseMapper.selectVoPagePlus(eqpTypeParamVoPage, lqw);
|
||||
|
||||
@@ -49,12 +49,7 @@
|
||||
em.remark
|
||||
FROM eqp_equipment_management em
|
||||
LEFT JOIN eqp_equipment_type et ON em.type_id = et.type_id and et.del_flag = '0'
|
||||
<where>
|
||||
em.del_flag = '0'
|
||||
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
|
||||
AND ${ew.sqlSegment}
|
||||
</if>
|
||||
</where>
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -32,12 +32,7 @@
|
||||
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>
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -30,12 +30,7 @@
|
||||
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>
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -31,12 +31,7 @@
|
||||
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>
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -32,12 +32,7 @@
|
||||
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>
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -31,12 +31,7 @@
|
||||
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>
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -34,12 +34,7 @@
|
||||
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>
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user