<?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.mapper.SelfPatrolTaskMapper">
|
<resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.entity.SelfPatrolTask">
|
<!--
|
WARNING - @mbg.generated
|
-->
|
<id column="SP_GUID" jdbcType="VARCHAR" property="spGuid" />
|
<result column="SP_To_User_Id" jdbcType="VARCHAR" property="spToUserId" />
|
<result column="SP_From_User_Id" jdbcType="VARCHAR" property="spFromUserId" />
|
<result column="SP_Scene_Type_Id" jdbcType="INTEGER" property="spSceneTypeId" />
|
<result column="SP_Ledger_Type_Id" jdbcType="VARCHAR" property="spLedgerTypeId" />
|
<result column="SP_Tag" jdbcType="VARCHAR" property="spTag" />
|
<result column="SP_Publish_Unit" jdbcType="VARCHAR" property="spPublishUnit" />
|
<result column="SP_Task_Year" jdbcType="INTEGER" property="spTaskYear" />
|
<result column="SP_Task_Month" jdbcType="INTEGER" property="spTaskMonth" />
|
<result column="SP_Create_Time" jdbcType="TIMESTAMP" property="spCreateTime" />
|
<result column="SP_Deadline" jdbcType="TIMESTAMP" property="spDeadline" />
|
<result column="SP_Task_Status" jdbcType="INTEGER" property="spTaskStatus" />
|
</resultMap>
|
<sql id="Base_Column_List">
|
<!--
|
WARNING - @mbg.generated
|
-->
|
SP_GUID, SP_To_User_Id, SP_From_User_Id, SP_Scene_Type_Id, SP_Ledger_Type_Id, SP_Tag,
|
SP_Publish_Unit, SP_Task_Year, SP_Task_Month, SP_Create_Time, SP_Deadline, SP_Task_Status
|
</sql>
|
|
<resultMap id="SelfPatrolTaskVo" type="cn.flightfeather.supervision.lightshare.vo.SelfPatrolTaskVo" />
|
<select id="getPublishedTask" resultMap="SelfPatrolTaskVo">
|
SELECT
|
a.SP_GUID AS guid,
|
a.SP_To_User_Id AS toUserId,
|
b.UI_RealName AS toUserName,
|
a.SP_From_User_Id AS fromUserId,
|
c.UI_RealName AS fromUserName,
|
a.SP_Scene_Type_Id AS sceneTypeId,
|
a.SP_Ledger_Type_Id AS ledgerTypeId,
|
a.SP_Tag AS tag,
|
a.SP_Publish_Unit AS publishUnit,
|
a.SP_Create_Time AS createTime,
|
a.SP_Deadline AS deadline,
|
a.SP_Task_Status AS taskStatus,
|
SUM(IF(d.SP_GUID IS NOT NULL, 1, 0)) AS finished
|
FROM
|
ea_t_self_patrol_task AS a
|
LEFT JOIN sm_t_userinfo AS b ON a.SP_To_User_Id = b.UI_GUID
|
LEFT JOIN sm_t_userinfo AS c ON a.SP_From_User_Id = c.UI_GUID
|
LEFT JOIN ea_t_self_patrol_record AS d ON a.SP_GUID = d.SP_GUID
|
WHERE a.SP_From_User_Id = #{userId}
|
<if test="year != null">
|
AND a.SP_Task_Year = #{year}
|
</if>
|
<if test="month != null">
|
AND a.SP_Task_Month = #{month}
|
</if>
|
GROUP BY
|
a.SP_GUID
|
ORDER BY createTime DESC
|
</select>
|
</mapper>
|