道路线索应急巡查系统服务后台
feiyu02
2025-09-30 84569abda51ecf6c5549dec4cadee8d043422379
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?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.flightfeather.grid.domain.ds1.mapper.ClueTaskMapper">
  <resultMap id="BaseResultMap" type="com.flightfeather.grid.domain.ds1.entity.ClueTask">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="guid" jdbcType="VARCHAR" property="guid" />
    <result column="clue_id" jdbcType="INTEGER" property="clueId" />
    <result column="task_time" jdbcType="TIMESTAMP" property="taskTime" />
    <result column="province_code" jdbcType="VARCHAR" property="provinceCode" />
    <result column="province_name" jdbcType="VARCHAR" property="provinceName" />
    <result column="city_code" jdbcType="VARCHAR" property="cityCode" />
    <result column="city_name" jdbcType="VARCHAR" property="cityName" />
    <result column="district_code" jdbcType="VARCHAR" property="districtCode" />
    <result column="district_name" jdbcType="VARCHAR" property="districtName" />
    <result column="town_code" jdbcType="VARCHAR" property="townCode" />
    <result column="town_name" jdbcType="VARCHAR" property="townName" />
    <result column="response_level" jdbcType="INTEGER" property="responseLevel" />
    <result column="travel_mode" jdbcType="INTEGER" property="travelMode" />
    <result column="has_uav" jdbcType="BIT" property="hasUav" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="executor_ids" jdbcType="VARCHAR" property="executorIds" />
    <result column="internal_task" jdbcType="BIT" property="internalTask" />
    <result column="finished" jdbcType="BIT" property="finished" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
    -->
    guid, clue_id, task_time, province_code, province_name, city_code, city_name, district_code, 
    district_name, town_code, town_name, response_level, travel_mode, has_uav, create_time, 
    update_time, executor_ids, internal_task, finished
  </sql>
 
<!--  通用SQL语句-->
  <sql id="Where_Area">
    <if test="provinceCode != null">
      AND ${tableAlias}.province_code = #{provinceCode}
    </if>
    <if test="provinceName != null">
      AND ${tableAlias}.province_name = #{provinceName}
    </if>
    <if test="cityCode != null">
      AND ${tableAlias}.city_code = #{cityCode}
    </if>
    <if test="cityName != null">
      AND ${tableAlias}.city_name = #{cityName}
    </if>
    <if test="districtCode != null">
      AND ${tableAlias}.district_code = #{districtCode}
    </if>
    <if test="districtName != null">
      AND ${tableAlias}.district_name = #{districtName}
    </if>
    <if test="townCode != null">
      AND ${tableAlias}.town_code = #{townCode}
    </if>
    <if test="townName != null">
      AND ${tableAlias}.town_name = #{townName}
    </if>
  </sql>
  <sql id="Where_Task_Time">
    <if test="startTime != null">
      AND ${tableAlias}.task_time &gt;= #{startTime}
    </if>
    <if test="endTime != null">
      AND ${tableAlias}.task_time &lt;= #{endTime}
    </if>
  </sql>
 
<!--  返回结果模板-->
  <resultMap extends="BaseResultMap" id="SummaryMap" type="com.flightfeather.grid.vo.ClueTaskSummaryVo">
  </resultMap>
 
<!--  查询语句-->
  <select id="selectSummaryCount" resultMap="SummaryMap">
    select
    count(*) as totalCount,
    sum(if(internal_task = true, 1, 0)) as internalTaskCount,
    sum(if(internal_task = false, 1, 0)) as externalTaskCount,
    sum(if(finished = true, 1, 0)) as finishedCount,
    sum(if(finished = false, 1, 0)) as unfinishedCount,
    sum(if(finished = true and internal_task = true, 1, 0)) as internalFinishedCount,
    sum(if(finished = false and internal_task = true, 1, 0)) as internalUnFinishedCount,
    sum(if(finished = true and internal_task = false, 1, 0)) as externalFinishedCount,
    sum(if(finished = false and internal_task = false, 1, 0)) as externalUnFinishedCount
    from g_t_clue_task as a
    <where>
      <include refid="Where_Area">
        <property name="tableAlias" value="a"/>
      </include>
      <include refid="Where_Task_Time">
        <property name="tableAlias" value="a"/>
      </include>
    </where>
  </select>
 
</mapper>