2023-12-16 21:50:54 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
<!DOCTYPE mapper
|
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.bonus.sgzb.material.mapper.RepairAuditDetailsMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.bonus.sgzb.material.domain.RepairAuditDetails" id="RepairAuditDetailsResult">
|
|
|
|
|
<result property="id" column="id" />
|
|
|
|
|
<result property="taskId" column="task_id" />
|
|
|
|
|
<result property="repairId" column="repair_id" />
|
|
|
|
|
<result property="maId" column="ma_id" />
|
|
|
|
|
<result property="typeId" column="type_id" />
|
|
|
|
|
<result property="repairNum" column="repair_num" />
|
|
|
|
|
<result property="repairedNum" column="repaired_num" />
|
|
|
|
|
<result property="scrapNum" column="scrap_num" />
|
|
|
|
|
<result property="auditBy" column="audit_by" />
|
|
|
|
|
<result property="auditTime" column="audit_time" />
|
|
|
|
|
<result property="auditRemark" column="audit_remark" />
|
|
|
|
|
<result property="status" column="status" />
|
|
|
|
|
<result property="createBy" column="create_by" />
|
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
|
<result property="remark" column="remark" />
|
|
|
|
|
<result property="companyId" column="company_id" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectRepairAuditDetailsVo">
|
|
|
|
|
select id, task_id, repair_id, ma_id, type_id, repair_num, repaired_num, scrap_num, audit_by, audit_time, audit_remark, status, create_by, create_time, update_by, update_time, remark, company_id from repair_audit_details
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectRepairAuditDetailsList" parameterType="com.bonus.sgzb.material.domain.RepairAuditDetails" resultMap="RepairAuditDetailsResult">
|
2023-12-19 09:01:17 +08:00
|
|
|
select rad.* ,mt.type_name specificationType, mt1.type_name machineTypeName, mma.ma_code maCode
|
2023-12-16 21:50:54 +08:00
|
|
|
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
|
|
|
|
|
where rad.task_id = #{taskId}
|
2024-01-15 16:42:18 +08:00
|
|
|
<if test="keyword != null and keyword != ''">
|
|
|
|
|
AND (locate(#{keyword}, mma.ma_code) > 0
|
|
|
|
|
or locate(#{keyword}, mt.type_name) > 0
|
|
|
|
|
or locate(#{keyword}, mt1.type_name) > 0)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="type != null and type != ''">
|
|
|
|
|
AND mt.type_id = #{type}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="typeName != null and typeName != ''">
|
|
|
|
|
AND mt1.type_id = #{typeName}
|
|
|
|
|
</if>
|
2023-12-24 17:45:49 +08:00
|
|
|
order by rad.create_time desc
|
2023-12-16 21:50:54 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectRepairAuditDetailsById" parameterType="Long" resultMap="RepairAuditDetailsResult">
|
|
|
|
|
<include refid="selectRepairAuditDetailsVo"/>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertRepairAuditDetails" parameterType="com.bonus.sgzb.material.domain.RepairAuditDetails">
|
|
|
|
|
insert into repair_audit_details
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="id != null">id,</if>
|
|
|
|
|
<if test="taskId != null">task_id,</if>
|
|
|
|
|
<if test="repairId != null">repair_id,</if>
|
|
|
|
|
<if test="maId != null">ma_id,</if>
|
|
|
|
|
<if test="typeId != null">type_id,</if>
|
|
|
|
|
<if test="repairNum != null">repair_num,</if>
|
|
|
|
|
<if test="repairedNum != null">repaired_num,</if>
|
|
|
|
|
<if test="scrapNum != null">scrap_num,</if>
|
|
|
|
|
<if test="auditBy != null">audit_by,</if>
|
|
|
|
|
<if test="auditTime != null">audit_time,</if>
|
|
|
|
|
<if test="auditRemark != null">audit_remark,</if>
|
|
|
|
|
<if test="status != null">status,</if>
|
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
<if test="remark != null">remark,</if>
|
|
|
|
|
<if test="companyId != null">company_id,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="id != null">#{id},</if>
|
|
|
|
|
<if test="taskId != null">#{taskId},</if>
|
|
|
|
|
<if test="repairId != null">#{repairId},</if>
|
|
|
|
|
<if test="maId != null">#{maId},</if>
|
|
|
|
|
<if test="typeId != null">#{typeId},</if>
|
|
|
|
|
<if test="repairNum != null">#{repairNum},</if>
|
|
|
|
|
<if test="repairedNum != null">#{repairedNum},</if>
|
|
|
|
|
<if test="scrapNum != null">#{scrapNum},</if>
|
|
|
|
|
<if test="auditBy != null">#{auditBy},</if>
|
|
|
|
|
<if test="auditTime != null">#{auditTime},</if>
|
|
|
|
|
<if test="auditRemark != null">#{auditRemark},</if>
|
|
|
|
|
<if test="status != null">#{status},</if>
|
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
<if test="remark != null">#{remark},</if>
|
|
|
|
|
<if test="companyId != null">#{companyId},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateRepairAuditDetails" parameterType="com.bonus.sgzb.material.domain.RepairAuditDetails">
|
|
|
|
|
update repair_audit_details
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="taskId != null">task_id = #{taskId},</if>
|
|
|
|
|
<if test="repairId != null">repair_id = #{repairId},</if>
|
|
|
|
|
<if test="maId != null">ma_id = #{maId},</if>
|
|
|
|
|
<if test="typeId != null">type_id = #{typeId},</if>
|
|
|
|
|
<if test="repairNum != null">repair_num = #{repairNum},</if>
|
|
|
|
|
<if test="repairedNum != null">repaired_num = #{repairedNum},</if>
|
|
|
|
|
<if test="scrapNum != null">scrap_num = #{scrapNum},</if>
|
|
|
|
|
<if test="auditBy != null">audit_by = #{auditBy},</if>
|
|
|
|
|
<if test="auditTime != null">audit_time = #{auditTime},</if>
|
|
|
|
|
<if test="auditRemark != null">audit_remark = #{auditRemark},</if>
|
|
|
|
|
<if test="status != null">status = #{status},</if>
|
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
|
|
|
<if test="companyId != null">company_id = #{companyId},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteRepairAuditDetailsById" parameterType="Long">
|
|
|
|
|
delete from repair_audit_details where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteRepairAuditDetailsByIds" parameterType="String">
|
|
|
|
|
delete from repair_audit_details where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<select id="selectRepairQuestList" resultType="com.bonus.sgzb.material.vo.ScrapApplyDetailsVO">
|
2024-01-15 16:42:18 +08:00
|
|
|
SELECT DISTINCT
|
|
|
|
|
tk.task_id taskId,
|
|
|
|
|
tk.CODE scrapNum,
|
|
|
|
|
tk.task_status taskStatus,
|
|
|
|
|
dic.NAME taskStatusName,
|
|
|
|
|
bui.unit_name unitName,
|
|
|
|
|
bpl.lot_name projectName,
|
|
|
|
|
su.user_name createBy,
|
|
|
|
|
tk.create_time createTime,
|
|
|
|
|
tk.remark,
|
|
|
|
|
tk.CODE repairNum
|
|
|
|
|
FROM
|
|
|
|
|
tm_task tk
|
|
|
|
|
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_lot bpl ON bai.project_id = bpl.lot_id
|
|
|
|
|
LEFT JOIN bm_unit_info bui ON bai.unit_id = bui.unit_id
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
SELECT
|
|
|
|
|
id,
|
|
|
|
|
p_id,
|
|
|
|
|
NAME
|
|
|
|
|
FROM
|
|
|
|
|
sys_dic
|
|
|
|
|
WHERE
|
|
|
|
|
p_id IN ( SELECT id FROM sys_dic WHERE VALUE = 'ws_shenhe' )) dic ON tk.task_status = dic.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
|
|
|
|
|
WHERE
|
|
|
|
|
tk.task_type = 45
|
|
|
|
|
<if test="keyword != null and keyword != ''">
|
|
|
|
|
AND (locate(#{keyword}, su.user_name) > 0
|
|
|
|
|
or locate(#{keyword}, tk.CODE) > 0
|
|
|
|
|
or locate(#{keyword}, bui.unit_name) > 0
|
|
|
|
|
or locate(#{keyword}, bpl.lot_name) > 0)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="backUnit != null and backUnit != ''">
|
2023-12-19 09:01:17 +08:00
|
|
|
and bui.unit_id = #{backUnit}
|
|
|
|
|
</if>
|
2024-01-15 16:42:18 +08:00
|
|
|
<if test="taskStatus != null and taskStatus != ''">
|
2023-12-21 18:09:56 +08:00
|
|
|
and tk.task_status = #{taskStatus}
|
|
|
|
|
</if>
|
2024-01-15 16:42:18 +08:00
|
|
|
<if test="backPro != null and backPro != ''">
|
2023-12-19 09:01:17 +08:00
|
|
|
and bpl.lot_id = #{backPro}
|
|
|
|
|
</if>
|
2024-01-15 16:42:18 +08:00
|
|
|
<if test="type != null and type != ''">
|
2023-12-19 09:01:17 +08:00
|
|
|
and mt1.type_id = #{type}
|
|
|
|
|
</if>
|
2024-01-15 16:42:18 +08:00
|
|
|
<if test="backCode != null and backCode != ''">
|
|
|
|
|
and locate(#{backCode}, tk.code) > 0
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''">
|
|
|
|
|
and tk.create_time between #{params.beginTime} and #{params.endTime}
|
2023-12-19 09:01:17 +08:00
|
|
|
</if>
|
2023-12-24 15:11:02 +08:00
|
|
|
order by tk.create_time desc
|
2023-12-16 21:50:54 +08:00
|
|
|
</select>
|
|
|
|
|
|
2024-01-08 16:32:49 +08:00
|
|
|
<select id="exportRepairQuestList" resultType="com.bonus.sgzb.material.vo.RepairAuditDetailsVO">
|
|
|
|
|
SELECT DISTINCT
|
|
|
|
|
tk.task_id taskId,
|
|
|
|
|
tk.CODE scrapNum,
|
|
|
|
|
tk.task_status taskStatus,
|
|
|
|
|
dic.NAME taskStatusName,
|
|
|
|
|
bui.unit_name unitName,
|
|
|
|
|
bpl.lot_name projectName,
|
|
|
|
|
tk.create_by createBy,
|
|
|
|
|
tk.create_time createTime,
|
|
|
|
|
tk.remark,
|
|
|
|
|
tk.CODE repairNum,
|
|
|
|
|
mt1.type_name as type,
|
|
|
|
|
mt.type_name as typeName,
|
|
|
|
|
mma.ma_code as maCode,
|
|
|
|
|
rad.repair_num as repairNum2,
|
|
|
|
|
rad.repaired_num as repairedNum2,
|
|
|
|
|
rad.scrap_num as scrapNum2
|
|
|
|
|
FROM
|
|
|
|
|
tm_task tk
|
|
|
|
|
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_lot bpl ON bai.project_id = bpl.lot_id
|
|
|
|
|
LEFT JOIN bm_unit_info bui ON bai.unit_id = bui.unit_id
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
SELECT
|
|
|
|
|
id,
|
|
|
|
|
p_id,
|
|
|
|
|
NAME
|
|
|
|
|
FROM
|
|
|
|
|
sys_dic
|
|
|
|
|
WHERE
|
|
|
|
|
p_id IN ( SELECT id FROM sys_dic WHERE VALUE = 'ws_shenhe' )) dic ON tk.task_status = dic.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 ma_machine mma on rad.ma_id= mma.ma_id
|
|
|
|
|
WHERE
|
|
|
|
|
tk.task_type = 45
|
2024-01-15 16:42:18 +08:00
|
|
|
<if test="keyword != null and keyword != ''">
|
|
|
|
|
AND (locate(#{keyword}, su.user_name) > 0
|
|
|
|
|
or locate(#{keyword}, tk.CODE) > 0
|
|
|
|
|
or locate(#{keyword}, bui.unit_name) > 0
|
|
|
|
|
or locate(#{keyword}, bpl.lot_name) > 0)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="backUnit != null and backUnit != ''">
|
2024-01-08 16:32:49 +08:00
|
|
|
and bui.unit_id = #{backUnit}
|
|
|
|
|
</if>
|
2024-01-15 16:42:18 +08:00
|
|
|
<if test="taskStatus != null and taskStatus != ''">
|
2024-01-08 16:32:49 +08:00
|
|
|
and tk.task_status = #{taskStatus}
|
|
|
|
|
</if>
|
2024-01-15 16:42:18 +08:00
|
|
|
<if test="backPro != null and backPro != ''">
|
2024-01-08 16:32:49 +08:00
|
|
|
and bpl.lot_id = #{backPro}
|
|
|
|
|
</if>
|
2024-01-15 16:42:18 +08:00
|
|
|
<if test="type != null and type != ''">
|
2024-01-08 16:32:49 +08:00
|
|
|
and mt1.type_id = #{type}
|
|
|
|
|
</if>
|
2024-01-15 16:42:18 +08:00
|
|
|
<if test="backCode != null and backCode != ''">
|
|
|
|
|
and locate(#{backCode}, tk.code) > 0
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''">
|
|
|
|
|
and tk.create_time between #{params.beginTime} and #{params.endTime}
|
2024-01-08 16:32:49 +08:00
|
|
|
</if>
|
|
|
|
|
ORDER BY
|
|
|
|
|
tk.create_time DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
2023-12-16 21:50:54 +08:00
|
|
|
<select id="selectRepairAuditDetailsByTaskId" resultMap="RepairAuditDetailsResult">
|
|
|
|
|
<include refid="selectRepairAuditDetailsVo"/>
|
|
|
|
|
where task_id = #{taskId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectTypeNameByTaskId" resultType="java.lang.String">
|
|
|
|
|
select GROUP_CONCAT(type_name) typeName from
|
|
|
|
|
(select distinct rad.task_id, mt1.type_name
|
|
|
|
|
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
|
|
|
|
|
where rad.task_id = #{taskId}
|
|
|
|
|
) t
|
|
|
|
|
GROUP BY task_id
|
|
|
|
|
</select>
|
2024-01-08 16:32:49 +08:00
|
|
|
|
2023-12-16 21:50:54 +08:00
|
|
|
</mapper>
|