<?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.IPBroadcastMapper">
|
|
<resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.BroadcastTerminalV2Entity">
|
<id property="id" column="id" jdbcType="INTEGER"/>
|
<result property="terminalName" column="terminal_name" jdbcType="VARCHAR"/>
|
<result property="streetlightId" column="streetlight_id" jdbcType="BIGINT"/>
|
<result property="bindStates" column="bind_states" jdbcType="INTEGER"/>
|
<result property="exist" column="exist" jdbcType="INTEGER"/>
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
id
|
,terminal_name,streetlight_id,
|
bind_states,exist
|
</sql>
|
|
<select id="listAll" resultType="com.sandu.ximon.dao.domain.BroadcastTerminalV2Entity">
|
SELECT
|
t1.*, t3.pole_name
|
FROM
|
broadcast_v2_terminal t1
|
LEFT JOIN pole_binding t2 ON t1.id = t2.device_code
|
AND t2.device_type = 5
|
LEFT JOIN pole t3 ON t3.id = t2.pole_id
|
</select>
|
|
<select id="getBroadcastTerminalList" resultType="com.sandu.ximon.dao.bo.BroadcastTerminalV2EntityBo">
|
SELECT
|
t1.*, t2.pole_id,
|
t3.pole_name
|
FROM
|
broadcast_v2_terminal t1
|
LEFT JOIN pole_binding t2 ON t1.id = t2.device_code
|
AND t2.device_type = 5
|
LEFT JOIN pole t3 ON t3.id = t2.pole_id
|
<where>
|
<if test="keyword != null and keyword != ''">
|
AND (t3.pole_name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
|
OR t1.terminal_name LIKE CONCAT(CONCAT('%', #{keyword}), '%'))
|
</if>
|
<if test="userid != null">
|
AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
|
</if>
|
<if test="bindingState != 2">
|
AND t1.bind_states = #{bindingState}
|
</if>
|
</where>
|
</select>
|
|
<select id="getListTerminalOnBind" resultType="com.sandu.ximon.dao.bo.BroadcastTerminalV2EntityBo">
|
SELECT
|
t1.*, t2.pole_id,
|
t3.pole_name
|
FROM
|
broadcast_v2_terminal t1
|
LEFT JOIN pole_binding t2 ON t1.id = t2.device_code
|
AND t2.device_type = 5
|
LEFT JOIN pole t3 ON t3.id = t2.pole_id
|
<where>
|
<if test="keyword != null and keyword != ''">
|
AND (t1.id LIKE CONCAT(CONCAT('%', #{keyword}), '%')
|
OR t1.terminal_name LIKE CONCAT(CONCAT('%', #{keyword}), '%'))
|
</if>
|
<if test="userid != null">
|
AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
|
</if>
|
</where>
|
|
|
</select>
|
|
</mapper>
|