1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?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.zhyc.xps.aqpt.mapper.CheckTaskStatisMapper">
- <!-- 按状态统计 -->
- <select id="counterByStatus" parameterType="java.util.Map" resultType="com.zhyc.xps.aqpt.vo.CheckTaskCountByStatusVo">
- SELECT
- IFNULL(SUM( CASE WHEN M.check_status = 0 THEN 1 ELSE 0 END) ,0) AS 'waiting',
- IFNULL(SUM( CASE WHEN M.check_status = 1 THEN 1 ELSE 0 END) ,0) AS 'handling',
- IFNULL(SUM( CASE WHEN M.check_status = 2 THEN 1 ELSE 0 END) ,0) AS 'completed',
- IFNULL(SUM( CASE WHEN M.check_status = -1 THEN 1 ELSE 0 END) ,0) AS 'canceled'
- FROM check_task AS M
- LEFT JOIN task AS A ON (M.oc_id = A.oc_id AND M.task_id = A.task_id)
- LEFT JOIN s_group AS B ON (A.oc_id = B.oc_id AND A.handle_group_id = B.group_id)
- WHERE A.oc_id = #{ocId} AND A.deleted_flag = 0
- <if test="handleAccountId != null">
- AND A.handle_account_id = #{handleAccountId ,jdbcType=BIGINT}
- </if>
- <if test="handleGroupId != null">
- AND A.handle_group_id = #{handleGroupId ,jdbcType=BIGINT}
- </if>
- <if test="handlePositionId != null">
- AND A.handle_position_id = #{handlePositionId ,jdbcType=BIGINT}
- </if>
- <if test="launchGroupId != null">
- AND A.launch_group_id = #{launchGroupId ,jdbcType=BIGINT}
- </if>
- <if test="launchPositionId != null">
- AND A.launch_position_id = #{launchPositionId ,jdbcType=BIGINT}
- </if>
- <if test="launchAccountId != null">
- AND A.launch_account_id = #{launchAccountId ,jdbcType=BIGINT}
- </if>
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND B.node_left >= #{nodeLeft ,jdbcType=BIGINT}
- AND B.node_right <= #{nodeRight ,jdbcType=BIGINT}
- ]]>
- </if>
- <if test="checkStatus != null">
- AND M.check_status = #{checkStatus ,jdbcType=BIGINT}
- </if>
- </select>
- <!-- 按条件统计 -->
- <select id="counterByCondition" parameterType="java.util.Map" resultType="int">
- SELECT
- count(*)
- FROM check_task AS M
- LEFT JOIN task AS A ON (M.oc_id = A.oc_id AND M.task_id = A.task_id)
- LEFT JOIN s_group AS B ON (A.oc_id = B.oc_id AND A.handle_group_id = B.group_id)
- WHERE M.oc_id = #{ocId} AND M.deleted_flag = 0
- <if test="handleAccountId != null">
- AND A.handle_account_id = #{handleAccountId ,jdbcType=BIGINT}
- </if>
- <if test="handleGroupId != null">
- AND A.handle_group_id = #{handleGroupId ,jdbcType=BIGINT}
- </if>
- <if test="handlePositionId != null">
- AND A.handle_position_id = #{handlePositionId ,jdbcType=BIGINT}
- </if>
- <if test="launchGroupId != null">
- AND A.launch_group_id = #{launchGroupId ,jdbcType=BIGINT}
- </if>
- <if test="launchPositionId != null">
- AND A.launch_position_id = #{launchPositionId ,jdbcType=BIGINT}
- </if>
- <if test="launchAccountId != null">
- AND A.launch_account_id = #{launchAccountId ,jdbcType=BIGINT}
- </if>
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND B.node_left >= #{nodeLeft ,jdbcType=BIGINT}
- AND B.node_right <= #{nodeRight ,jdbcType=BIGINT}
- ]]>
- </if>
- <if test="checkStatus != null">
- AND M.check_status = #{checkStatus ,jdbcType=BIGINT}
- </if>
- </select>
- <!-- 按月份统计-->
- </mapper>
|