修饰审核--导出SQL优化

This commit is contained in:
syruan 2024-11-14 15:09:28 +08:00
parent fa5bd277be
commit 36c42ccd8c
2 changed files with 43 additions and 43 deletions

View File

@ -81,7 +81,7 @@ public class RepairAuditDetailsController extends BaseController {
bean.setParams(params);
}
List<RepairAuditDetailsVO> list = repairAuditDetailsService.exportRepairQuestList(bean);
ExcelUtil<RepairAuditDetailsVO> util = new ExcelUtil<RepairAuditDetailsVO>(RepairAuditDetailsVO.class);
ExcelUtil<RepairAuditDetailsVO> util = new ExcelUtil<>(RepairAuditDetailsVO.class);
util.exportExcel(response, list, "修试审核任务列表");
}

View File

@ -84,23 +84,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="exportRepairQuestList" resultType="com.bonus.material.repair.domain.vo.RepairAuditDetailsVO">
SELECT DISTINCT
tk.task_id taskId,
tk.CODE scrapNum,
tk.task_status taskStatus,
bui.unit_name unitName,
bpl.pro_name projectName,
su.nick_name 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
tk.task_id taskId,
tk.CODE scrapNum,
tk.task_status taskStatus,
bui.unit_name unitName,
bpl.pro_name projectName,
su.nick_name 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
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 bpl ON bai.project_id = bpl.pro_id
@ -111,33 +111,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join ma_machine mma on rad.ma_id= mma.ma_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.nick_name) > 0
or locate(#{keyword}, tk.CODE) > 0
or locate(#{keyword}, bui.unit_name) > 0
or locate(#{keyword}, bpl.pro_name) > 0)
</if>
<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="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''">
and tk.create_time between #{params.beginTime} and #{params.endTime}
</if>
tk.task_type = 45
<if test="keyword != null and keyword != ''">
AND (locate(#{keyword}, su.nick_name) > 0
or locate(#{keyword}, tk.CODE) > 0
or locate(#{keyword}, bui.unit_name) > 0
or locate(#{keyword}, bpl.pro_name) > 0)
</if>
<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="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''">
and tk.create_time between #{params.beginTime} and #{params.endTime}
</if>
ORDER BY
tk.create_time DESC
tk.create_time DESC
</select>
<select id="getRepairRecord" resultType="com.bonus.material.repair.domain.RepairRecord">