This commit is contained in:
parent
953c7dcd8f
commit
44ad0681c3
|
|
@ -133,7 +133,7 @@ public class RepairInputDetailsController extends BaseController {
|
|||
@ApiOperation(value = "入库或批量入库操作")
|
||||
@PreventRepeatSubmit
|
||||
// @RequiresPermissions("purchase:storage:add")
|
||||
// @StoreLog(title = "修试后入库", module = "修试入库->修试后入库")
|
||||
@StoreLog(title = "修试后入库", module = "修试入库->修试后入库")
|
||||
@PostMapping("/warehouse")
|
||||
public AjaxResult warehouse(@RequestBody RepairInputDetails repairInputDetails) {
|
||||
return repairInputDetailsService.warehouse(repairInputDetails);
|
||||
|
|
|
|||
|
|
@ -146,4 +146,7 @@ public class RepairAuditDetails extends BaseEntity {
|
|||
|
||||
@ApiModelProperty(value = "一级类型id")
|
||||
private Long firstId;
|
||||
|
||||
@ApiModelProperty(value = "单位")
|
||||
private String unitName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
}
|
||||
// 获取所有需要查询的 taskId、过滤空的
|
||||
List<ScrapApplyDetailsVO> repairQuestList = repairAuditDetailsMapper.selectRepairQuestList(repairAuditDetails);
|
||||
if (!CollectionUtil.isNotEmpty(repairQuestList)) {
|
||||
if (CollectionUtil.isNotEmpty(repairQuestList)) {
|
||||
if (CollectionUtil.isNotEmpty(typeIdList)) {
|
||||
// 使用流过滤符合条件的元素
|
||||
repairQuestList = repairQuestList.stream()
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
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}
|
||||
JOIN ma_type_repair mtr ON mtr.type_id = ba.type_id AND mtr.user_id = #{userId}
|
||||
</if>
|
||||
WHERE ba.parent_id = #{id}
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
rad.ma_id as maId
|
||||
,mt.manage_type as manageType,
|
||||
su.nick_name as auditName,
|
||||
mt4.type_id as firstId
|
||||
mt4.type_id as firstId,
|
||||
mt.unit_name as unitName
|
||||
from
|
||||
repair_audit_details rad
|
||||
left join ma_type mt on rad.type_id = mt.type_id
|
||||
|
|
@ -316,23 +317,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</delete>
|
||||
|
||||
<select id="selectRepairQuestList" resultType="com.bonus.material.repair.domain.vo.ScrapApplyDetailsVO">
|
||||
SELECT * FROM (
|
||||
-- 第一个查询(时间条件:小于 2025-07-19)
|
||||
SELECT DISTINCT
|
||||
tk.task_id taskId,
|
||||
tk.CODE scrapNum,
|
||||
tk.task_id AS taskId,
|
||||
tk.CODE AS scrapNum,
|
||||
tt2.CODE AS repairTaskCode,
|
||||
tk.task_status taskStatus,
|
||||
bui.unit_name unitName,
|
||||
bpl.pro_name projectName,
|
||||
su.nick_name createBy,
|
||||
tk.create_time createTime,
|
||||
tk.task_status AS taskStatus,
|
||||
bui.unit_name AS unitName,
|
||||
bpl.pro_name AS projectName,
|
||||
su.nick_name AS createBy,
|
||||
tk.create_time AS createTime,
|
||||
tk.remark,
|
||||
tk.CODE repairNum,
|
||||
GROUP_CONCAT( DISTINCT mt4.type_id) as firstId
|
||||
tk.CODE AS repairNum,
|
||||
GROUP_CONCAT(DISTINCT mt4.type_id) AS firstId
|
||||
FROM
|
||||
tm_task tk
|
||||
LEFT JOIN tm_task tt ON tk.pre_task_id = tt.task_id
|
||||
LEFT JOIN repair_audit_details rad ON tk.task_id = rad.task_id
|
||||
LEFT JOIN tm_task tt2 on tt2.task_id = rad.repair_id
|
||||
LEFT JOIN tm_task tt2 ON tt2.task_id = rad.repair_id
|
||||
LEFT JOIN tm_task_agreement tta ON rad.repair_id = tta.task_id
|
||||
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project bpl ON bai.project_id = bpl.pro_id
|
||||
|
|
@ -340,39 +343,105 @@ 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 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'
|
||||
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
|
||||
tk.task_type = #{taskType}
|
||||
<if test="backUnit != null and backUnit != ''">
|
||||
and bui.unit_id = #{backUnit}
|
||||
</if>
|
||||
<if test="taskStatus != null and taskStatus != ''">
|
||||
and tk.task_status = #{taskStatus}
|
||||
</if>
|
||||
<if test="backPro != null and backPro != ''">
|
||||
and bpl.pro_id = #{backPro}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
and mt1.type_id = #{type}
|
||||
</if>
|
||||
<if test="backCode != null and backCode != ''">
|
||||
and locate(#{backCode}, tk.code) > 0
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
and tk.create_time BETWEEN CONCAT(#{startTime},' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||
</if>
|
||||
<if test="appTaskStatus != null and appTaskStatus == 10">
|
||||
and tk.task_status = #{appTaskStatus}
|
||||
</if>
|
||||
<if test="appTaskStatus != null and appTaskStatus == 11">
|
||||
and (tk.task_status = 11 or tk.task_status = 12)
|
||||
</if>
|
||||
GROUP BY tk.CODE
|
||||
order by tk.create_time desc
|
||||
tk.task_type = #{taskType}
|
||||
AND tk.create_time < '2025-07-19 00:00:00'
|
||||
<if test="backUnit != null and backUnit != ''">
|
||||
AND bui.unit_id = #{backUnit}
|
||||
</if>
|
||||
<if test="taskStatus != null and taskStatus != ''">
|
||||
AND tk.task_status = #{taskStatus}
|
||||
</if>
|
||||
<if test="backPro != null and backPro != ''">
|
||||
AND bpl.pro_id = #{backPro}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
AND mt1.type_id = #{type}
|
||||
</if>
|
||||
<if test="backCode != null and backCode != ''">
|
||||
AND LOCATE(#{backCode}, tk.code) > 0
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
AND tk.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||
</if>
|
||||
<if test="appTaskStatus != null and appTaskStatus == 10">
|
||||
AND tk.task_status = #{appTaskStatus}
|
||||
</if>
|
||||
<if test="appTaskStatus != null and appTaskStatus == 11">
|
||||
AND (tk.task_status = 11 OR tk.task_status = 12)
|
||||
</if>
|
||||
GROUP BY
|
||||
tk.CODE
|
||||
|
||||
UNION
|
||||
|
||||
-- 第二个查询(时间条件:>= 2025-07-19)
|
||||
SELECT DISTINCT
|
||||
tk.task_id AS taskId,
|
||||
tk.CODE AS scrapNum,
|
||||
tt.CODE AS repairTaskCode,
|
||||
tk.task_status AS taskStatus,
|
||||
bui.unit_name AS unitName,
|
||||
bpl.pro_name AS projectName,
|
||||
su.nick_name AS createBy,
|
||||
tk.create_time AS createTime,
|
||||
tk.remark,
|
||||
tk.CODE AS repairNum,
|
||||
GROUP_CONCAT(DISTINCT mt4.type_id) AS firstId
|
||||
FROM
|
||||
tm_task tk
|
||||
LEFT JOIN tm_task tt ON tk.pre_task_id = tt.task_id
|
||||
LEFT JOIN tm_task_agreement tta ON tk.task_id = tta.task_id
|
||||
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project bpl ON bai.project_id = bpl.pro_id
|
||||
LEFT JOIN bm_unit bui ON bai.unit_id = bui.unit_id
|
||||
LEFT JOIN repair_audit_details rad ON tk.task_id = rad.task_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 sys_user su ON su.user_id = tk.create_by
|
||||
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
|
||||
tk.task_type = #{taskType}
|
||||
AND tk.create_time >= '2025-07-19 00:00:00'
|
||||
<if test="backUnit != null and backUnit != ''">
|
||||
AND bui.unit_id = #{backUnit}
|
||||
</if>
|
||||
<if test="taskStatus != null and taskStatus != ''">
|
||||
AND tk.task_status = #{taskStatus}
|
||||
</if>
|
||||
<if test="backPro != null and backPro != ''">
|
||||
AND bpl.pro_id = #{backPro}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
AND mt1.type_id = #{type}
|
||||
</if>
|
||||
<if test="backCode != null and backCode != ''">
|
||||
AND LOCATE(#{backCode}, tk.code) > 0
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
AND tk.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||
</if>
|
||||
<if test="appTaskStatus != null and appTaskStatus == 10">
|
||||
AND tk.task_status = #{appTaskStatus}
|
||||
</if>
|
||||
<if test="appTaskStatus != null and appTaskStatus == 11">
|
||||
AND (tk.task_status = 11 OR tk.task_status = 12)
|
||||
</if>
|
||||
GROUP BY
|
||||
tk.CODE
|
||||
) AS combined_results
|
||||
ORDER BY
|
||||
taskStatus,
|
||||
createTime DESC; -- 统一在外部排序
|
||||
</select>
|
||||
|
||||
<select id="selectTypeNameByTaskId" resultType="java.lang.String">
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
|
||||
<select id="selectRepairInputDetailsList" resultType="com.bonus.common.biz.domain.repair.RepairInputDetails">
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
rd.task_id AS taskId,
|
||||
tt1.CODE AS repairCode,
|
||||
|
|
@ -64,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
JOIN ma_type_repair mtr ON mtr.type_id = rd.type_id AND mtr.user_id = #{userId}
|
||||
</if>
|
||||
<where>
|
||||
rd.create_time < '2025-07-19 00:00:00'
|
||||
<if test="inputCode != null and inputCode != ''">
|
||||
AND tt.CODE = #{inputCode}
|
||||
</if>
|
||||
|
|
@ -81,7 +83,68 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
</where>
|
||||
GROUP BY rd.task_id
|
||||
order by rd.create_time desc
|
||||
|
||||
UNION
|
||||
|
||||
SELECT
|
||||
rd.task_id AS taskId,
|
||||
tt1.CODE AS repairCode,
|
||||
rd.create_time AS createTime,
|
||||
tt.task_status AS taskStatus,
|
||||
CASE tt.task_status
|
||||
WHEN '0' THEN '入库进行中'
|
||||
WHEN '1' THEN '入库完成'
|
||||
WHEN '2' THEN '入库驳回'
|
||||
ELSE '未知状态'
|
||||
END AS statusName,
|
||||
rd.remark AS remark,
|
||||
bui.unit_name AS backUnit,
|
||||
bpi.pro_name AS backPro,
|
||||
su.nick_name AS createBy,
|
||||
tt.CODE AS inputCode,
|
||||
GROUP_CONCAT(DISTINCT mt2.type_name) AS materialType,
|
||||
tta.agreement_id as agreementId,
|
||||
GROUP_CONCAT( DISTINCT mt4.type_id) as firstId
|
||||
FROM
|
||||
repair_input_details rd
|
||||
LEFT JOIN ma_type mt on rd.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
|
||||
LEFT JOIN tm_task tt on rd.task_id = tt.task_id
|
||||
LEFT JOIN repair_apply_details rad ON rad.id = rd.repair_id
|
||||
LEFT JOIN tm_task tt1 on rad.task_id = tt1.task_id
|
||||
LEFT JOIN tm_task_agreement tta ON rd.task_id = tta.task_id
|
||||
LEFT JOIN bm_agreement_info bai2 ON tta.agreement_id = bai2.agreement_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 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>
|
||||
rd.create_time >= '2025-07-19 00:00:00'
|
||||
<if test="inputCode != null and inputCode != ''">
|
||||
AND tt.CODE = #{inputCode}
|
||||
</if>
|
||||
<if test="taskStatus != null ">
|
||||
AND tt.task_status = #{taskStatus}
|
||||
</if>
|
||||
<if test="appTaskStatus != null and appTaskStatus == 0">
|
||||
and tt.task_status = #{appTaskStatus}
|
||||
</if>
|
||||
<if test="appTaskStatus != null and appTaskStatus == 1">
|
||||
and (tt.task_status = 1 or tt.task_status = 2)
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[and DATE_FORMAT( rd.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY rd.task_id
|
||||
) AS combined_results
|
||||
ORDER BY
|
||||
taskStatus,
|
||||
createTime DESC;
|
||||
</select>
|
||||
|
||||
<select id="selectRepairInputDetailsById" resultType="com.bonus.material.repair.domain.RepairInputInfo">
|
||||
|
|
|
|||
Loading…
Reference in New Issue