<?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.ClueInternalMapper">
|
<resultMap id="BaseResultMap" type="com.flightfeather.grid.domain.ds1.entity.ClueInternal">
|
<!--
|
WARNING - @mbg.generated
|
-->
|
<id column="C_Id" jdbcType="INTEGER" property="cId" />
|
<result column="C_Clue_Name" jdbcType="VARCHAR" property="cClueName" />
|
<result column="C_Conclusion" jdbcType="VARCHAR" property="cConclusion" />
|
<result column="C_Alarm_Time" jdbcType="TIMESTAMP" property="cAlarmTime" />
|
<result column="C_Site_Name" jdbcType="VARCHAR" property="cSiteName" />
|
<result column="C_Factor" jdbcType="VARCHAR" property="cFactor" />
|
<result column="C_Release_Time" jdbcType="TIMESTAMP" property="cReleaseTime" />
|
<result column="C_Air_Checked_Options" jdbcType="VARCHAR" property="cAirCheckedOptions" />
|
<result column="C_Pollution_Checked_Options" jdbcType="VARCHAR" property="cPollutionCheckedOptions" />
|
<result column="C_Create_Time" jdbcType="TIMESTAMP" property="cCreateTime" />
|
<result column="C_Center" jdbcType="VARCHAR" property="cCenter" />
|
<result column="C_Zoom" jdbcType="VARCHAR" property="cZoom" />
|
<result column="C_Longitude" jdbcType="DOUBLE" property="cLongitude" />
|
<result column="C_Latitude" jdbcType="DOUBLE" property="cLatitude" />
|
<result column="C_Site_Type" jdbcType="VARCHAR" property="cSiteType" />
|
<result column="C_Report_Time" jdbcType="TIMESTAMP" property="cReportTime" />
|
<result column="C_Upload_Time" jdbcType="TIMESTAMP" property="cUploadTime" />
|
<result column="C_Uploaded" jdbcType="BIT" property="cUploaded" />
|
<result column="C_Address" jdbcType="VARCHAR" property="cAddress" />
|
</resultMap>
|
<sql id="Base_Column_List">
|
<!--
|
WARNING - @mbg.generated
|
-->
|
C_Id, C_Clue_Name, C_Conclusion, C_Alarm_Time, C_Site_Name, C_Factor, C_Release_Time,
|
C_Air_Checked_Options, C_Pollution_Checked_Options, C_Create_Time, C_Center, C_Zoom,
|
C_Longitude, C_Latitude, C_Site_Type, C_Report_Time, C_Upload_Time, C_Uploaded, C_Address
|
</sql>
|
|
<resultMap extends="BaseResultMap" id="ClueVoMap" type="com.flightfeather.grid.vo.ClueInternalVo">
|
<!-- &lt;result column="questionCount" jdbcType="INTEGER" property="questionCount" /&gt;-->
|
<!-- &lt;result column="conclusionCount" jdbcType="INTEGER" property="conclusionCount" /&gt;-->
|
</resultMap>
|
|
<sql id="selectClueVo">
|
SELECT
|
a.*,
|
COUNT(DISTINCT b.CC_Id) AS conclusionCount,
|
COUNT(DISTINCT c.CQ_Id) AS questionCount,
|
COUNT(DISTINCT d.guid) AS taskCount
|
FROM
|
g_t_clue_internal AS a
|
LEFT JOIN g_t_clue_conclusion AS b ON a.C_Id = b.C_Id and b.CC_Internal = true
|
LEFT JOIN g_t_clue_question AS c ON a.C_Id = c.C_Id and c.CQ_Internal = true
|
LEFT JOIN g_t_clue_task AS d ON a.C_Id = d.clue_id and d.internal_task = true
|
</sql>
|
<sql id="groupClueId">
|
GROUP BY
|
a.C_Id
|
ORDER BY
|
a.C_Id DESC
|
</sql>
|
|
<select id="getClue" resultMap="ClueVoMap">
|
<include refid="selectClueVo" />
|
<where>
|
<if test="sTime != null">
|
AND a.C_Release_Time >= #{sTime}
|
</if>
|
<if test="eTime != null">
|
AND a.C_Release_Time <= #{eTime}
|
</if>
|
</where>
|
<include refid="groupClueId" />
|
</select>
|
|
<select id="getClueById" resultMap="ClueVoMap">
|
<include refid="selectClueVo" />
|
<where>
|
a.C_Id = #{clueId}
|
</where>
|
<include refid="groupClueId" />
|
</select>
|
</mapper>
|