| | |
| | | LEFT JOIN emergency_plan c ON b.plan_id = c.id |
| | | WHERE |
| | | a.del_flag = 0 |
| | | <if test="query.status != null">and a.status = #{query.status}</if> |
| | | </select> |
| | | |
| | | <insert id="addEmergencyDrillExecute" parameterType="com.gkhy.safePlatform.emergency.entity.EmergencyDrillExecuteInfo" |
| | |
| | | <update id="deleteEmergencyDrillExecute"> |
| | | update emergency_drill_execute set del_flag = 1 where id = #{id} |
| | | </update> |
| | | |
| | | <update id="updateStatusById"> |
| | | update emergency_drill_execute set status = 1 where id = #{drillExecuteId} |
| | | </update> |
| | | |
| | | <select id="selectEmergencyDrillExecuteIntervalTime" resultType="java.lang.Integer"> |
| | | SELECT datediff( now( ), ( SELECT max( gmt_create ) FROM `emergency_drill_execute` ) ) |
| | | </select> |
| | | |
| | | <resultMap type="com.gkhy.safePlatform.emergency.entity.EmergencyDrillExecuteCountData" |
| | | id="emergencyDrillExecuteCountChart"> |
| | | <result column="num" property="num"/> |
| | | <result column="name" property="name"/> |
| | | </resultMap> |
| | | |
| | | <select id="selectByMonthAndDept" resultMap="emergencyDrillExecuteCountChart"> |
| | | SELECT |
| | | count( 0 ) AS num, |
| | | DATE_FORMAT( a.gmt_create, '%Y-%m' ) AS `name` |
| | | FROM |
| | | `emergency_drill_execute` a |
| | | LEFT JOIN emergency_drill_plan b ON a.drill_plan_id = b.id |
| | | WHERE |
| | | a.del_flag = 0 |
| | | AND a.gmt_create <![CDATA[ >= ]]> #{startTime} |
| | | AND a.gmt_create <![CDATA[ <= ]]> #{endTime} |
| | | <if test="deptIds != null " > |
| | | and b.department_id in |
| | | <foreach item="id" collection="deptIds" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY |
| | | DATE_FORMAT( a.gmt_create, '%Y-%m' ) |
| | | </select> |
| | | |
| | | <select id="selectByYearAndDept" resultMap="emergencyDrillExecuteCountChart"> |
| | | SELECT |
| | | count( 0 ) AS num, |
| | | DATE_FORMAT( a.gmt_create, '%Y' ) AS `name` |
| | | FROM |
| | | `emergency_drill_execute` a |
| | | LEFT JOIN emergency_drill_plan b ON a.drill_plan_id = b.id |
| | | WHERE |
| | | a.del_flag = 0 |
| | | AND a.gmt_create <![CDATA[ >= ]]> #{startTime} |
| | | AND a.gmt_create <![CDATA[ <= ]]> #{endTime} |
| | | <if test="deptIds != null " > |
| | | and b.department_id in |
| | | <foreach item="id" collection="deptIds" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY |
| | | DATE_FORMAT( a.gmt_create, '%Y' ) |
| | | </select> |
| | | </mapper> |