|
|
@@ -1133,4 +1133,45 @@
|
|
|
where standard_id = #{standardId}
|
|
|
and status = #{status}
|
|
|
</update>
|
|
|
+
|
|
|
+ <!-- 年度保养计划表:按设备类别/设备名称/保养负责人聚合,
|
|
|
+ 当年每月只要有已完成(status=3)的保养任务则该月打勾√,排除按天(period_type=1)的保养 -->
|
|
|
+ <select id="selectAnnualPlan" parameterType="com.platform.dao.dto.check.CheckJobDTO"
|
|
|
+ resultType="com.platform.dao.vo.query.check.CheckJobAnnualPlanVO">
|
|
|
+ select
|
|
|
+ sbtype.name as category,
|
|
|
+ sbinfo.name as sbName,
|
|
|
+ coalesce(u.real_name, dept.name) as owner,
|
|
|
+ count(distinct sbinfo.id) as sbNum,
|
|
|
+ max(case when month(coalesce(checkjob.actual_end_time, checkjob.actual_start_time, checkjob.end_time)) = 1 then '√' else '' end) as month1,
|
|
|
+ max(case when month(coalesce(checkjob.actual_end_time, checkjob.actual_start_time, checkjob.end_time)) = 2 then '√' else '' end) as month2,
|
|
|
+ max(case when month(coalesce(checkjob.actual_end_time, checkjob.actual_start_time, checkjob.end_time)) = 3 then '√' else '' end) as month3,
|
|
|
+ max(case when month(coalesce(checkjob.actual_end_time, checkjob.actual_start_time, checkjob.end_time)) = 4 then '√' else '' end) as month4,
|
|
|
+ max(case when month(coalesce(checkjob.actual_end_time, checkjob.actual_start_time, checkjob.end_time)) = 5 then '√' else '' end) as month5,
|
|
|
+ max(case when month(coalesce(checkjob.actual_end_time, checkjob.actual_start_time, checkjob.end_time)) = 6 then '√' else '' end) as month6,
|
|
|
+ max(case when month(coalesce(checkjob.actual_end_time, checkjob.actual_start_time, checkjob.end_time)) = 7 then '√' else '' end) as month7,
|
|
|
+ max(case when month(coalesce(checkjob.actual_end_time, checkjob.actual_start_time, checkjob.end_time)) = 8 then '√' else '' end) as month8,
|
|
|
+ max(case when month(coalesce(checkjob.actual_end_time, checkjob.actual_start_time, checkjob.end_time)) = 9 then '√' else '' end) as month9,
|
|
|
+ max(case when month(coalesce(checkjob.actual_end_time, checkjob.actual_start_time, checkjob.end_time)) = 10 then '√' else '' end) as month10,
|
|
|
+ max(case when month(coalesce(checkjob.actual_end_time, checkjob.actual_start_time, checkjob.end_time)) = 11 then '√' else '' end) as month11,
|
|
|
+ max(case when month(coalesce(checkjob.actual_end_time, checkjob.actual_start_time, checkjob.end_time)) = 12 then '√' else '' end) as month12
|
|
|
+ from t_check_job checkjob
|
|
|
+ inner join t_sb_info sbinfo on sbinfo.id = checkjob.sb_id
|
|
|
+ inner join t_check_standard standard on standard.id = checkjob.standard_id
|
|
|
+ left join t_sb_type sbtype on sbtype.id = sbinfo.type_id
|
|
|
+ left join t_sys_user u on checkjob.check_user_id = u.user_id
|
|
|
+ left join t_sys_dept dept on checkjob.check_dept_id = dept.dept_id
|
|
|
+ <where>
|
|
|
+ checkjob.status = 3
|
|
|
+ and standard.period_type != 1
|
|
|
+ <if test="searchYear != null">
|
|
|
+ and year(coalesce(checkjob.actual_end_time, checkjob.actual_start_time, checkjob.end_time)) = #{searchYear}
|
|
|
+ </if>
|
|
|
+ <if test="type != null">
|
|
|
+ and checkjob.type = #{type}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by sbtype.name, sbinfo.name, coalesce(u.real_name, dept.name)
|
|
|
+ order by sbtype.name asc, sbinfo.name asc
|
|
|
+ </select>
|
|
|
</mapper>
|