<?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.sandu.ximon.dao.mapper.LightTaskMapper">
|
|
<resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.LightTask">
|
<id property="taskId" column="task_id" jdbcType="BIGINT"/>
|
<result property="clientId" column="client_id" jdbcType="BIGINT"/>
|
<result property="userId" column="user_id" jdbcType="BIGINT"/>
|
<result property="taskName" column="task_name" jdbcType="VARCHAR"/>
|
<result property="lightAdress" column="light_adress" jdbcType="VARCHAR"/>
|
<result property="pause" column="pause" jdbcType="TINYINT"/>
|
<result property="week" column="week" jdbcType="TINYINT"/>
|
<result property="openOrder" column="open_order" jdbcType="VARCHAR"/>
|
<result property="closeOrder" column="close_order" jdbcType="VARCHAR"/>
|
<result property="controlOrder" column="control_order" jdbcType="VARCHAR"/>
|
<result property="framePayload" column="frame_payload" jdbcType="VARCHAR"/>
|
<result property="createUser" column="create_user" jdbcType="VARCHAR"/>
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
task_id
|
,client_id,task_name,
|
pause,week,open_order,
|
close_order,control_order,frame_payload,
|
create_user,create_time,update_time
|
</sql>
|
<select id="listLightTask" resultType="com.sandu.ximon.dao.domain.LightTask"
|
parameterType="java.lang.Long">
|
SELECT t1.*
|
FROM light_task t1
|
LEFT JOIN light_task_pole_relation t2 ON t1.task_id = t2.task_id
|
LEFT JOIN pole t3 ON t2.pole_id = t3.id
|
WHERE t2.issue_status = 0
|
<if test="userid != null">
|
AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
|
</if>
|
</select>
|
<select id="listLightTaskByTaskId" resultType="com.sandu.ximon.dao.bo.PoleTaskLightPowerBo"
|
parameterType="java.lang.Long">
|
SELECT
|
t1.id ,
|
t2.task_id,
|
t4.power1,
|
t4.power2
|
FROM
|
pole t1
|
LEFT JOIN light_task_pole_relation t2 ON t1.id = t2.pole_id
|
LEFT JOIN pole_binding t3 ON t3.device_code = t1.device_code
|
LEFT JOIN light t4 ON t4.device_code = t1.device_code
|
WHERE
|
t3.device_type=0
|
<if test=" taskId != null">
|
AND
|
t2.task_id = #{taskId}
|
</if>
|
</select>
|
<select id="successCount" resultType="java.lang.Integer" parameterType="java.lang.Long">
|
SELECT count(*)
|
FROM light_task t1
|
LEFT JOIN light_task_pole_relation t2 ON t1.task_id = t2.task_id
|
WHERE t1.task_id = #{taskId}
|
AND t2.issue_status = 0
|
</select>
|
<select id="toTalCount" resultType="java.lang.Integer">
|
SELECT count(*)
|
FROM light_task t1
|
LEFT JOIN light_task_pole_relation t2 ON t1.task_id = t2.task_id
|
WHERE t1.task_id = #{taskId}
|
</select>
|
<select id="listTask" resultType="com.sandu.ximon.dao.domain.LightTask">
|
SELECT
|
t1.*
|
FROM
|
light_task t1
|
LEFT JOIN light_task_pole_relation t2 ON t1.task_id = t2.task_id
|
LEFT JOIN pole t3 ON t3.id = t2.pole_id
|
LEFT JOIN pole_binding t4 ON t3.id = t4.pole_id
|
LEFT JOIN light t5 ON t5.device_code = t4.device_code
|
WHERE
|
1=1
|
<if test="keyword != null and keyword != ''">
|
AND ( t1.task_name LIKE CONCAT(CONCAT('%', #{keyword}), '%') OR t5.device_code LIKE CONCAT(CONCAT('%',
|
#{keyword}), '%'))
|
</if>
|
<if test="userId != null">
|
AND ( t1.client_id =#{userId} OR t1.user_id =#{userId} )
|
</if>
|
GROUP BY
|
task_id
|
ORDER BY
|
t1.${orderBy}
|
</select>
|
</mapper>
|