<?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.LedPlayerEntityMapper">
|
|
<resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.LedPlayerEntity">
|
<id property="id" column="id" jdbcType="BIGINT"/>
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
<result property="playerName" column="player_name" jdbcType="VARCHAR"/>
|
<result property="playerId" column="player_id" jdbcType="VARCHAR"/>
|
<result property="sn" column="sn" jdbcType="VARCHAR"/>
|
<result property="resolution" column="resolution" jdbcType="VARCHAR"/>
|
<result property="createTimestamp" column="create_timestamp" jdbcType="BIGINT"/>
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
id
|
,player_name,player_id,
|
sn,create_timestamp
|
</sql>
|
<insert id="saveLed" parameterType="com.sandu.ximon.dao.domain.LedPlayerEntity">
|
insert into led (player_name, player_id, sn, create_timestamp)
|
values (#{playerName}, #{playerId}, #{sn}, #{createTimestamp})
|
</insert>
|
|
<select id="ledPlayerEntityList" resultType="com.sandu.ximon.dao.domain.LedPlayerEntity">
|
SELECT
|
t1.*, t2.pole_id,
|
t3.pole_name
|
FROM
|
led t1
|
LEFT JOIN pole_binding t2 ON t1.sn = t2.device_code
|
AND t2.device_type = 1
|
LEFT JOIN pole t3 ON t3.id = t2.pole_id
|
<where>
|
<if test="keyword != null and keyword != ''">
|
AND t1.name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
|
OR t1.sn LIKE CONCAT(CONCAT('%', #{keyword}), '%')
|
OR t1.id LIKE CONCAT(CONCAT('%', #{keyword}), '%')
|
</if>
|
<if test="userid != null">
|
AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
|
</if>
|
</where>
|
</select>
|
|
<select id="ledPlayerEntityListOnBinding" resultType="com.sandu.ximon.dao.domain.LedPlayerEntity">
|
SELECT
|
t1.*, t2.pole_id,
|
t3.pole_name, t3.id
|
FROM
|
led t1
|
LEFT JOIN pole_binding t2 ON t1.sn = t2.device_code
|
AND t2.device_type = 1
|
LEFT JOIN pole t3 ON t3.id = t2.pole_id
|
<where>
|
<if test="keyword != null and keyword != ''">
|
AND t1.name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
|
OR t1.player_name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
|
OR t1.sn LIKE CONCAT(CONCAT('%', #{keyword}), '%')
|
OR t1.id LIKE CONCAT(CONCAT('%', #{keyword}), '%')
|
</if>
|
<if test="userid != null">
|
AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
|
</if>
|
</where>
|
</select>
|
|
</mapper>
|