退料,维修权限

This commit is contained in:
mashuai 2025-07-17 18:35:51 +08:00
parent f6bdfe2af9
commit 41ea12a1ed
21 changed files with 241 additions and 12 deletions

View File

@ -271,4 +271,9 @@ public class LeasePublishInfo extends BaseEntity{
@ApiModelProperty(value = "关联外部(第三方)的工程ID") @ApiModelProperty(value = "关联外部(第三方)的工程ID")
private String externalId; private String externalId;
private List<Long> typeIdList;
@ApiModelProperty(value = "一级类型id")
private Long firstId;
} }

View File

@ -185,4 +185,10 @@ public class RepairInputDetails extends BaseEntity {
private String boxId; private String boxId;
@ApiModelProperty(value = "登录用户id")
private Long userId;
@ApiModelProperty(value = "一级类型id")
private Long firstId;
} }

View File

@ -124,4 +124,9 @@ public class BackApplyDetails extends BaseEntity {
@ApiModelProperty(value = "附件列表") @ApiModelProperty(value = "附件列表")
List<BmFileInfo> bmFileInfos; List<BmFileInfo> bmFileInfos;
private List<Long> typeIdList;
@ApiModelProperty(value = "一级类型id")
private Long firstId;
} }

View File

@ -3,6 +3,8 @@ package com.bonus.material.back.domain;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel; import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -28,6 +30,9 @@ public class BackApplyInfo implements Serializable {
private Boolean isExport; private Boolean isExport;
@ApiModelProperty(value = "登录用户id")
private Long userId;
/** ID */ /** ID */
private Long id; private Long id;
@ -180,4 +185,7 @@ public class BackApplyInfo implements Serializable {
* 是否签名 * 是否签名
*/ */
private Integer isSign; private Integer isSign;
@ApiModelProperty(value = "一级类型id")
private Long firstId;
} }

View File

@ -373,4 +373,11 @@ public interface BackApplyInfoMapper {
* @return * @return
*/ */
BackApplyInfo selectByTaskId(Long taskId); BackApplyInfo selectByTaskId(Long taskId);
/**
* 根据用户id查询退料类型
* @param userId
* @return
*/
List<Long> selectTypeIdList(Long userId);
} }

View File

@ -87,7 +87,12 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
BackApplyRequestVo backApplyRequestVo = new BackApplyRequestVo(); BackApplyRequestVo backApplyRequestVo = new BackApplyRequestVo();
//先根据外层id查询上层信息 //先根据外层id查询上层信息
BackApplyInfo backApplyInfo = backApplyInfoMapper.selectBackApplyInfoById(id); BackApplyInfo backApplyInfo = backApplyInfoMapper.selectBackApplyInfoById(id);
Long userId = SecurityUtils.getLoginUser().getUserid();
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
List<Long> typeIdList = backApplyInfoMapper.selectTypeIdList(userId);
if (CollectionUtils.isEmpty(typeIdList)) {
backApplyInfo.setUserId(userId == 0 ? null : userId);
}
/** 设置审批人签名url 防止代码冲突 **/ /** 设置审批人签名url 防止代码冲突 **/
String directAuditUrl = backApplyInfoMapper.getDirectAuditUrl(backApplyInfo); String directAuditUrl = backApplyInfoMapper.getDirectAuditUrl(backApplyInfo);
backApplyInfo.setDirectAuditSignUrl(directAuditUrl); backApplyInfo.setDirectAuditSignUrl(directAuditUrl);
@ -102,6 +107,11 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
List<MaCodeVo> newCodeList = new ArrayList<>(); List<MaCodeVo> newCodeList = new ArrayList<>();
List<BackApplyDetails> backApplyDetailsList = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(backApplyInfo); List<BackApplyDetails> backApplyDetailsList = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(backApplyInfo);
if (CollectionUtils.isNotEmpty(backApplyDetailsList)) { if (CollectionUtils.isNotEmpty(backApplyDetailsList)) {
if (!CollectionUtils.isEmpty(typeIdList)) {
backApplyDetailsList = backApplyDetailsList.stream()
.filter(item -> typeIdList.contains(item.getFirstId()))
.collect(Collectors.toList());
}
// 批量查询附件信息减少数据库访问次数 // 批量查询附件信息减少数据库访问次数
List<BmFileInfo> bmFileInfos = fetchBmFileInfos(id, backApplyDetailsList); List<BmFileInfo> bmFileInfos = fetchBmFileInfos(id, backApplyDetailsList);
// 查询编码设备信息 // 查询编码设备信息
@ -292,12 +302,23 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
*/ */
@Override @Override
public List<BackApplyInfo> selectBackApplyInfoList(BackApplyInfo backApplyInfo) { public List<BackApplyInfo> selectBackApplyInfoList(BackApplyInfo backApplyInfo) {
Long userId = SecurityUtils.getLoginUser().getUserid();
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
List<Long> typeIdList = backApplyInfoMapper.selectTypeIdList(userId);
if (CollectionUtils.isEmpty(typeIdList)) {
backApplyInfo.setUserId(userId == 0 ? null : userId);
}
List<BackApplyInfo> list = backApplyInfoMapper.selectBackApplyInfoList(backApplyInfo); List<BackApplyInfo> list = backApplyInfoMapper.selectBackApplyInfoList(backApplyInfo);
// 如果列表为空直接返回空列表 // 如果列表为空直接返回空列表
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>(); return new ArrayList<>();
} }
for (BackApplyInfo applyInfo : list) { 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())) { if (StringUtils.isNotBlank(applyInfo.getBackSignUrl())) {
applyInfo.setBackSignUrl("data:image/png;base64," + applyInfo.getBackSignUrl()); applyInfo.setBackSignUrl("data:image/png;base64," + applyInfo.getBackSignUrl());
} }

View File

@ -752,9 +752,18 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
@Override @Override
public List<LeasePublishInfo> getPublishList(LeaseApplyInfo leaseApplyInfo) { public List<LeasePublishInfo> getPublishList(LeaseApplyInfo leaseApplyInfo) {
Long userId = SecurityUtils.getLoginUser().getUserid(); Long userId = SecurityUtils.getLoginUser().getUserid();
leaseApplyInfo.setUserId(userId == 0 ? null : userId); // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
List<Long> typeIdList = leaseApplyInfoMapper.selectTypeIdList(userId);
if (CollectionUtils.isEmpty(typeIdList)) {
leaseApplyInfo.setUserId(userId == 0 ? null : userId);
}
List<LeasePublishInfo> list = mapper.getPublishList(leaseApplyInfo); List<LeasePublishInfo> list = mapper.getPublishList(leaseApplyInfo);
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
if (!CollectionUtils.isEmpty(typeIdList)) {
list = list.stream()
.filter(item -> typeIdList.contains(item.getFirstId()))
.collect(Collectors.toList());
}
String keyWord = leaseApplyInfo.getKeyWord(); String keyWord = leaseApplyInfo.getKeyWord();
// 如果关键字不为空进行过滤 // 如果关键字不为空进行过滤
if (!StringUtils.isBlank(keyWord)) { if (!StringUtils.isBlank(keyWord)) {

View File

@ -140,4 +140,10 @@ public class RepairAuditDetails extends BaseEntity {
@ApiModelProperty(value = "维修拆分层级") @ApiModelProperty(value = "维修拆分层级")
private String level; private String level;
@ApiModelProperty(value = "登录用户id")
private Long userId;
@ApiModelProperty(value = "一级类型id")
private Long firstId;
} }

View File

@ -62,4 +62,7 @@ public class RepairInputInfo extends BaseEntity {
@ApiModelProperty(value = "驳回原因") @ApiModelProperty(value = "驳回原因")
private String rejectReason; private String rejectReason;
@ApiModelProperty(value = "一级类型id")
private Long firstId;
} }

View File

@ -183,4 +183,10 @@ public class RepairTask {
private List<Long> ids; private List<Long> ids;
private List<Long> taskIds; private List<Long> taskIds;
@ApiModelProperty(value = "登录用户id")
private Long userId;
@ApiModelProperty(value = "一级类型id")
private Long firstId;
} }

View File

@ -173,6 +173,12 @@ public class RepairTaskDetails extends BaseEntity {
private List<PartType> partTypeList; private List<PartType> partTypeList;
@ApiModelProperty(value = "登录用户id")
private Long userId;
@ApiModelProperty(value = "一级类型id")
private Long firstId;
public RepairTaskDetails(Long taskId) { public RepairTaskDetails(Long taskId) {
this.taskId = taskId; this.taskId = taskId;
} }

View File

@ -121,6 +121,9 @@ public class RepairDeviceVO {
@ApiModelProperty(value = "维修拆分父级id") @ApiModelProperty(value = "维修拆分父级id")
private Long parentId; private Long parentId;
@ApiModelProperty(value = "一级类型id")
private Long firstId;
// 手动覆盖 getter 方法确保 List 始终被初始化 // 手动覆盖 getter 方法确保 List 始终被初始化
public List<RepairPartDetails> getCodeInRepairPartList() { public List<RepairPartDetails> getCodeInRepairPartList() {
if (this.codeInRepairPartList == null) {this.codeInRepairPartList = new ArrayList<>();} if (this.codeInRepairPartList == null) {this.codeInRepairPartList = new ArrayList<>();}

View File

@ -136,4 +136,7 @@ public class ScrapApplyDetailsVO {
* 文件名称 * 文件名称
*/ */
private String dispositionFileName; private String dispositionFileName;
@ApiModelProperty(value = "一级类型id")
private Long firstId;
} }

View File

@ -9,6 +9,7 @@ import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.security.utils.SecurityUtils; 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.basic.domain.report.PurChaseReportInfo;
import com.bonus.material.repair.domain.*; import com.bonus.material.repair.domain.*;
import com.bonus.material.repair.domain.vo.RepairAuditDetailsVO; import com.bonus.material.repair.domain.vo.RepairAuditDetailsVO;
@ -79,6 +80,9 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
@Resource @Resource
private RepairMapper repairMapper; private RepairMapper repairMapper;
@Resource
private BackApplyInfoMapper backApplyInfoMapper;
@Override @Override
public List<RepairPart> getPartRecord(RepairAuditDetails repairAuditDetails) { public List<RepairPart> getPartRecord(RepairAuditDetails repairAuditDetails) {
RepairAuditDetails bean = repairAuditDetailsMapper.getRepairId(repairAuditDetails); RepairAuditDetails bean = repairAuditDetailsMapper.getRepairId(repairAuditDetails);
@ -96,7 +100,21 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
*/ */
@Override @Override
public List<RepairAuditDetails> getRepairAuditList(RepairAuditDetails repairAuditDetails) { public List<RepairAuditDetails> getRepairAuditList(RepairAuditDetails repairAuditDetails) {
return repairAuditDetailsMapper.selectRepairAuditDetailsList(repairAuditDetails); Long userId = SecurityUtils.getLoginUser().getUserid();
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
List<Long> typeIdList = backApplyInfoMapper.selectTypeIdList(userId);
if (CollectionUtils.isEmpty(typeIdList)) {
repairAuditDetails.setUserId(userId == 0 ? null : userId);
}
List<RepairAuditDetails> 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 @Override
@ -122,8 +140,21 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
@Override @Override
public List<ScrapApplyDetailsVO> selectRepairQuestList(RepairAuditDetails repairAuditDetails) { public List<ScrapApplyDetailsVO> selectRepairQuestList(RepairAuditDetails repairAuditDetails) {
try { try {
Long userId = SecurityUtils.getLoginUser().getUserid();
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
List<Long> typeIdList = backApplyInfoMapper.selectTypeIdList(userId);
if (CollectionUtils.isEmpty(typeIdList)) {
repairAuditDetails.setUserId(userId == 0 ? null : userId);
}
// 获取所有需要查询的 taskId过滤空的 // 获取所有需要查询的 taskId过滤空的
List<ScrapApplyDetailsVO> repairQuestList = repairAuditDetailsMapper.selectRepairQuestList(repairAuditDetails); List<ScrapApplyDetailsVO> 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集合
List<Long> taskIds = repairQuestList.stream() List<Long> taskIds = repairQuestList.stream()
.filter(Objects::nonNull) .filter(Objects::nonNull)

View File

@ -18,6 +18,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils; import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.back.domain.vo.MaCodeVo; import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.common.biz.domain.repair.RePairDto; 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.basic.domain.BmQrcodeInfo;
import com.bonus.material.input.domain.InputApplyDetails; import com.bonus.material.input.domain.InputApplyDetails;
import com.bonus.material.lease.mapper.LeaseOutDetailsMapper; import com.bonus.material.lease.mapper.LeaseOutDetailsMapper;
@ -61,6 +62,9 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
@Resource @Resource
private MachineMapper machineMapper; private MachineMapper machineMapper;
@Resource
private BackApplyInfoMapper backApplyInfoMapper;
/** /**
* 查询修试后入库 * 查询修试后入库
* *
@ -69,8 +73,19 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
*/ */
@Override @Override
public List<RepairInputInfo> selectRepairInputDetailsById(RepairInputDetails repairInputDetails) { public List<RepairInputInfo> selectRepairInputDetailsById(RepairInputDetails repairInputDetails) {
Long userId = SecurityUtils.getLoginUser().getUserid();
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
List<Long> typeIdList = backApplyInfoMapper.selectTypeIdList(userId);
if (org.springframework.util.CollectionUtils.isEmpty(typeIdList)) {
repairInputDetails.setUserId(userId == 0 ? null : userId);
}
List<RepairInputInfo> inputInfos = repairInputDetailsMapper.selectRepairInputDetailsById(repairInputDetails); List<RepairInputInfo> inputInfos = repairInputDetailsMapper.selectRepairInputDetailsById(repairInputDetails);
if (CollectionUtils.isNotEmpty(inputInfos)) { if (CollectionUtils.isNotEmpty(inputInfos)) {
if (CollectionUtils.isNotEmpty(typeIdList)) {
inputInfos = inputInfos.stream()
.filter(info -> typeIdList.contains(info.getFirstId()))
.collect(Collectors.toList());
}
for (RepairInputInfo inputInfo : inputInfos) { for (RepairInputInfo inputInfo : inputInfos) {
RepairInputDetails inputDetails = new RepairInputDetails(); RepairInputDetails inputDetails = new RepairInputDetails();
inputDetails.setTaskId(inputInfo.getTaskId()); inputDetails.setTaskId(inputInfo.getTaskId());
@ -109,7 +124,20 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
*/ */
@Override @Override
public List<RepairInputDetails> selectRepairInputDetailsList(RepairInputDetails repairInputDetails) { public List<RepairInputDetails> selectRepairInputDetailsList(RepairInputDetails repairInputDetails) {
Long userId = SecurityUtils.getLoginUser().getUserid();
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
List<Long> typeIdList = backApplyInfoMapper.selectTypeIdList(userId);
if (org.springframework.util.CollectionUtils.isEmpty(typeIdList)) {
repairInputDetails.setUserId(userId == 0 ? null : userId);
}
List<RepairInputDetails> list = repairInputDetailsMapper.selectRepairInputDetailsList(repairInputDetails); List<RepairInputDetails> 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)) { // if (CollectionUtils.isNotEmpty(list)) {
// for (RepairInputDetails inputDetails : list) { // for (RepairInputDetails inputDetails : list) {
// List<RepairInputInfo> inputInfos = repairInputDetailsMapper.selectRepairInputDetailsById(inputDetails); // List<RepairInputInfo> inputInfos = repairInputDetailsMapper.selectRepairInputDetailsById(inputDetails);

View File

@ -104,8 +104,19 @@ public class RepairServiceImpl implements RepairService {
*/ */
@Override @Override
public List<RepairTask> getRepairTaskList(RepairTask bean) { public List<RepairTask> getRepairTaskList(RepairTask bean) {
Long userId = SecurityUtils.getLoginUser().getUserid();
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
List<Long> typeIdList = backApplyInfoMapper.selectTypeIdList(userId);
if (CollectionUtils.isEmpty(typeIdList)) {
bean.setUserId(userId == 0 ? null : userId);
}
List<RepairTask> list = repairMapper.getRepairTaskList(bean); List<RepairTask> list = repairMapper.getRepairTaskList(bean);
if (CollectionUtil.isNotEmpty(list)) { if (CollectionUtil.isNotEmpty(list)) {
if (CollectionUtil.isNotEmpty(typeIdList)) {
list = list.stream()
.filter(item -> typeIdList.contains(item.getFirstId()))
.collect(Collectors.toList());
}
String keyWord = bean.getKeyWord(); String keyWord = bean.getKeyWord();
// 如果关键字不为空进行过滤 // 如果关键字不为空进行过滤
if (!StringUtils.isBlank(keyWord)) { if (!StringUtils.isBlank(keyWord)) {
@ -139,8 +150,21 @@ public class RepairServiceImpl implements RepairService {
@Override @Override
public List<RepairDeviceSummaryVo> getRepairDeviceSummary(RepairTaskDetails bean) { public List<RepairDeviceSummaryVo> getRepairDeviceSummary(RepairTaskDetails bean) {
Long userId = SecurityUtils.getLoginUser().getUserid();
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
List<Long> typeIdList = backApplyInfoMapper.selectTypeIdList(userId);
if (CollectionUtils.isEmpty(typeIdList)) {
bean.setUserId(userId == 0 ? null : userId);
}
List<RepairDeviceSummaryVo> repairDeviceSummaryVoList = new ArrayList<>(); List<RepairDeviceSummaryVo> repairDeviceSummaryVoList = new ArrayList<>();
List<RepairDeviceVO> repairDeviceList = repairMapper.getRepairDeviceList(bean); List<RepairDeviceVO> 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<Long, List<RepairDeviceVO>> map = repairDeviceList.stream().collect(Collectors.groupingBy(RepairDeviceVO::getTypeId)); Map<Long, List<RepairDeviceVO>> map = repairDeviceList.stream().collect(Collectors.groupingBy(RepairDeviceVO::getTypeId));
for (Long key : map.keySet()) { for (Long key : map.keySet()) {
List<RepairDeviceVO> tempList = map.get(key); List<RepairDeviceVO> tempList = map.get(key);

View File

@ -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_id) as typeId,
GROUP_CONCAT(DISTINCT mt2.type_name) AS typeName, GROUP_CONCAT(DISTINCT mt2.type_name) AS typeName,
bai.`status` AS status, bai.`status` AS status,
bai.print_status as printStatus bai.print_status as printStatus,
mt4.type_id as firstId
FROM FROM
back_apply_info bai back_apply_info bai
LEFT JOIN back_apply_details bad on bad.parent_id = bai.id 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' 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 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 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'
<if test="userId != null">
JOIN ma_type_repair mtr ON mtr.type_id = bad.type_id AND mtr.user_id = #{userId}
</if>
WHERE WHERE
1=1 1=1
<if test="unitId != null"> <if test="unitId != null">
@ -191,12 +197,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ba.ap_detection AS apDetection, ba.ap_detection AS apDetection,
ba.bad_num AS badNum, ba.bad_num AS badNum,
ba.good_num AS goodNum, ba.good_num AS goodNum,
mt.manage_type AS manageType mt.manage_type AS manageType,
mt3.type_id AS firstId
FROM FROM
back_apply_details ba 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 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 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 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
<if test="userId != null">
JOIN ma_type_repair mtr ON mtr.type_id = bad.type_id AND mtr.user_id = #{userId}
</if>
WHERE ba.parent_id = #{id} WHERE ba.parent_id = #{id}
<if test="keyWord != null and keyWord != ''"> <if test="keyWord != null and keyWord != ''">
and ( and (
@ -1003,4 +1014,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE WHERE
bai.task_id = #{taskId} bai.task_id = #{taskId}
</select> </select>
<select id="selectTypeIdList" resultType="java.lang.Long">
select
type_id
from
ma_type_manage
where
user_id = #{userId}
</select>
</mapper> </mapper>

View File

@ -798,7 +798,8 @@
IFNULL(sum(lad.al_num),0) as alNum, IFNULL(sum(lad.al_num),0) as alNum,
GROUP_CONCAT(DISTINCT mt1.type_name) AS maTypeNames, GROUP_CONCAT(DISTINCT mt1.type_name) AS maTypeNames,
bp.contract_part as contractPart, bp.contract_part as contractPart,
sd.dept_name as impUnitName sd.dept_name as impUnitName,
mt3.type_id as firstId
from from
lease_apply_info lai lease_apply_info lai
left join tm_task tt on lai.task_id = tt.task_id left join tm_task tt on lai.task_id = tt.task_id
@ -811,6 +812,8 @@
and sda.dict_type = 'lease_task_status' 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 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 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'
<if test="userId != null"> <if test="userId != null">
JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId} JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId}
</if> </if>

View File

@ -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.* ,mt.type_name as specification_type, mt1.type_name as machine_type_name, mma.ma_code as maCode,
rad.ma_id as maId rad.ma_id as maId
,mt.manage_type as manageType, ,mt.manage_type as manageType,
su.nick_name as auditName su.nick_name as auditName,
mt4.type_id as firstId
from from
repair_audit_details rad repair_audit_details rad
left join ma_type mt on rad.type_id = mt.type_id 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_type mt1 on mt.parent_id = mt1.type_id
left join ma_machine mma on rad.ma_id= mma.ma_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 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'
<if test="userId != null">
JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id AND mtr.user_id = #{userId}
</if>
where where
rad.task_id = #{taskId} rad.task_id = #{taskId}
<if test="keyword != null and keyword != ''"> <if test="keyword != null and keyword != ''">
@ -320,7 +326,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
su.nick_name createBy, su.nick_name createBy,
tk.create_time createTime, tk.create_time createTime,
tk.remark, tk.remark,
tk.CODE repairNum tk.CODE repairNum,
mt4.type_id as firstId
FROM FROM
tm_task tk tm_task tk
LEFT JOIN tm_task tt ON tk.pre_task_id = tt.task_id 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 mt ON rad.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.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 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'
<if test="userId != null">
JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id AND mtr.user_id = #{userId}
</if>
WHERE WHERE
tk.task_type = #{taskType} tk.task_type = #{taskType}
<if test="backUnit != null and backUnit != ''"> <if test="backUnit != null and backUnit != ''">

View File

@ -45,7 +45,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
su.nick_name AS createBy, su.nick_name AS createBy,
tt.CODE AS inputCode, tt.CODE AS inputCode,
GROUP_CONCAT(DISTINCT mt2.type_name) AS materialType, GROUP_CONCAT(DISTINCT mt2.type_name) AS materialType,
tta.agreement_id as agreementId tta.agreement_id as agreementId,
mt4.type_id as firstId
FROM FROM
repair_input_details rd repair_input_details rd
LEFT JOIN ma_type mt on rd.type_id = mt.type_id 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_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 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 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'
<if test="userId != null">
JOIN ma_type_repair mtr ON mtr.type_id = rd.type_id AND mtr.user_id = #{userId}
</if>
<where> <where>
<if test="inputCode != null and inputCode != ''"> <if test="inputCode != null and inputCode != ''">
AND tt.CODE = #{inputCode} AND tt.CODE = #{inputCode}
@ -100,13 +106,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.unit_value AS unitValue, mt.unit_value AS unitValue,
mt.manage_type AS manageType, mt.manage_type AS manageType,
tta.agreement_id as agreementId, 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 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 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 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 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 su on rid.create_by = su.user_id
LEFT JOIN sys_user su1 on rid.audit_by = su1.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'
<if test="userId != null">
JOIN ma_type_repair mtr ON mtr.type_id = rid.type_id AND mtr.user_id = #{userId}
</if>
where rid.task_id = #{taskId} where rid.task_id = #{taskId}
<if test="keyWord != null and keyWord != ''"> <if test="keyWord != null and keyWord != ''">
AND ( AND (

View File

@ -264,7 +264,8 @@
bpi.pro_name AS backPro, bpi.pro_name AS backPro,
bai.CODE AS backCode, bai.CODE AS backCode,
GROUP_CONCAT(DISTINCT mt2.type_name) as type, GROUP_CONCAT(DISTINCT mt2.type_name) as type,
rd.level as level rd.level as level,
mt4.type_id as typeId
FROM FROM
repair_apply_details rd repair_apply_details rd
LEFT JOIN ma_type mt on rd.type_id = mt.type_id 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 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 su on rd.create_by = su.user_id
left join sys_user su2 on su2.user_id = rd.repairer 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'
<if test="userId != null">
JOIN ma_type_repair mtr ON mtr.type_id = rd.type_id AND mtr.user_id = #{userId}
</if>
<where> <where>
<if test="backUnit != null and backUnit != ''"> <if test="backUnit != null and backUnit != ''">
AND bui.unit_id = #{backUnit} AND bui.unit_id = #{backUnit}
@ -397,6 +403,7 @@
rad.parent_id as parentId, rad.parent_id as parentId,
rad.create_time, rad.create_time,
bai.CODE AS backCode, bai.CODE AS backCode,
mt4.type_id AS firstId,
( SELECT COUNT(*) FROM repair_cost rc WHERE rc.repair_id = rad.id ) AS totalCostRecords, ( 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 ( SELECT COALESCE(SUM(rc.costs), 0) FROM repair_cost rc WHERE rc.repair_id = rad.id ) AS totalCost
from from
@ -406,6 +413,11 @@
left join sys_user su on rad.repairer = su.user_id 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 ma_type mt2 on mt.parent_id = mt2.type_id
LEFT JOIN back_apply_info bai ON rad.back_id = bai.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'
<if test="userId != null">
JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id AND mtr.user_id = #{userId}
</if>
where where
rad.task_id = #{taskId} rad.task_id = #{taskId}
and is_ds=0 and is_ds=0