diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/PartType.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/PartType.java index 830943a9..e59ef391 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/PartType.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/PartType.java @@ -128,4 +128,5 @@ public class PartType extends BaseEntity @ApiModelProperty(value = "三级层级") private String thirdLevel; + private Integer flag; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/part/service/impl/PartLeaseServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/part/service/impl/PartLeaseServiceImpl.java index 60175e12..13a7660c 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/part/service/impl/PartLeaseServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/part/service/impl/PartLeaseServiceImpl.java @@ -185,16 +185,71 @@ public class PartLeaseServiceImpl implements PartLeaseService { } if ("2".equals(partType.getLevel()) && partType.getId() == null) { // 获取partTypeList中的level为2的数据 - for (PartType type : partTypeList) { - PartType type1 = new PartType(); - type1.setId(type.getSecondId()); - type1.setPaName(type.getPartName()); - // 先判断list集合中是否包含该数据 - if (!list.contains(type1)) { - list.add(type1); + if(partType.getFlag() == null) { + // 获取partTypeList中的level为2的数据 + for (PartType type : partTypeList) { + PartType type1 = new PartType(); + type1.setId(type.getSecondId()); + type1.setPaName(type.getPartName()); + type1.setSecondId(type.getSecondId()); + type1.setSecondLevel(type.getSecondLevel()); + type1.setThirdId(type.getThirdId()); + type1.setThirdLevel(type.getThirdLevel()); + type1.setStorageNum(type.getStorageNum()); + type1.setUnitName(type.getUnitName()); + type1.setPartName(type.getPartName()); + // 先判断list集合中是否包含该数据 + if (!list.contains(type1)) { + list.add(type1); + } + } + return AjaxResult.success(list); + }else{ + for (PartType type : partTypeList) { + PartType type1 = new PartType(); + type1.setId(type.getSecondId()); + type1.setPaName(type.getPaName()); + type1.setSecondId(type.getSecondId()); + type1.setSecondLevel(type.getSecondLevel()); + type1.setThirdId(type.getThirdId()); + type1.setThirdLevel(type.getThirdLevel()); + type1.setStorageNum(type.getStorageNum()); + type1.setUnitName(type.getUnitName()); + type1.setPartName(type.getPartName()); + // 先判断list集合中是否包含该数据 + if (!list.contains(type1)) { + list.add(type1); + } + } + if (!CollectionUtils.isEmpty(list)) { + // 从list获取secondLevel为2的数据,并去重放到secondList中 + for (PartType type : list) { + if ("2".equals(type.getSecondLevel())) { + PartType type1 = new PartType(); + type1.setId(type.getSecondId()); + type1.setPaName(type.getPartName()); + if (!secondList.contains(type1)) { + secondList.add(type1); + } + } + if ("3".equals(type.getThirdLevel())) { + PartType type1 = new PartType(); + type1.setId(type.getThirdId()); + type1.setPaName(type.getPaName()); + type1.setLevel(type.getThirdLevel()); + type1.setUnitName(type.getUnitName()); + type1.setStorageNum(type.getStorageNum()); + if (!thirdList.contains(type1)) { + thirdList.add(type1); + } + } + } + map.put("secondList", secondList); + map.put("thirdList", thirdList); + return AjaxResult.success(map); } } - return AjaxResult.success(list); + } if ("3".equals(partType.getLevel()) && partType.getId() == null) { // 获取partTypeList中的level为3的数据 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java index db6d41d8..8c645099 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java @@ -1484,7 +1484,9 @@ public class RepairServiceImpl implements RepairService { bean1.setUserName(SecurityUtils.getLoginUser().getSysUser().getNickName()); //查询配件列表 List partList = repairMapper.getPartData(bean1); - bean1.setPartTypeList(partList); + if(partList.size() > 0){ + bean1.setPartTypeList(partList); + } } } return list; diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/part/PartLeaseMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/part/PartLeaseMapper.xml index 0c9e65b3..ec02edb8 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/part/PartLeaseMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/part/PartLeaseMapper.xml @@ -235,6 +235,16 @@ and m1.parent_id = #{id} + + and ( + m1.pa_name like concat('%', #{paName}, '%') + ) + + + and ( + m1.pa_name like concat('%', #{paName}, '%') + ) + and m.parent_id = #{id} diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml index e2931fd6..b2496fa6 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml @@ -958,7 +958,7 @@ CONCAT(bai.`code`, '-', rad.`level`) as `code`, mm.ma_code as maCode, su.nick_name as repairer, - DATE_FORMAT(rad.update_time,'%y%m%d') as createTime, + DATE_FORMAT(rad.update_time,'%Y-%m-%d') as createTime, mt.rated_load as ratedLoad, mt.test_load as testLoad, mt.holding_time as holdingTime, @@ -986,6 +986,8 @@ LEFT JOIN ma_part_type mpt2 on mpt2.pa_id = mpt.parent_id WHERE rad.id = #{id} and rar.is_ds = 0 + and rar.part_id IS NOT NULL + and mpt2.pa_name IS NOT NULL ]]>