维修及配件管理修改修复

This commit is contained in:
hongchao 2025-07-24 15:21:22 +08:00
parent 8f9fb12a25
commit 344bbfaad0
5 changed files with 80 additions and 10 deletions

View File

@ -128,4 +128,5 @@ public class PartType extends BaseEntity
@ApiModelProperty(value = "三级层级")
private String thirdLevel;
private Integer flag;
}

View File

@ -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的数据

View File

@ -1484,7 +1484,9 @@ public class RepairServiceImpl implements RepairService {
bean1.setUserName(SecurityUtils.getLoginUser().getSysUser().getNickName());
//查询配件列表
List<PartType> partList = repairMapper.getPartData(bean1);
bean1.setPartTypeList(partList);
if(partList.size() > 0){
bean1.setPartTypeList(partList);
}
}
}
return list;

View File

@ -235,6 +235,16 @@
<if test="level == 2 and id != null">
and m1.parent_id = #{id}
</if>
<if test="level == 2 and id != null and paName != null and paName != ''">
and (
m1.pa_name like concat('%', #{paName}, '%')
)
</if>
<if test="level == 2 and (id == null or id == '') and paName != null and paName != ''">
and (
m1.pa_name like concat('%', #{paName}, '%')
)
</if>
<if test="level == 3 and id != null">
and m.parent_id = #{id}
</if>

View File

@ -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
]]>
</select>