IntelligentRecognition/ah-jjsp-service/.svn/pristine/c2/c2166370ccb9b2794f3b4fcb258...

40 lines
2.5 KiB
XML

<?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.sercurityControl.proteam.dutyTask.mapper.HistoryMapper">
<!--历史记录-->
<select id="getHistoryByDateType" resultType="java.util.Map">
<if test="type == 1">
SELECT COUNT(IF(jwp.re_assessment_risk_level = '2',1,NULL)) AS num
from jj_weeks_plan jwp
WHERE (jwp.planned_start_date BETWEEN #{startTime} and #{endTime} OR jwp.planned_end_date BETWEEN #{startTime} and #{endTime})
UNION ALL
SELECT COUNT(IF(jwp.re_assessment_risk_level = '3',1,NULL)) AS num
from jj_weeks_plan jwp
WHERE (jwp.planned_start_date BETWEEN #{startTime} and #{endTime} OR jwp.planned_end_date BETWEEN #{startTime} and #{endTime})
</if>
<if test="type == 2">
SELECT COUNT(*) AS num
FROM jj_ticket tti
WHERE tti.delete_flag= '0'
AND (tti.planned_start_date BETWEEN CONCAT(#{startTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59') OR tti.planned_end_date BETWEEN CONCAT(#{startTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
UNION ALL
SELECT COUNT(*) AS num
FROM jj_ticket tti
INNER JOIN jj_class_meetting tcm ON tti.id=tcm.ticket_id AND tcm.current_constr_date BETWEEN #{startTime} and #{endTime} AND tcm.delete_flag = '0'
WHERE tti.delete_flag= '0'
AND (tti.planned_start_date BETWEEN CONCAT(#{startTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59') OR tti.planned_end_date BETWEEN CONCAT(#{startTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
</if>
<if test="type == 3">
SELECT COUNT(*) AS num
FROM jj_ticket tti
WHERE tti.delete_flag= '0' AND tti.ticket_type = 'A'
AND (tti.planned_start_date BETWEEN CONCAT(#{startTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59') OR tti.planned_end_date BETWEEN CONCAT(#{startTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
UNION ALL
SELECT COUNT(*) AS num
FROM jj_ticket tti
WHERE tti.delete_flag= '0' AND tti.ticket_type = 'B'
AND (tti.planned_start_date BETWEEN CONCAT(#{startTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59') OR tti.planned_end_date BETWEEN CONCAT(#{startTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
</if>
</select>
</mapper>