From ed48aa9f30a87c528f071d06bf6b59d7d15428e9 Mon Sep 17 00:00:00 2001 From: qushaowei <qushaowei@163.com> Date: 星期一, 26 五月 2025 16:12:55 +0800 Subject: [PATCH] 点检报表后端 --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/InspectionOrderMapper.xml | 202 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 195 insertions(+), 7 deletions(-) diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/InspectionOrderMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/InspectionOrderMapper.xml index aade9a6..3bd99b9 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/InspectionOrderMapper.xml +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/InspectionOrderMapper.xml @@ -8,6 +8,8 @@ t1.num, t1.inspection_time as inspectionDate, t1.inspection_time as inspectionTime, + DATEADD(DAY,+7,t1.inspection_time) as redWarningTime, + CONVERT(varchar(100), GETDATE(), 20) AS currentDateTime, t1.inspection_deadline as inspectionDeadline, t1.start_work_condition as startWorkCondition, t1.status, @@ -20,7 +22,7 @@ t2.team_id as teamId, t2.use_id as useId, t3.id as inspectionCycleId, - concat(t3.code, '/', t3.name) as inspectionCycleName, + t3.name as inspectionCycleName, t3.effective_time as effectiveTime, t3.unit as unit, t4.id as inspectionStandardId, @@ -31,10 +33,11 @@ t7.name as teamName, t4.assign_mode as assignMode, t8.item_text as assignModeName, - t1.inspection_user_id as inspectionUserId, - t9.realname as inspectionUserName, + t1.inspection_order_uda2 as inspectionUserName, t1.actual_end_time as actualEndTime, - t1.actual_start_time as actualStartTime + t1.actual_start_time as actualStartTime, + t1.inspection_order_uda1 AS repairConfirmPerson, + t1.repair_confirm_date as repairConfirmDate FROM mom_eam_inspection_order t1 LEFT JOIN mom_eam_equipment t2 ON t1.equipment_id = t2.id @@ -44,7 +47,6 @@ left join sys_depart t6 on t2.use_id = t6.id left join mom_base_team t7 on t2.team_id = t7.id left join ( SELECT * FROM v_sys_dict WHERE dict_code = 'assign_mode' ) t8 on t8.item_value = t4.assign_mode - left join sys_user t9 on t1.inspection_user_id = t9.id WHERE t1.del_flag = 0 and t2.del_flag = 0 and t3.del_flag = 0 and t4.del_flag = 0 <!-- <if test="params.dailyInspectionStandardId != null and params.dailyInspectionStandardId != ''">--> <!-- and t1.daily_inspection_standard_id = #{params.dailyInspectionStandardId}--> @@ -52,14 +54,47 @@ <if test="params.num != null and params.num != ''"> and t1.num like concat('%',#{params.num},'%') </if> + <if test="params.equipmentNum != null and params.equipmentNum != ''"> + and t2.num like concat('%',#{params.equipmentNum},'%') + </if> + <if test="params.useDepartId != null and params.useDepartId != ''"> + and t2.use_id = #{params.useDepartId} + </if> + <if test="params.status != null and params.status != ''"> + and t1.status = #{params.status} + </if> + <if test="params.teamId != null and params.teamId != ''"> + and t2.team_id = #{params.teamId} + </if> + <if test="params.inspectionStartTime != null"> + and t1.actual_end_time >= #{params.inspectionStartTime} + </if> + <if test="params.inspectionEndTime != null"> + and t1.actual_end_time <= #{params.inspectionEndTime} + </if> + <if test="params.workCenterIds != null"> + and t2.work_center_id in + <foreach collection="params.workCenterIds" open="(" separator="," close=")" item="workCenterId"> + #{workCenterId} + </foreach> + </if> + <if test="params.equipmentId != null"> + and t1.equipment_id = #{params.equipmentId} + </if> + <if test="params.statusEnums != null"> + and t1.status not in + <foreach collection="params.statusEnums" open="(" separator="," close=")" item="statusEnum"> + #{statusEnum} + </foreach> + </if> ORDER BY t1.create_time desc </select> <select id="getInspectionCycleByEqId" parameterType="Map" resultType="org.jeecg.modules.eam.model.InspectionCycleVo"> SELECT DISTINCT t1.inspection_cycle_id AS value, - concat(t3.code, '/', t3.name) as text, - concat(t3.code, '/', t3.name) as title + t3.name as text, + t3.name as title FROM mom_eam_daily_inspection_standard_detail t1 LEFT JOIN mom_eam_daily_inspection_standard t2 ON t1.daily_inspection_standard_id = t2.id @@ -170,4 +205,157 @@ </if> ORDER BY t1.create_time desc </select> + + <select id="findDayInspectionProjectList" parameterType="Map" resultType="Map"> + SELECT + t4.num as equipmentNum, + t4.name as equipmentName, + t3.name, + t1.detection_standard as detectionStandard, + case t1.inspection_project_result when '1' then '鈭�' when '2' then 'x' when '3' then '鈻�' when '4' then 'T' else '' end as insResult, + SUBSTRING ( CONVERT ( VARCHAR ( 10 ), t2.create_time, 120 ), 9, 10 ) as createTime + FROM + mom_eam_inspection_order_detail t1 + LEFT JOIN mom_eam_inspection_order t2 ON t1.inspection_order_id = t2.id + LEFT JOIN mom_eam_inspection_project t3 ON t1.inspection_project_id = t3.id + LEFT JOIN mom_eam_equipment t4 ON t2.equipment_id = t4.id + LEFT JOIN mom_eam_inspection_cycle t5 ON t2.inspection_cycle_id = t5.id + left join (SELECT * FROM v_sys_dict WHERE dict_code = 'inspection_project_result') t6 on t1.inspection_project_result = t6.item_value + WHERE + t5.name = '1鏃�' + <if test="params.num != null and params.num != ''"> and t4.num = #{params.num} </if> + <if test="params.num == null "> and t4.num = '-1' </if> + <if test="params.dataTime != null and params.dataTime != ''"> AND SUBSTRING ( CONVERT ( VARCHAR ( 10 ), t2.create_time, 120 ), 1, 7 ) = SUBSTRING ( CONVERT ( VARCHAR ( 10 ), #{params.dataTime}, 120 ), 2, 7 ) </if> + <if test="params.dataTime == null ">AND SUBSTRING ( CONVERT ( VARCHAR ( 10 ), t2.create_time, 120 ), 1, 7 ) = SUBSTRING ( CONVERT ( VARCHAR ( 10 ), GETDATE( ), 120 ), 1, 7 ) </if> + AND t1.inspection_standard_detail_id IN ( + SELECT + tt2.id + FROM + mom_eam_daily_inspection_standard tt1 + LEFT JOIN mom_eam_daily_inspection_standard_detail tt2 ON tt1.id= tt2.daily_inspection_standard_id + LEFT JOIN mom_eam_equipment tt3 ON tt1.equipment_id = tt3.id + LEFT JOIN mom_eam_inspection_cycle tt4 ON tt2.inspection_cycle_id = tt4.id + WHERE + tt4.name = '1鏃�' + <if test="params.num != null and params.num != ''"> and tt3.num = #{params.num} </if> + <if test="params.num == null "> and tt3.num = '-1' </if> + AND tt1.version_status = '2' + AND tt1.del_flag = '0' + ) + </select> + + <select id="findWeekInspectionProjectList" parameterType="Map" resultType="Map"> + SELECT + t4.num as equipmentNum, + t4.name as equipmentName, + t3.name, + t1.detection_standard as detectionStandard, + case t1.inspection_project_result when '1' then '鈭�' when '2' then 'x' when '3' then '鈻�' when '4' then 'T' else '' end as insResult, + SUBSTRING ( CONVERT ( VARCHAR ( 10 ), t2.create_time, 120 ), 9, 10 ) as createTime + FROM + mom_eam_inspection_order_detail t1 + LEFT JOIN mom_eam_inspection_order t2 ON t1.inspection_order_id = t2.id + LEFT JOIN mom_eam_inspection_project t3 ON t1.inspection_project_id = t3.id + LEFT JOIN mom_eam_equipment t4 ON t2.equipment_id = t4.id + LEFT JOIN mom_eam_inspection_cycle t5 ON t2.inspection_cycle_id = t5.id + left join (SELECT * FROM v_sys_dict WHERE dict_code = 'inspection_project_result') t6 on t1.inspection_project_result = t6.item_value + WHERE + t5.name = '1鍛�' + <if test="params.num != null and params.num != ''"> and t4.num = #{params.num} </if> + <if test="params.num == null "> and t4.num = '-1' </if> + <if test="params.dataTime != null and params.dataTime != ''"> AND SUBSTRING ( CONVERT ( VARCHAR ( 10 ), t2.create_time, 120 ), 1, 7 ) = SUBSTRING ( CONVERT ( VARCHAR ( 10 ), #{params.dataTime}, 120 ), 2, 7 ) </if> + <if test="params.dataTime == null ">AND SUBSTRING ( CONVERT ( VARCHAR ( 10 ), t2.create_time, 120 ), 1, 7 ) = SUBSTRING ( CONVERT ( VARCHAR ( 10 ), GETDATE( ), 120 ), 1, 7 ) </if> + AND t1.inspection_standard_detail_id IN ( + SELECT + tt2.id + FROM + mom_eam_daily_inspection_standard tt1 + LEFT JOIN mom_eam_daily_inspection_standard_detail tt2 ON tt1.id= tt2.daily_inspection_standard_id + LEFT JOIN mom_eam_equipment tt3 ON tt1.equipment_id = tt3.id + LEFT JOIN mom_eam_inspection_cycle tt4 ON tt2.inspection_cycle_id = tt4.id + WHERE + tt4.name = '1鍛�' + <if test="params.num != null and params.num != ''"> and tt3.num = #{params.num} </if> + <if test="params.num == null "> and tt3.num = '-1' </if> + AND tt1.version_status = '2' + AND tt1.del_flag = '0' + ) + </select> + + <select id="findDayInspectionStandard" parameterType="String" resultType="Map"> + SELECT + t3.name AS name, + t3.detection_standard AS detectionStandard + FROM + mom_eam_daily_inspection_standard_detail t1 + LEFT JOIN mom_eam_daily_inspection_standard t2 ON t1.daily_inspection_standard_id = t2.id + LEFT JOIN mom_eam_inspection_project t3 ON t1.inspection_project_id = t3.id + LEFT JOIN mom_eam_equipment t4 ON t2.equipment_id = t4.id + left join mom_eam_inspection_cycle t5 on t1.inspection_cycle_id = t5.id + WHERE 1=1 + <if test="equipmentNum != null and equipmentNum != ''"> + and t4.num = #{equipmentNum} + </if> + <if test="equipmentNum == null and equipmentNum == ''"> + and t4.num = '-1' + </if> + + AND t2.version_status = '2' + and t5.cycle_unit = #{cycleUnit} + </select> + + <select id="findDayInspectionStandardProject" parameterType="String" resultType="Map"> + SELECT + t3.name AS name, + t3.detection_standard AS detectionStandard, + t2.inspection_order_uda2 as inspectionUserName, + t2.inspection_order_uda1 AS repairConfirmPerson, + case t1.inspection_project_result when '1' then '鈭�' when '2' then 'x' when '3' then '鈻�' when '4' then 'T' else '' end as insResult, + CONVERT(VARCHAR, DATEPART(DAY, t2.create_time)) as dayTime + FROM + mom_eam_inspection_order_detail t1 + LEFT JOIN mom_eam_inspection_order t2 ON t1.inspection_order_id= t2.id + left join mom_eam_inspection_project t3 on t1.inspection_project_id = t3.id + LEFT JOIN mom_eam_equipment t4 ON t2.equipment_id = t4.id + WHERE 1=1 + + <if test="equipmentNum != null and equipmentNum != ''"> + and t4.num = #{equipmentNum} + </if> + <if test="equipmentNum == null and equipmentNum == ''"> + and t4.num = '-1' + </if> + <if test="dataTime != null and dataTime != ''"> + AND SUBSTRING ( CONVERT ( VARCHAR ( 10 ), t1.create_time, 120 ), 1, 7 ) = SUBSTRING ( CONVERT ( VARCHAR ( 10 ), #{dataTime}, 120 ), 2, 7 ) + </if> + <if test="dataTime == null and dataTime == ''"> + AND SUBSTRING ( CONVERT ( VARCHAR ( 10 ), t1.create_time, 120 ), 1, 7 ) = SUBSTRING ( CONVERT ( VARCHAR ( 10 ), GETDATE( ), 120 ), 1, 7 ) + </if> + and t3.name = #{name} and t3.detection_standard = #{detectionStandard} + </select> + + <select id="getUserQianzi" parameterType="String" resultType="Map"> + SELECT + t1.inspection_order_uda2 AS inspectionUserName, + t1.inspection_order_uda1 AS repairConfirmPerson, + CONVERT ( VARCHAR, DATEPART( DAY, t1.create_time ) ) AS dayTime + FROM + mom_eam_inspection_order t1 + LEFT JOIN mom_eam_equipment t2 ON t1.equipment_id = t2.id + LEFT JOIN mom_eam_inspection_cycle t3 ON t1.inspection_cycle_id = t3.id + WHERE 1=1 + <if test="equipmentNum != null and equipmentNum != ''"> + and t2.num = #{equipmentNum} + </if> + <if test="equipmentNum == null and equipmentNum == ''"> + and t2.num = '-1' + </if> + <if test="dataTime != null and dataTime != ''"> + AND SUBSTRING ( CONVERT ( VARCHAR ( 10 ), t1.create_time, 120 ), 1, 7 ) = SUBSTRING ( CONVERT ( VARCHAR ( 10 ), #{dataTime}, 120 ), 2, 7 ) + </if> + <if test="dataTime == null and dataTime == ''"> + AND SUBSTRING ( CONVERT ( VARCHAR ( 10 ), t1.create_time, 120 ), 1, 7 ) = SUBSTRING ( CONVERT ( VARCHAR ( 10 ), GETDATE( ), 120 ), 1, 7 ) + </if> + and t3.cycle_unit = #{cycleUnit} + </select> </mapper> \ No newline at end of file -- Gitblit v1.9.3