<?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.sinata.system.mapper.MwProtectionTaskMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.sinata.system.domain.MwProtectionTask">
|
<id column="ID" property="id" />
|
<result column="DEL_FLAG" property="delFlag" />
|
<result column="CREATE_BY" property="createBy" />
|
<result column="CREATE_TIME" property="createTime" />
|
<result column="UPDATE_BY" property="updateBy" />
|
<result column="UPDATE_TIME" property="updateTime" />
|
<result column="DEPARTMENT_ID" property="departmentId" />
|
<result column="PROTECTIVE_WORK_TYPE" property="protectiveWorkType" />
|
<result column="PROTECTIVE_WORK_TYPE_STR" property="protectiveWorkTypeStr" />
|
<result column="TASK_NAME" property="taskName" />
|
<result column="ATTACHMENT" property="attachment" />
|
<result column="REMARK" property="remark" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
DEL_FLAG,
|
CREATE_BY,
|
CREATE_TIME,
|
UPDATE_BY,
|
UPDATE_TIME,
|
ID, DEPARTMENT_ID, PROTECTIVE_WORK_TYPE, PROTECTIVE_WORK_TYPE_STR, TASK_NAME, ATTACHMENT, REMARK
|
</sql>
|
<select id="pageList" resultType="com.sinata.system.domain.vo.MwProtectionTaskVO">
|
SELECT MPT.ID,
|
MPT.DEPARTMENT_ID,
|
MPT.PROTECTIVE_WORK_TYPE,
|
MPT.PROTECTIVE_WORK_TYPE_STR,
|
MPT.TASK_NAME,
|
MPT.REMARK,
|
MPT.CREATE_TIME,
|
SD.DEPARTMENT_NAME,
|
WM_CONCAT(MA.FILE_NAME) AS fileName,
|
MPT.RELATION
|
FROM MW_PROTECTION_TASK MPT
|
LEFT JOIN SYS_DEPARTMENT SD ON MPT.DEPARTMENT_ID = SD.ID
|
LEFT JOIN (SELECT * FROM MW_ATTACHMENT WHERE "TYPE" = 2) MA ON MA.TARGET_ID = MPT.ID
|
<where>
|
MPT.DEL_FLAG = 0
|
<if test="treeCode != null and treeCode != ''">
|
AND SD.TREE_CODE LIKE CONCAT(#{treeCode},'%')
|
</if>
|
<if test="query.protectiveWorkType != null">
|
AND MPT.PROTECTIVE_WORK_TYPE = #{query.protectiveWorkType}
|
</if>
|
<if test="query.taskName !=null and query.taskName !=''">
|
AND MPT.TASK_NAME LIKE CONCAT('%',#{query.taskName},'%')
|
</if>
|
<if test="query.startTime != null and query.endTime != null">
|
AND MPT.CREATE_TIME BETWEEN #{query.startTime} AND #{query.endTime}
|
</if>
|
</where>
|
GROUP BY MA.TARGET_ID
|
ORDER BY MPT.CREATE_TIME DESC
|
</select>
|
|
</mapper>
|