<?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.InspectionMapper" >
|
<resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds1.entity.Inspection" >
|
<!--
|
WARNING - @mbg.generated
|
-->
|
<id column="I_GUID" property="guid" jdbcType="VARCHAR" />
|
<result column="ST_GUID" property="stguid" jdbcType="VARCHAR" />
|
<result column="S_GUID" property="sguid" jdbcType="VARCHAR" />
|
<result column="I_ScenseName" property="scensename" jdbcType="VARCHAR" />
|
<result column="I_ScenseAddress" property="scenseaddress" jdbcType="VARCHAR" />
|
<result column="I_IsTogether" property="istogether" jdbcType="BIT" />
|
<result column="I_EntourageT" property="entouraget" jdbcType="VARCHAR" />
|
<result column="I_EntourageWX" property="entouragewx" jdbcType="VARCHAR" />
|
<result column="I_Entourage" property="entourage" jdbcType="VARCHAR" />
|
<result column="I_ExecutionStartTime" property="executionstarttime" jdbcType="TIMESTAMP" />
|
<result column="I_ExecutionEndTime" property="executionendtime" jdbcType="TIMESTAMP" />
|
<result column="I_ProblemCount" property="problemcount" jdbcType="INTEGER" />
|
<result column="I_IsRechecked" property="isrechecked" jdbcType="BIT" />
|
<result column="I_RecheckCount" property="recheckcount" jdbcType="INTEGER" />
|
<result column="I_PromissedNum" property="promissednum" jdbcType="INTEGER" />
|
<result column="I_ChangedNum" property="changednum" jdbcType="INTEGER" />
|
<result column="I_IsChanged" property="ischanged" jdbcType="BIT" />
|
<result column="I_IsRvaluated" property="isrvaluated" jdbcType="BIT" />
|
<result column="I_isPromissed" property="ispromissed" jdbcType="BIT" />
|
<result column="I_PromissedTime" property="promissedtime" jdbcType="TIMESTAMP" />
|
<result column="I_PromissedUserGUID" property="promisseduserguid" jdbcType="VARCHAR" />
|
<result column="I_PromissedUserName" property="promissedusername" jdbcType="VARCHAR" />
|
<result column="I_PromissedUserRealName" property="promisseduserrealname" jdbcType="VARCHAR" />
|
<result column="I_PromissedWay" property="promissedway" jdbcType="VARCHAR" />
|
<result column="I_PromissedDeadline" property="promisseddeadline" jdbcType="TIMESTAMP" />
|
<result column="I_PromissBookPath" property="promissbookpath" jdbcType="VARCHAR" />
|
<result column="I_SignPath" property="signpath" jdbcType="VARCHAR" />
|
<result column="I_Extension1" property="extension1" jdbcType="VARCHAR" />
|
<result column="I_Extension2" property="extension2" jdbcType="VARCHAR" />
|
<result column="I_Extension3" property="extension3" jdbcType="VARCHAR" />
|
<result column="I_Remark" property="remark" jdbcType="VARCHAR" />
|
</resultMap>
|
|
<sql id="Base_Column_List" >
|
<!--
|
WARNING - @mbg.generated
|
-->
|
I_GUID, ST_GUID, S_GUID, I_ScenseName, I_ScenseAddress, I_IsTogether, I_EntourageT,
|
I_EntourageWX, I_Entourage, I_ExecutionStartTime, I_ExecutionEndTime, I_ProblemCount,
|
I_IsRechecked, I_RecheckCount, I_PromissedNum, I_ChangedNum, I_IsChanged, I_IsRvaluated,
|
I_isPromissed, I_PromissedTime, I_PromissedUserGUID, I_PromissedUserName, I_PromissedUserRealName,
|
I_PromissedWay, I_PromissedDeadline, I_PromissBookPath, I_SignPath, I_Extension1,
|
I_Extension2, I_Extension3, I_Remark
|
</sql>
|
|
<resultMap id="InspectionStatisticVo" type="cn.flightfeather.supervision.lightshare.vo.InspectionStatisticVo" >
|
<id column="MOV_DisplayID" property="index" jdbcType="INTEGER" />
|
<result column="S_GUID" property="sceneId" jdbcType="VARCHAR" />
|
<result column="ST_GUID" property="subTaskId" jdbcType="VARCHAR" />
|
<result column="S_Name" property="sceneName" jdbcType="VARCHAR" />
|
<result column="projectType" property="projectType" jdbcType="VARCHAR" />
|
<result column="S_Location" property="location" jdbcType="VARCHAR" />
|
<result column="status" property="status" jdbcType="VARCHAR" />
|
<result column="S_TownName" property="town" jdbcType="VARCHAR" />
|
<result column="E_ResultScoreBef" property="score" jdbcType="VARCHAR" />
|
<result column="rate" property="rate" jdbcType="VARCHAR" />
|
<result column="problems" property="problem" jdbcType="VARCHAR" />
|
</resultMap>
|
|
<resultMap id="InspectionInfoVo" type="cn.flightfeather.supervision.lightshare.vo.InspectionInfoVo" >
|
<id column="inspectionId" property="inspectionId" />
|
<result column="topTaskid" property="topTaskid"/>
|
<result column="topTaskName" property="topTaskName"/>
|
<result column="sceneId" property="sceneId"/>
|
<result column="sceneName" property="sceneName"/>
|
<result column="subtaskId" property="subtaskId"/>
|
<result column="inspected" property="inspected"/>
|
<result column="inspectionTime" property="inspectionTime"/>
|
<result column="inspectionTimes" property="inspectionTimes"/>
|
<result column="promised" property="promised"/>
|
<result column="changed" property="changed"/>
|
<result column="unChangedCount" property="unChangedCount"/>
|
<result column="changedCount" property="changedCount"/>
|
<result column="inspectionTimes" property="inspectionTimes"/>
|
<result column="promisedTime" property="promisedTime"/>
|
</resultMap>
|
|
<select id="getInspectionInfoByScene" resultMap="InspectionInfoVo">
|
SELECT
|
a.T_GUID AS topTaskId,
|
a.T_Name AS topTaskName,
|
b.ST_ScenseID AS sceneId,
|
b.ST_ScenseName AS sceneName,
|
c.I_GUID AS inspectionId,
|
b.ST_GUID AS subtaskId,
|
(CASE WHEN COUNT(DISTINCT c.I_GUID) > 0 THEN TRUE ELSE FALSE END) AS inspected,
|
c.I_ExecutionStartTime AS inspectionTime,
|
COUNT(DISTINCT c.I_GUID) AS inspectionTimes,
|
(CASE WHEN (SUM(CASE WHEN d.PL_Extension1 IS NULL THEN 0 ELSE 1 END)) > 0 THEN TRUE ELSE FALSE END) AS promised,
|
CASE WHEN SUM(d.PL_IsChanged) = COUNT(d.PL_IsChanged) THEN TRUE ELSE FALSE END AS changed,
|
COUNT(CASE WHEN d.PL_IsChanged = 0 AND d.PL_Extension3 = 'pass' THEN 1 ELSE NULL END) AS unChangedCount,
|
COUNT(CASE WHEN d.PL_IsChanged = 1 THEN 1 ELSE NULL END) AS changedCount,
|
d.PL_Extension1 AS promisedTime
|
FROM
|
tm_t_task AS a
|
LEFT JOIN tm_t_subtask AS b ON a.T_GUID = b.T_GUID
|
LEFT JOIN im_t_inspection AS c ON b.ST_GUID = c.ST_GUID
|
LEFT JOIN im_t_problemlist AS d ON c.I_GUID = d.I_GUID
|
WHERE
|
b.ST_ScenseID = #{param1}
|
AND a.T_GUID = #{param2}
|
GROUP BY
|
c.I_GUID
|
ORDER BY
|
c.I_ExecutionStartTime DESC
|
</select>
|
|
<select id="getStatistic" resultMap="InspectionStatisticVo">
|
SELECT e.S_GUID,
|
b.ST_GUID,
|
e.MOV_DisplayID,
|
a.S_Name,
|
a.S_Location,
|
<choose>
|
<when test="param2 == 1">
|
f.CS_Project_Type as projectType,
|
f.CS_Status as status,
|
</when>
|
<when test="param2 == 2">
|
f.W_Project_Type as projectType,
|
f.W_Status as status,
|
</when>
|
<when test="param2 == 3">
|
f.MP_Status as status,
|
</when>
|
<when test="param2 == 14">
|
f.SY_Project_Type as projectType,
|
f.SY_Status as status,
|
</when>
|
</choose>
|
a.S_TownName,
|
c.E_ResultScoreBef,
|
GROUP_CONCAT(CONCAT(d.PL_ProblemName, (IF(d.PL_IsChanged = TRUE, '(已整改)', ''))) SEPARATOR '\n') as problems
|
FROM sm_t_monitorobjectversion as e
|
LEFT JOIN sm_t_scense AS a on e.S_GUID = a.S_GUID
|
LEFT JOIN tm_t_subtask AS b ON a.S_GUID = b.ST_ScenseID
|
LEFT JOIN ea_t_evaluation AS c ON b.ST_GUID = c.ST_GUID
|
LEFT JOIN im_t_problemlist AS d ON b.ST_GUID = d.ST_GUID
|
<choose>
|
<when test="param2 == 1">
|
LEFT JOIN sm_t_scene_construction_site f on a.S_GUID = f.S_GUID
|
</when>
|
<when test="param2 == 2">
|
LEFT JOIN sm_t_scene_wharf f on a.S_GUID = f.S_GUID
|
</when>
|
<when test="param2 == 3">
|
LEFT JOIN sm_t_scene_mixing_plant f on a.S_GUID = f.S_GUID
|
</when>
|
<when test="param2 == 14">
|
LEFT JOIN sm_t_scene_storage_yard f on a.S_GUID = f.S_GUID
|
</when>
|
</choose>
|
|
WHERE e.T_ID = #{param1}
|
and a.S_TypeID = #{param2}
|
AND b.T_GUID = #{param1}
|
GROUP BY e.S_GUID
|
ORDER BY e.MOV_DisplayID;
|
|
|
</select>
|
</mapper>
|