| | |
| | | <?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="cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper" > |
| | | <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds1.entity.Problemlist" > |
| | | <!-- |
| | | WARNING - @mbg.generated |
| | | --> |
| | | <id column="PL_GUID" property="guid" jdbcType="VARCHAR" /> |
| | | <result column="I_GUID" property="iguid" jdbcType="VARCHAR" /> |
| | | <result column="ST_GUID" property="stguid" jdbcType="VARCHAR" /> |
| | | <result column="S_GUID" property="sguid" jdbcType="VARCHAR" /> |
| | | <result column="PL_SenseName" property="sensename" jdbcType="VARCHAR" /> |
| | | <result column="PL_SenseAddress" property="senseaddress" jdbcType="VARCHAR" /> |
| | | <result column="PT_GUID" property="ptguid" jdbcType="VARCHAR" /> |
| | | <result column="PL_ProblemName" property="problemname" jdbcType="VARCHAR" /> |
| | | <result column="PL_Longitude" property="longitude" jdbcType="DECIMAL" /> |
| | | <result column="PL_Latitude" property="latitude" jdbcType="DECIMAL" /> |
| | | <result column="PL_LocationID" property="locationid" jdbcType="TINYINT" /> |
| | | <result column="PL_Location" property="location" jdbcType="VARCHAR" /> |
| | | <result column="PL_Time" property="time" jdbcType="TIMESTAMP" /> |
| | | <result column="PL_IsRechecked" property="isrechecked" jdbcType="BIT" /> |
| | | <result column="PL_RecheckTime" property="rechecktime" jdbcType="TIMESTAMP" /> |
| | | <result column="PL_RecheckUserGUID" property="recheckuserguid" jdbcType="VARCHAR" /> |
| | | <result column="PL_RecheckUserName" property="recheckusername" jdbcType="VARCHAR" /> |
| | | <result column="PL_RecheckUserRealName" property="recheckuserrealname" jdbcType="VARCHAR" /> |
| | | <result column="PL_RecheckDescription" property="recheckdescription" jdbcType="VARCHAR" /> |
| | | <result column="PL_RecheckResultID" property="recheckresultid" jdbcType="BIT" /> |
| | | <result column="PL_RecheckResult" property="recheckresult" jdbcType="VARCHAR" /> |
| | | <result column="PL_IsChanged" property="ischanged" jdbcType="BIT" /> |
| | | <result column="PL_ChangeCatalog" property="changecatalog" jdbcType="VARCHAR" /> |
| | | <result column="PL_ChangedTime" property="changedtime" jdbcType="TIMESTAMP" /> |
| | | <result column="PL_ChangedResult" property="changedresult" jdbcType="VARCHAR" /> |
| | | <result column="PL_Advise" property="advise" jdbcType="VARCHAR" /> |
| | | <result column="PL_Extension1" property="extension1" jdbcType="VARCHAR" /> |
| | | <result column="PL_Extension2" property="extension2" jdbcType="VARCHAR" /> |
| | | <result column="PL_Extension3" property="extension3" jdbcType="VARCHAR" /> |
| | | <result column="PL_Remark" property="remark" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | |
| | | <resultMap id="StatisticsVoMap" type="cn.flightfeather.supervision.lightshare.vo.StatisticsVo"> |
| | | <id property="name" column="T_Name"/> |
| | | <result property="startTime" column="startTime"/> |
| | | <result property="endTime" column="endTime"/> |
| | | <result property="count" column="count1"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List" > |
| | | <!-- |
| | | WARNING - @mbg.generated |
| | | --> |
| | | PL_GUID, I_GUID, ST_GUID, S_GUID, PL_SenseName, PL_SenseAddress, PT_GUID, PL_ProblemName, |
| | | PL_Longitude, PL_Latitude, PL_LocationID, PL_Location, PL_Time, PL_IsRechecked, PL_RecheckTime, |
| | | PL_RecheckUserGUID, PL_RecheckUserName, PL_RecheckUserRealName, PL_RecheckDescription, |
| | | PL_RecheckResultID, PL_RecheckResult, PL_IsChanged, PL_ChangeCatalog, PL_ChangedTime, |
| | | PL_ChangedResult, PL_Advise, PL_Extension1, PL_Extension2, PL_Extension3, PL_Remark |
| | | </sql> |
| | | <mapper namespace="cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper"> |
| | | <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds1.entity.Problemlist"> |
| | | <!-- |
| | | WARNING - @mbg.generated |
| | | --> |
| | | <id column="PL_GUID" property="guid" jdbcType="VARCHAR"/> |
| | | <result column="I_GUID" property="iguid" jdbcType="VARCHAR"/> |
| | | <result column="ST_GUID" property="stguid" jdbcType="VARCHAR"/> |
| | | <result column="S_GUID" property="sguid" jdbcType="VARCHAR"/> |
| | | <result column="PL_SenseName" property="sensename" jdbcType="VARCHAR"/> |
| | | <result column="PL_SenseAddress" property="senseaddress" jdbcType="VARCHAR"/> |
| | | <result column="PT_GUID" property="ptguid" jdbcType="VARCHAR"/> |
| | | <result column="PL_ProblemName" property="problemname" jdbcType="VARCHAR"/> |
| | | <result column="PL_Longitude" property="longitude" jdbcType="DECIMAL"/> |
| | | <result column="PL_Latitude" property="latitude" jdbcType="DECIMAL"/> |
| | | <result column="PL_LocationID" property="locationid" jdbcType="TINYINT"/> |
| | | <result column="PL_Location" property="location" jdbcType="VARCHAR"/> |
| | | <result column="PL_Time" property="time" jdbcType="TIMESTAMP"/> |
| | | <result column="PL_IsRechecked" property="isrechecked" jdbcType="BIT"/> |
| | | <result column="PL_RecheckTime" property="rechecktime" jdbcType="TIMESTAMP"/> |
| | | <result column="PL_RecheckUserGUID" property="recheckuserguid" jdbcType="VARCHAR"/> |
| | | <result column="PL_RecheckUserName" property="recheckusername" jdbcType="VARCHAR"/> |
| | | <result column="PL_RecheckUserRealName" property="recheckuserrealname" jdbcType="VARCHAR"/> |
| | | <result column="PL_RecheckDescription" property="recheckdescription" jdbcType="VARCHAR"/> |
| | | <result column="PL_RecheckResultID" property="recheckresultid" jdbcType="BIT"/> |
| | | <result column="PL_RecheckResult" property="recheckresult" jdbcType="VARCHAR"/> |
| | | <result column="PL_IsChanged" property="ischanged" jdbcType="BIT"/> |
| | | <result column="PL_ChangeCatalog" property="changecatalog" jdbcType="VARCHAR"/> |
| | | <result column="PL_ChangedTime" property="changedtime" jdbcType="TIMESTAMP"/> |
| | | <result column="PL_ChangedResult" property="changedresult" jdbcType="VARCHAR"/> |
| | | <result column="PL_Advise" property="advise" jdbcType="VARCHAR"/> |
| | | <result column="PL_Extension1" property="extension1" jdbcType="VARCHAR"/> |
| | | <result column="PL_Extension2" property="extension2" jdbcType="VARCHAR"/> |
| | | <result column="PL_Extension3" property="extension3" jdbcType="VARCHAR"/> |
| | | <result column="PL_Remark" property="remark" jdbcType="VARCHAR"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!-- |
| | | WARNING - @mbg.generated |
| | | --> |
| | | PL_GUID, I_GUID, ST_GUID, S_GUID, PL_SenseName, PL_SenseAddress, PT_GUID, PL_ProblemName, |
| | | PL_Longitude, PL_Latitude, PL_LocationID, PL_Location, PL_Time, PL_IsRechecked, PL_RecheckTime, |
| | | PL_RecheckUserGUID, PL_RecheckUserName, PL_RecheckUserRealName, PL_RecheckDescription, |
| | | PL_RecheckResultID, PL_RecheckResult, PL_IsChanged, PL_ChangeCatalog, PL_ChangedTime, |
| | | PL_ChangedResult, PL_Advise, PL_Extension1, PL_Extension2, PL_Extension3, PL_Remark |
| | | </sql> |
| | | |
| | | <!--<select id="getStatisticalResult" parameterType="String" resultMap="StatisticsVoMap">--> |
| | | <select id="getStatisticalResult" parameterType="String" resultType="map"> |
| | | SELECT |
| | | <resultMap id="StatisticsVoMap" type="cn.flightfeather.supervision.lightshare.vo.StatisticsVo"> |
| | | <result property="name" column="name"/> |
| | | <result property="startTime" column="startTime"/> |
| | | <result property="endTime" column="endTime"/> |
| | | <result property="count" column="count"/> |
| | | <result property="changeCount" column="changeCount"/> |
| | | </resultMap> |
| | | <resultMap id="SceneProblemSummary" type="cn.flightfeather.supervision.lightshare.vo.SceneProblemSummary"> |
| | | <id property="sceneId" column="sceneId"/> |
| | | <result property="proNum" column="proNum"/> |
| | | <result property="changeNum" column="changeNum"/> |
| | | <result property="changePer" column="changePer"/> |
| | | <association property="scene" resultMap="cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper.BaseResultMap" /> |
| | | <!-- <collection property="subtasks" ofType="cn.flightfeather.supervision.domain.ds1.entity.Subtask"--> |
| | | <!-- resultMap="cn.flightfeather.supervision.domain.ds1.mapper.SubtaskMapper.BaseResultMap" />--> |
| | | </resultMap> |
| | | |
| | | <select id="getStatisticalResult" parameterType="String" resultMap="StatisticsVoMap"> |
| | | SELECT |
| | | b.PT_TypeName as name, |
| | | COUNT(b.PT_TypeName) as count, |
| | | COUNT(CASE WHEN a.PL_IsChanged = 1 THEN 1 ELSE NULL END) as changeCount |
| | | FROM |
| | | FROM |
| | | im_t_problemlist AS a |
| | | LEFT JOIN sm_t_problemtype AS b ON a.PT_GUID = b.PT_GUID |
| | | LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID |
| | | WHERE |
| | | a.ST_GUID IN ( |
| | | SELECT |
| | | d.ST_GUID |
| | | FROM |
| | | tm_t_subtask AS d LEFT JOIN tm_t_task AS e ON d.T_GUID = e.T_GUID |
| | | WHERE |
| | | e.T_LevelNum = '2' |
| | | AND e.T_StartTime <= #{param2} |
| | | AND e.T_EndTime >= #{param3} |
| | | AND e.T_DistrictCode = #{param1} |
| | | ) |
| | | AND f.S_TypeID = #{param4} |
| | | GROUP BY |
| | | LEFT JOIN sm_t_problemtype AS b ON a.PT_GUID = b.PT_GUID |
| | | LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID |
| | | LEFT JOIN tm_t_subtask AS c ON a.ST_GUID = c.ST_GUID |
| | | <where> |
| | | <!-- a.ST_GUID IN (--> |
| | | <!-- SELECT--> |
| | | <!-- d.ST_GUID--> |
| | | <!-- FROM--> |
| | | <!-- tm_t_subtask AS d LEFT JOIN tm_t_task AS e ON d.T_GUID = e.T_GUID--> |
| | | <!-- WHERE--> |
| | | <!-- e.T_LevelNum = '2'--> |
| | | <!-- <if test="startTime != null">--> |
| | | <!-- AND e.T_StartTime <= #{startTime}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="endTime != null">--> |
| | | <!-- AND e.T_EndTime >= #{endTime}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="districtCode != null">--> |
| | | <!-- AND e.T_DistrictCode = #{districtCode}--> |
| | | <!-- </if>--> |
| | | <!-- )--> |
| | | <if test="startTime != null"> |
| | | AND c.ST_PlanStartTime >= #{startTime} |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND c.ST_PlanStartTime <= #{endTime} |
| | | </if> |
| | | <if test="districtCode != null"> |
| | | AND f.S_DistrictCode = #{districtCode} |
| | | </if> |
| | | <if test="sceneType != null"> |
| | | AND f.S_TypeID = #{sceneType} |
| | | </if> |
| | | <if test="sceneId != null"> |
| | | AND a.S_GUID = #{sceneId} |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | b.PT_TypeName |
| | | ORDER BY |
| | | ORDER BY |
| | | COUNT(b.PT_TypeName) DESC |
| | | </select> |
| | | <!--select DISTINCT T_Name as name, count(*) as count from tm_t_task where T_LevelNum = 2--> |
| | | </select> |
| | | <!--根据顶层任务id和场景类型id获取问题分类情况,结果同getStatisticalResult--> |
| | | <select id="getStatisticalResultById" parameterType="String" resultType="map"> |
| | | SELECT |
| | | b.PT_TypeName AS name, |
| | | COUNT(b.PT_TypeName) AS count, |
| | | COUNT(CASE WHEN a.PL_IsChanged = 1 THEN 1 ELSE NULL END) as changeCount |
| | | b.PT_TypeName AS name, |
| | | COUNT(b.PT_TypeName) AS count, |
| | | COUNT(CASE WHEN a.PL_IsChanged = 1 THEN 1 ELSE NULL END) as changeCount |
| | | FROM |
| | | im_t_problemlist AS a |
| | | im_t_problemlist AS a |
| | | LEFT JOIN sm_t_problemtype AS b ON a.PT_GUID = b.PT_GUID |
| | | LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID |
| | | LEFT JOIN tm_t_subtask AS c ON a.ST_GUID = c.ST_GUID |
| | | WHERE |
| | | c.T_GUID = #{param1} |
| | | c.T_GUID = #{param1} |
| | | AND f.S_TypeID = #{param2} |
| | | GROUP BY |
| | | b.PT_TypeName |
| | | b.PT_TypeName |
| | | ORDER BY |
| | | COUNT(b.PT_TypeName) DESC |
| | | COUNT(b.PT_TypeName) DESC |
| | | </select> |
| | | |
| | | |
| | | <select id="getChangeResult" parameterType="String" resultType="map"> |
| | | SELECT |
| | | a.S_GUID as id, |
| | | a.PL_SenseName as name, |
| | | f.S_TypeID as type, |
| | | COUNT(a.PL_GUID) as problemCount, |
| | | COUNT(CASE WHEN a.PL_IsChanged = 1 THEN 1 ELSE NULL END) as changeCount |
| | | FROM |
| | | im_t_problemlist AS a |
| | | LEFT JOIN sm_t_problemtype AS b ON a.PT_GUID = b.PT_GUID |
| | | LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID |
| | | LEFT JOIN sm_t_monitorobjectversion as g ON a.S_GUID = g.S_GUID |
| | | WHERE |
| | | a.ST_GUID IN ( |
| | | SELECT |
| | | ST_GUID |
| | | FROM |
| | | tm_t_subtask |
| | | WHERE |
| | | T_GUID = #{param1} |
| | | ) |
| | | AND f.S_TypeID = #{param2} |
| | | AND g.T_ID = #{param1} |
| | | GROUP BY |
| | | id |
| | | ORDER BY |
| | | problemCount DESC |
| | | SELECT |
| | | a.S_GUID as id, |
| | | a.PL_SenseName as name, |
| | | f.S_TypeID as type, |
| | | COUNT(a.PL_GUID) as problemCount, |
| | | COUNT(CASE WHEN a.PL_IsChanged = 1 THEN 1 ELSE NULL END) as changeCount |
| | | FROM |
| | | im_t_problemlist AS a |
| | | LEFT JOIN sm_t_problemtype AS b ON a.PT_GUID = b.PT_GUID |
| | | LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID |
| | | LEFT JOIN sm_t_monitorobjectversion as g ON a.S_GUID = g.S_GUID |
| | | WHERE |
| | | a.ST_GUID IN ( |
| | | SELECT |
| | | ST_GUID |
| | | FROM |
| | | tm_t_subtask |
| | | WHERE |
| | | T_GUID = #{param1} |
| | | ) |
| | | AND f.S_TypeID = #{param2} |
| | | AND g.T_ID = #{param1} |
| | | GROUP BY |
| | | id |
| | | ORDER BY |
| | | problemCount DESC |
| | | </select> |
| | | <select id="getScoreResult" resultType="map" parameterType="String"> |
| | | SELECT |
| | | b.ST_name as name, |
| | | E_ResultScoreBef as scoreBef, |
| | | E_ResultScoreAft as scoreAft |
| | | b.ST_name as name, |
| | | E_ResultScoreBef as scoreBef, |
| | | E_ResultScoreAft as scoreAft |
| | | FROM |
| | | ea_t_evaluation AS a |
| | | ea_t_evaluation AS a |
| | | RIGHT JOIN tm_t_subtask AS b ON a.ST_GUID = b.ST_GUID |
| | | WHERE |
| | | b.T_GUID = #{param1} |
| | | b.T_GUID = #{param1} |
| | | AND a.E_ScenseTypeID = #{param2} |
| | | </select> |
| | | |
| | | <select id="selectSE" resultType="string" parameterType="String"> |
| | | ${_parameter} |
| | | </select> |
| | | |
| | | <select id="getProblemByScene" resultMap="BaseResultMap" parameterType="String"> |
| | | SELECT |
| | | a.* |
| | | a.* |
| | | FROM |
| | | im_t_problemlist AS a |
| | | im_t_problemlist AS a |
| | | LEFT JOIN tm_t_subtask AS b ON a.ST_GUID = b.ST_GUID |
| | | WHERE |
| | | a.S_GUID = #{param1} |
| | | a.S_GUID = #{param1} |
| | | AND b.T_GUID = #{param2} |
| | | </select> |
| | | <select id="findMonthProblemById" resultType="map" > |
| | | </select> |
| | | <select id="findMonthProblemById" resultType="map"> |
| | | SELECT |
| | | b.S_TownCode as towncode, |
| | | b.S_TownName as townname, |
| | | b.S_TypeID as scenetype, |
| | | b.S_Type as scenetypename, |
| | | COUNT(DISTINCT a.S_GUID) as totalscenecount, |
| | | COUNT(DISTINCT d.S_GUID) as problemscenes, |
| | | COUNT(d.PL_GUID) as totalproblems, |
| | | SUM(CASE WHEN d.PL_IsChanged = 1 THEN 1 ELSE 0 END) as changedproblems |
| | | b.S_TownCode as towncode, |
| | | b.S_TownName as townname, |
| | | b.S_TypeID as scenetype, |
| | | b.S_Type as scenetypename, |
| | | COUNT(DISTINCT a.S_GUID) as totalscenecount, |
| | | COUNT(DISTINCT d.S_GUID) as problemscenes, |
| | | COUNT(d.PL_GUID) as totalproblems, |
| | | SUM(CASE WHEN d.PL_IsChanged = 1 THEN 1 ELSE 0 END) as changedproblems |
| | | FROM |
| | | sm_t_monitorobjectversion AS a |
| | | sm_t_monitorobjectversion AS a |
| | | LEFT JOIN sm_t_scense AS b ON a.S_GUID = b.S_GUID |
| | | LEFT JOIN tm_t_subtask AS c ON a.T_ID = c.T_GUID AND b.S_GUID = c.ST_ScenseID |
| | | LEFT JOIN im_t_problemlist AS d ON c.ST_GUID = d.ST_GUID |
| | | WHERE |
| | | a.T_ID = #{param1} |
| | | a.T_ID = #{param1} |
| | | <if test="param2 !=null and param2 !=''"> |
| | | AND S_TypeID = #{param2} |
| | | </if> |
| | | GROUP BY |
| | | b.S_TownCode |
| | | b.S_TownCode |
| | | </select> |
| | | |
| | | <select id="findUnchangedCount" resultType="int" parameterType="String"> |
| | | SELECT |
| | | SUM(CASE WHEN a.PL_IsChanged = 0 THEN 1 ELSE 0 END) as unChanged |
| | | SUM(CASE WHEN a.PL_IsChanged = 0 THEN 1 ELSE 0 END) as unChanged |
| | | FROM |
| | | im_t_problemlist AS a |
| | | LEFT JOIN tm_t_subtask AS b ON a.ST_GUID = b.ST_GUID |
| | | im_t_problemlist AS a |
| | | LEFT JOIN tm_t_subtask AS b ON a.ST_GUID = b.ST_GUID |
| | | WHERE |
| | | b.TS_GUID = #{param1} |
| | | b.TS_GUID = #{param1} |
| | | GROUP BY |
| | | b.ST_GUID |
| | | b.ST_GUID |
| | | </select> |
| | | <select id="getSceneProSummary" resultMap="SceneProblemSummary"> |
| | | SELECT |
| | | IF(proNum = 0, 1, changeNum/proNum) AS changePer, |
| | | t_p.* |
| | | FROM ( |
| | | SELECT |
| | | b.S_GUID AS sceneId, |
| | | SUM(d.PL_GUID is NOT null) AS proNum, |
| | | SUM(d.PL_IsChanged = TRUE) AS changeNum, |
| | | b.* |
| | | FROM |
| | | sm_t_scense AS b |
| | | LEFT JOIN tm_t_subtask AS a ON a.ST_ScenseID = b.S_GUID |
| | | LEFT JOIN im_t_problemlist AS d ON a.ST_GUID = d.ST_GUID |
| | | WHERE |
| | | a.T_GUID = #{topTaskId} |
| | | <if test="sceneTypeId != null"> |
| | | and b.S_TypeID = #{sceneTypeId} |
| | | </if> |
| | | GROUP BY |
| | | b.S_GUID |
| | | ) as t_p |
| | | <if test="sortBy == 'pro'"> |
| | | <if test="sort == 'asc'"> |
| | | ORDER BY proNum asc, changeNum desc |
| | | </if> |
| | | <if test="sort == 'desc'"> |
| | | ORDER BY proNum desc, changeNum asc |
| | | </if> |
| | | </if> |
| | | <if test="sortBy == 'changePer'"> |
| | | <if test="sort == 'asc'"> |
| | | ORDER BY changePer asc, proNum desc |
| | | </if> |
| | | <if test="sort == 'desc'"> |
| | | ORDER BY changePer desc, proNum asc |
| | | </if> |
| | | </if> |
| | | </select> |
| | | </mapper> |