diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeasePublishInfo.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeasePublishInfo.java index 8cdfeacb..c04fcd72 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeasePublishInfo.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeasePublishInfo.java @@ -271,4 +271,9 @@ public class LeasePublishInfo extends BaseEntity{ @ApiModelProperty(value = "关联外部(第三方)的工程ID") private String externalId; + + private List typeIdList; + + @ApiModelProperty(value = "一级类型id") + private Long firstId; } diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/repair/RepairInputDetails.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/repair/RepairInputDetails.java index 735789ad..0d212979 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/repair/RepairInputDetails.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/repair/RepairInputDetails.java @@ -185,4 +185,10 @@ public class RepairInputDetails extends BaseEntity { private String boxId; + @ApiModelProperty(value = "登录用户id") + private Long userId; + + @ApiModelProperty(value = "一级类型id") + private Long firstId; + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyDetails.java index fdb7d401..8c6748b8 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyDetails.java @@ -124,4 +124,9 @@ public class BackApplyDetails extends BaseEntity { @ApiModelProperty(value = "附件列表") List bmFileInfos; + private List typeIdList; + + @ApiModelProperty(value = "一级类型id") + private Long firstId; + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyInfo.java index fb36d9b2..23474992 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyInfo.java @@ -3,6 +3,8 @@ package com.bonus.material.back.domain; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; @@ -28,6 +30,9 @@ public class BackApplyInfo implements Serializable { private Boolean isExport; + @ApiModelProperty(value = "登录用户id") + private Long userId; + /** ID */ private Long id; @@ -180,4 +185,7 @@ public class BackApplyInfo implements Serializable { * 是否签名 */ private Integer isSign; + + @ApiModelProperty(value = "一级类型id") + private Long firstId; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java index b105fe79..e150d204 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java @@ -373,4 +373,11 @@ public interface BackApplyInfoMapper { * @return */ BackApplyInfo selectByTaskId(Long taskId); + + /** + * 根据用户id查询退料类型 + * @param userId + * @return + */ + List selectTypeIdList(Long userId); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java index 61d7099e..08eb776b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java @@ -87,7 +87,12 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { BackApplyRequestVo backApplyRequestVo = new BackApplyRequestVo(); //先根据外层id查询上层信息 BackApplyInfo backApplyInfo = backApplyInfoMapper.selectBackApplyInfoById(id); - + Long userId = SecurityUtils.getLoginUser().getUserid(); + // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 + List typeIdList = backApplyInfoMapper.selectTypeIdList(userId); + if (CollectionUtils.isEmpty(typeIdList)) { + backApplyInfo.setUserId(userId == 0 ? null : userId); + } /** 设置审批人签名url 防止代码冲突 **/ String directAuditUrl = backApplyInfoMapper.getDirectAuditUrl(backApplyInfo); backApplyInfo.setDirectAuditSignUrl(directAuditUrl); @@ -102,6 +107,11 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { List newCodeList = new ArrayList<>(); List backApplyDetailsList = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(backApplyInfo); if (CollectionUtils.isNotEmpty(backApplyDetailsList)) { + if (!CollectionUtils.isEmpty(typeIdList)) { + backApplyDetailsList = backApplyDetailsList.stream() + .filter(item -> typeIdList.contains(item.getFirstId())) + .collect(Collectors.toList()); + } // 批量查询附件信息,减少数据库访问次数 List bmFileInfos = fetchBmFileInfos(id, backApplyDetailsList); // 查询编码设备信息 @@ -292,12 +302,23 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { */ @Override public List selectBackApplyInfoList(BackApplyInfo backApplyInfo) { + Long userId = SecurityUtils.getLoginUser().getUserid(); + // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 + List typeIdList = backApplyInfoMapper.selectTypeIdList(userId); + if (CollectionUtils.isEmpty(typeIdList)) { + backApplyInfo.setUserId(userId == 0 ? null : userId); + } List list = backApplyInfoMapper.selectBackApplyInfoList(backApplyInfo); // 如果列表为空,直接返回空列表 if (CollectionUtils.isEmpty(list)) { return new ArrayList<>(); } for (BackApplyInfo applyInfo : list) { + if (!CollectionUtils.isEmpty(typeIdList)) { + list = list.stream() + .filter(item -> typeIdList.contains(item.getFirstId())) + .collect(Collectors.toList()); + } if (StringUtils.isNotBlank(applyInfo.getBackSignUrl())) { applyInfo.setBackSignUrl("data:image/png;base64," + applyInfo.getBackSignUrl()); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java index 144a02d7..eb43bc38 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java @@ -752,9 +752,18 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService { @Override public List getPublishList(LeaseApplyInfo leaseApplyInfo) { Long userId = SecurityUtils.getLoginUser().getUserid(); - leaseApplyInfo.setUserId(userId == 0 ? null : userId); + // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 + List typeIdList = leaseApplyInfoMapper.selectTypeIdList(userId); + if (CollectionUtils.isEmpty(typeIdList)) { + leaseApplyInfo.setUserId(userId == 0 ? null : userId); + } List list = mapper.getPublishList(leaseApplyInfo); if (!CollectionUtils.isEmpty(list)) { + if (!CollectionUtils.isEmpty(typeIdList)) { + list = list.stream() + .filter(item -> typeIdList.contains(item.getFirstId())) + .collect(Collectors.toList()); + } String keyWord = leaseApplyInfo.getKeyWord(); // 如果关键字不为空,进行过滤 if (!StringUtils.isBlank(keyWord)) { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairAuditDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairAuditDetails.java index 23492b5a..ef986171 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairAuditDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairAuditDetails.java @@ -140,4 +140,10 @@ public class RepairAuditDetails extends BaseEntity { @ApiModelProperty(value = "维修拆分层级") private String level; + + @ApiModelProperty(value = "登录用户id") + private Long userId; + + @ApiModelProperty(value = "一级类型id") + private Long firstId; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairInputInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairInputInfo.java index f65412c4..d0965486 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairInputInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairInputInfo.java @@ -62,4 +62,7 @@ public class RepairInputInfo extends BaseEntity { @ApiModelProperty(value = "驳回原因") private String rejectReason; + + @ApiModelProperty(value = "一级类型id") + private Long firstId; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTask.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTask.java index 90f86a68..18e19e69 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTask.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTask.java @@ -183,4 +183,10 @@ public class RepairTask { private List ids; private List taskIds; + + @ApiModelProperty(value = "登录用户id") + private Long userId; + + @ApiModelProperty(value = "一级类型id") + private Long firstId; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java index a71209db..ab8110d1 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java @@ -173,6 +173,12 @@ public class RepairTaskDetails extends BaseEntity { private List partTypeList; + @ApiModelProperty(value = "登录用户id") + private Long userId; + + @ApiModelProperty(value = "一级类型id") + private Long firstId; + public RepairTaskDetails(Long taskId) { this.taskId = taskId; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java index 1d87ae14..ac5e40a6 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java @@ -121,6 +121,9 @@ public class RepairDeviceVO { @ApiModelProperty(value = "维修拆分父级id") private Long parentId; + @ApiModelProperty(value = "一级类型id") + private Long firstId; + // 手动覆盖 getter 方法,确保 List 始终被初始化 public List getCodeInRepairPartList() { if (this.codeInRepairPartList == null) {this.codeInRepairPartList = new ArrayList<>();} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/ScrapApplyDetailsVO.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/ScrapApplyDetailsVO.java index 71eaf8a9..9c873376 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/ScrapApplyDetailsVO.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/ScrapApplyDetailsVO.java @@ -136,4 +136,7 @@ public class ScrapApplyDetailsVO { * 文件名称 */ private String dispositionFileName; + + @ApiModelProperty(value = "一级类型id") + private Long firstId; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java index 3e4192a5..aacad46d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java @@ -9,6 +9,7 @@ import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.material.back.mapper.BackApplyInfoMapper; import com.bonus.material.basic.domain.report.PurChaseReportInfo; import com.bonus.material.repair.domain.*; import com.bonus.material.repair.domain.vo.RepairAuditDetailsVO; @@ -79,6 +80,9 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService @Resource private RepairMapper repairMapper; + @Resource + private BackApplyInfoMapper backApplyInfoMapper; + @Override public List getPartRecord(RepairAuditDetails repairAuditDetails) { RepairAuditDetails bean = repairAuditDetailsMapper.getRepairId(repairAuditDetails); @@ -96,7 +100,21 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService */ @Override public List getRepairAuditList(RepairAuditDetails repairAuditDetails) { - return repairAuditDetailsMapper.selectRepairAuditDetailsList(repairAuditDetails); + Long userId = SecurityUtils.getLoginUser().getUserid(); + // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 + List typeIdList = backApplyInfoMapper.selectTypeIdList(userId); + if (CollectionUtils.isEmpty(typeIdList)) { + repairAuditDetails.setUserId(userId == 0 ? null : userId); + } + List list = repairAuditDetailsMapper.selectRepairAuditDetailsList(repairAuditDetails); + if (CollectionUtil.isNotEmpty(list)) { + if (CollectionUtil.isNotEmpty(typeIdList)) { + list = list.stream() + .filter(item -> typeIdList.contains(item.getFirstId())) + .collect(Collectors.toList()); + } + } + return list; } @Override @@ -122,8 +140,21 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService @Override public List selectRepairQuestList(RepairAuditDetails repairAuditDetails) { try { + Long userId = SecurityUtils.getLoginUser().getUserid(); + // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 + List typeIdList = backApplyInfoMapper.selectTypeIdList(userId); + if (CollectionUtils.isEmpty(typeIdList)) { + repairAuditDetails.setUserId(userId == 0 ? null : userId); + } // 获取所有需要查询的 taskId、过滤空的 List repairQuestList = repairAuditDetailsMapper.selectRepairQuestList(repairAuditDetails); + if (!CollectionUtil.isNotEmpty(repairQuestList)) { + if (CollectionUtil.isNotEmpty(typeIdList)) { + repairQuestList = repairQuestList.stream() + .filter(item -> typeIdList.contains(item.getFirstId())) + .collect(Collectors.toList()); + } + } // 通过流过滤掉空对象 并转换为 List集合 List taskIds = repairQuestList.stream() .filter(Objects::nonNull) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairInputDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairInputDetailsServiceImpl.java index ebd06e6f..ff719f4e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairInputDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairInputDetailsServiceImpl.java @@ -18,6 +18,7 @@ import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.back.domain.vo.MaCodeVo; import com.bonus.common.biz.domain.repair.RePairDto; +import com.bonus.material.back.mapper.BackApplyInfoMapper; import com.bonus.material.basic.domain.BmQrcodeInfo; import com.bonus.material.input.domain.InputApplyDetails; import com.bonus.material.lease.mapper.LeaseOutDetailsMapper; @@ -61,6 +62,9 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService @Resource private MachineMapper machineMapper; + + @Resource + private BackApplyInfoMapper backApplyInfoMapper; /** * 查询修试后入库 * @@ -69,8 +73,19 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService */ @Override public List selectRepairInputDetailsById(RepairInputDetails repairInputDetails) { + Long userId = SecurityUtils.getLoginUser().getUserid(); + // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 + List typeIdList = backApplyInfoMapper.selectTypeIdList(userId); + if (org.springframework.util.CollectionUtils.isEmpty(typeIdList)) { + repairInputDetails.setUserId(userId == 0 ? null : userId); + } List inputInfos = repairInputDetailsMapper.selectRepairInputDetailsById(repairInputDetails); if (CollectionUtils.isNotEmpty(inputInfos)) { + if (CollectionUtils.isNotEmpty(typeIdList)) { + inputInfos = inputInfos.stream() + .filter(info -> typeIdList.contains(info.getFirstId())) + .collect(Collectors.toList()); + } for (RepairInputInfo inputInfo : inputInfos) { RepairInputDetails inputDetails = new RepairInputDetails(); inputDetails.setTaskId(inputInfo.getTaskId()); @@ -109,7 +124,20 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService */ @Override public List selectRepairInputDetailsList(RepairInputDetails repairInputDetails) { + Long userId = SecurityUtils.getLoginUser().getUserid(); + // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 + List typeIdList = backApplyInfoMapper.selectTypeIdList(userId); + if (org.springframework.util.CollectionUtils.isEmpty(typeIdList)) { + repairInputDetails.setUserId(userId == 0 ? null : userId); + } List list = repairInputDetailsMapper.selectRepairInputDetailsList(repairInputDetails); + if (CollectionUtils.isNotEmpty(list)) { + if (CollectionUtils.isNotEmpty(typeIdList)) { + list = list.stream() + .filter(inputDetails -> typeIdList.contains(inputDetails.getFirstId())) + .collect(Collectors.toList()); + } + } // if (CollectionUtils.isNotEmpty(list)) { // for (RepairInputDetails inputDetails : list) { // List inputInfos = repairInputDetailsMapper.selectRepairInputDetailsById(inputDetails); 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 e4ef6cd9..d1054c30 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 @@ -104,8 +104,19 @@ public class RepairServiceImpl implements RepairService { */ @Override public List getRepairTaskList(RepairTask bean) { + Long userId = SecurityUtils.getLoginUser().getUserid(); + // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 + List typeIdList = backApplyInfoMapper.selectTypeIdList(userId); + if (CollectionUtils.isEmpty(typeIdList)) { + bean.setUserId(userId == 0 ? null : userId); + } List list = repairMapper.getRepairTaskList(bean); if (CollectionUtil.isNotEmpty(list)) { + if (CollectionUtil.isNotEmpty(typeIdList)) { + list = list.stream() + .filter(item -> typeIdList.contains(item.getFirstId())) + .collect(Collectors.toList()); + } String keyWord = bean.getKeyWord(); // 如果关键字不为空,进行过滤 if (!StringUtils.isBlank(keyWord)) { @@ -139,8 +150,21 @@ public class RepairServiceImpl implements RepairService { @Override public List getRepairDeviceSummary(RepairTaskDetails bean) { + Long userId = SecurityUtils.getLoginUser().getUserid(); + // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 + List typeIdList = backApplyInfoMapper.selectTypeIdList(userId); + if (CollectionUtils.isEmpty(typeIdList)) { + bean.setUserId(userId == 0 ? null : userId); + } List repairDeviceSummaryVoList = new ArrayList<>(); List repairDeviceList = repairMapper.getRepairDeviceList(bean); + if (CollectionUtil.isNotEmpty(repairDeviceList)) { + if (CollectionUtil.isNotEmpty(typeIdList)) { + repairDeviceList = repairDeviceList.stream() + .filter(item -> typeIdList.contains(item.getFirstId())) + .collect(Collectors.toList()); + } + } Map> map = repairDeviceList.stream().collect(Collectors.groupingBy(RepairDeviceVO::getTypeId)); for (Long key : map.keySet()) { List tempList = map.get(key); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml index f0df3acc..ea72833e 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml @@ -48,7 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" GROUP_CONCAT(DISTINCT mt2.type_id) as typeId, GROUP_CONCAT(DISTINCT mt2.type_name) AS typeName, bai.`status` AS status, - bai.print_status as printStatus + bai.print_status as printStatus, + mt4.type_id as firstId FROM back_apply_info bai LEFT JOIN back_apply_details bad on bad.parent_id = bai.id @@ -62,6 +63,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND bu.del_flag = '0' LEFT JOIN ma_type mt1 ON mt1.type_id = bad.type_id AND mt1.del_flag = '0' LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id AND mt2.del_flag = '0' + left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0' + left join ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0' + + JOIN ma_type_repair mtr ON mtr.type_id = bad.type_id AND mtr.user_id = #{userId} + WHERE 1=1 @@ -191,12 +197,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ba.ap_detection AS apDetection, ba.bad_num AS badNum, ba.good_num AS goodNum, - mt.manage_type AS manageType + mt.manage_type AS manageType, + mt3.type_id AS firstId FROM back_apply_details ba LEFT JOIN ma_type mt ON mt.type_id = ba.type_id and mt.del_flag = 0 LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = 0 LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = 0 + LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = 0 + + JOIN ma_type_repair mtr ON mtr.type_id = bad.type_id AND mtr.user_id = #{userId} + WHERE ba.parent_id = #{id} and ( @@ -1003,4 +1014,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE bai.task_id = #{taskId} + + diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml index c8420f12..0ed56739 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml @@ -798,7 +798,8 @@ IFNULL(sum(lad.al_num),0) as alNum, GROUP_CONCAT(DISTINCT mt1.type_name) AS maTypeNames, bp.contract_part as contractPart, - sd.dept_name as impUnitName + sd.dept_name as impUnitName, + mt3.type_id as firstId from lease_apply_info lai left join tm_task tt on lai.task_id = tt.task_id @@ -811,6 +812,8 @@ and sda.dict_type = 'lease_task_status' left join ma_type mt on lad.type_id = mt.type_id and mt.del_flag = '0' left join ma_type mt1 on mt.parent_id = mt1.type_id and mt1.del_flag = '0' + left join ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = '0' + left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0' JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId} diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml index 8449fa25..ccdd3106 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml @@ -37,13 +37,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" rad.* ,mt.type_name as specification_type, mt1.type_name as machine_type_name, mma.ma_code as maCode, rad.ma_id as maId ,mt.manage_type as manageType, - su.nick_name as auditName + su.nick_name as auditName, + mt4.type_id as firstId from repair_audit_details rad left join ma_type mt on rad.type_id = mt.type_id left join ma_type mt1 on mt.parent_id = mt1.type_id left join ma_machine mma on rad.ma_id= mma.ma_id LEFT JOIN sys_user su on rad.audit_by = su.user_id + left join ma_type mt3 ON mt1.parent_id = mt3.type_id and mt3.del_flag = '0' + left join ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0' + + JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id AND mtr.user_id = #{userId} + where rad.task_id = #{taskId} @@ -320,7 +326,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" su.nick_name createBy, tk.create_time createTime, tk.remark, - tk.CODE repairNum + tk.CODE repairNum, + mt4.type_id as firstId FROM tm_task tk LEFT JOIN tm_task tt ON tk.pre_task_id = tt.task_id @@ -333,7 +340,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN ma_type mt ON rad.type_id = mt.type_id LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id LEFT JOIN sys_user su ON su.user_id = tk.create_by - LEFT JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id + left join ma_type mt3 ON mt1.parent_id = mt3.type_id and mt3.del_flag = '0' + left join ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0' + + JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id AND mtr.user_id = #{userId} + WHERE tk.task_type = #{taskType} diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairInputDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairInputDetailsMapper.xml index 43e7681b..fd5542bd 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairInputDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairInputDetailsMapper.xml @@ -45,7 +45,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" su.nick_name AS createBy, tt.CODE AS inputCode, GROUP_CONCAT(DISTINCT mt2.type_name) AS materialType, - tta.agreement_id as agreementId + tta.agreement_id as agreementId, + mt4.type_id as firstId FROM repair_input_details rd LEFT JOIN ma_type mt on rd.type_id = mt.type_id @@ -57,6 +58,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN bm_unit bui ON bai2.unit_id = bui.unit_id LEFT JOIN bm_project bpi ON bai2.project_id = bpi.pro_id and bpi.del_flag = '0' left join sys_user su on rd.create_by = su.user_id + left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0' + left join ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0' + + JOIN ma_type_repair mtr ON mtr.type_id = rd.type_id AND mtr.user_id = #{userId} + AND tt.CODE = #{inputCode} @@ -100,13 +106,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mt.unit_value AS unitValue, mt.manage_type AS manageType, tta.agreement_id as agreementId, - rid.reject_reason as rejectReason + rid.reject_reason as rejectReason, + mt4.type_id as firstId from repair_input_details rid LEFT JOIN ma_type mt on rid.type_id = mt.type_id and mt.del_flag = '0' LEFT JOIN ma_type mt1 on mt.parent_id = mt1.type_id and mt1.del_flag = '0' LEFT JOIN tm_task_agreement tta ON rid.task_id = tta.task_id LEFT JOIN sys_user su on rid.create_by = su.user_id LEFT JOIN sys_user su1 on rid.audit_by = su1.user_id + left join ma_type mt3 ON mt1.parent_id = mt3.type_id and mt3.del_flag = '0' + left join ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0' + + JOIN ma_type_repair mtr ON mtr.type_id = rid.type_id AND mtr.user_id = #{userId} + where rid.task_id = #{taskId} AND ( 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 8f72daf7..6104af87 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 @@ -264,7 +264,8 @@ bpi.pro_name AS backPro, bai.CODE AS backCode, GROUP_CONCAT(DISTINCT mt2.type_name) as type, - rd.level as level + rd.level as level, + mt4.type_id as typeId FROM repair_apply_details rd LEFT JOIN ma_type mt on rd.type_id = mt.type_id @@ -277,6 +278,11 @@ LEFT JOIN bm_project bpi ON bai2.project_id = bpi.pro_id and bpi.del_flag = '0' left join sys_user su on rd.create_by = su.user_id left join sys_user su2 on su2.user_id = rd.repairer + left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0' + left join ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0' + + JOIN ma_type_repair mtr ON mtr.type_id = rd.type_id AND mtr.user_id = #{userId} + AND bui.unit_id = #{backUnit} @@ -397,6 +403,7 @@ rad.parent_id as parentId, rad.create_time, bai.CODE AS backCode, + mt4.type_id AS firstId, ( SELECT COUNT(*) FROM repair_cost rc WHERE rc.repair_id = rad.id ) AS totalCostRecords, ( SELECT COALESCE(SUM(rc.costs), 0) FROM repair_cost rc WHERE rc.repair_id = rad.id ) AS totalCost from @@ -406,6 +413,11 @@ left join sys_user su on rad.repairer = su.user_id left join ma_type mt2 on mt.parent_id = mt2.type_id LEFT JOIN back_apply_info bai ON rad.back_id = bai.id + left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0' + left join ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0' + + JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id AND mtr.user_id = #{userId} + where rad.task_id = #{taskId} and is_ds=0