| | |
| | | INNER JOIN emergency_drill_plan b ON a.drill_plan_id = b.id |
| | | AND b.department_id = #{deptId} |
| | | </select> |
| | | <!----> |
| | | <select id="getLastTimeByDeptId" resultType="java.lang.String"> |
| | | SELECT |
| | | DATE_FORMAT( max( a.gmt_create ), '%Y-%m-%d %H:%i:%s' ) AS lastTime |
| | | FROM |
| | | `emergency_drill_execute` a |
| | | INNER JOIN emergency_drill_plan b ON a.drill_plan_id = b.id |
| | | AND a.del_flag = 0 AND b.department_id = #{deptId} |
| | | </select> |
| | | <!--根据部门及其子级获取--> |
| | | <select id="getLastTimeByDeptIds" resultType="java.lang.String"> |
| | | SELECT |
| | | DATE_FORMAT( max( a.gmt_create ), '%Y-%m-%d %H:%i:%s' ) AS lastTime |
| | | FROM |
| | | `emergency_drill_execute` a |
| | | INNER JOIN emergency_drill_plan b ON a.drill_plan_id = b.id |
| | | AND a.del_flag = 0 AND b.department_id IN |
| | | <foreach collection="deptIdList" item="deptId" open="(" close=")" separator=","> |
| | | #{deptId} |
| | | </foreach> |
| | | </select> |
| | | <select id="getCountByDeptIdsAndTime" resultType="com.gkhy.safePlatform.emergency.entity.EmergencyExecuteCountDO"> |
| | | SELECT |
| | | COUNT( 1 ) AS count, |
| | | b.department_id AS deptId, |
| | | DATE_FORMAT( a.gmt_create, '%m' ) AS month, |
| | | DATE_FORMAT( a.gmt_create, '%Y' ) AS year |
| | | FROM |
| | | `emergency_drill_execute` a |
| | | INNER JOIN emergency_drill_plan b ON a.drill_plan_id = b.id |
| | | WHERE |
| | | a.del_flag = 0 |
| | | AND b.department_id in |
| | | <foreach collection="deptIds" item="deptId" open="(" close=")" separator=","> |
| | | #{deptId} |
| | | </foreach> |
| | | AND DATE( a.gmt_create ) BETWEEN #{startTime} |
| | | AND #{endTime} |
| | | GROUP BY |
| | | b.department_id, |
| | | DATE_FORMAT( a.gmt_create, '%Y-%m' ), |
| | | DATE_FORMAT(a.gmt_create,'%m'), |
| | | DATE_FORMAT(a.gmt_create,'%Y') |
| | | </select> |
| | | <select id="getCountByDeptIdAndMonth" resultType="com.gkhy.safePlatform.emergency.entity.EmergencyExecuteCountDO"> |
| | | SELECT |
| | | COUNT( 1 ) AS count, |
| | | b.department_id AS deptId |
| | | FROM |
| | | `emergency_drill_execute` a |
| | | INNER JOIN emergency_drill_plan b ON a.drill_plan_id = b.id |
| | | WHERE |
| | | a.del_flag = 0 |
| | | AND b.department_id = #{deptId} |
| | | AND YEAR( a.gmt_create ) = #{year} |
| | | AND MONTH( a.gmt_create) = #{month} |
| | | </select> |
| | | <select id="getCountByDeptIdAndYear" resultType="com.gkhy.safePlatform.emergency.entity.EmergencyExecuteCountDO"> |
| | | SELECT |
| | | COUNT( 1 ) AS count, |
| | | DATE_FORMAT( a.gmt_create, '%m' ) AS month |
| | | FROM |
| | | `emergency_drill_execute` a |
| | | INNER JOIN emergency_drill_plan b ON a.drill_plan_id = b.id |
| | | WHERE |
| | | a.del_flag = 0 |
| | | AND b.department_id = #{deptId} |
| | | AND YEAR( a.gmt_create ) = #{year} |
| | | GROUP BY |
| | | DATE_FORMAT( a.gmt_create, '%Y-%m' ), |
| | | DATE_FORMAT(a.gmt_create,'%m') |
| | | </select> |
| | | |
| | | |
| | | </mapper> |