道路线索应急巡查系统服务后台
feiyu02
2025-09-30 84569abda51ecf6c5549dec4cadee8d043422379
src/main/resources/mapper/ds1/ClueTaskMapper.xml
@@ -22,13 +22,79 @@
    <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,
    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
    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>