2021与蓝度共同重构项目,服务端
liuhaonan
2022-11-04 e55c8b0a92eb9715edd90c31dfd4de51a47b588b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?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.PoleLightemitEntityMapper">
 
    <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.PoleLightemitEntity">
        <id property="lightemitId" column="lightemit_id" jdbcType="BIGINT"/>
        <result property="lightemitName" column="lightemit_name" jdbcType="VARCHAR"/>
        <result property="lightemitControlCode" column="lightemit_control_code" jdbcType="VARCHAR"/>
        <result property="url" column="url" jdbcType="VARCHAR"/>
        <result property="playTime" column="play_time" jdbcType="INTEGER"/>
        <result property="addTime" column="add_time" jdbcType="TIMESTAMP"/>
        <result property="requestBody" column="request_body" jdbcType="VARCHAR"/>
        <result property="playerSetting" column="player_setting" jdbcType="TINYINT"/>
        <result property="status" column="status" jdbcType="TINYINT"/>
        <result property="remark" column="remark" jdbcType="VARCHAR"/>
        <result property="createUserId" column="create_user_id" jdbcType="BIGINT"/>
        <result property="clientId" column="client_id" jdbcType="BIGINT"/>
        <result property="userId" column="user_id" jdbcType="BIGINT"/>
        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
    </resultMap>
 
    <sql id="Base_Column_List">
        lightemit_id
        ,lightemit_name,lightemit_control_code,
        url,play_time,add_time,
        request_body,player_setting,status,
        remark,create_user_id,create_time
    </sql>
 
    <update id="updateRequestBody">
        UPDATE pole_lightemit
        SET request_body = #{postBody}
        WHERE lightemit_control_code = #{ledCode}
    </update>
 
    <select id="listLed" resultType="com.sandu.ximon.dao.domain.PoleLightemitEntity">
        SELECT
        t1.*, t2.pole_id as streetlight_id,
        t3.pole_name as streetlight_name, t3.id
        FROM
        pole_lightemit t1
        LEFT JOIN pole_binding t2 ON t1.lightemit_control_code = t2.device_code
        AND t2.device_type = 10
        LEFT JOIN pole t3 ON t3.id = t2.pole_id
        <where>
            <if test="keyword != null and keyword != ''">
                AND (t1.lightemit_name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
                OR t1.lightemit_control_code LIKE CONCAT(CONCAT('%', #{keyword}), '%')
                OR t1.lightemit_id LIKE CONCAT(CONCAT('%', #{keyword}), '%'))
            </if>
            <if test="userid != null">
                AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
            </if>
        </where>
        <if test="orderBy != null">
            ORDER BY ${orderBy}
        </if>
    </select>
    <select id="getpole" resultType="com.sandu.ximon.dao.domain.Pole" parameterType="java.lang.String">
        SELECT
        t1.*
        FROM
        pole t1
        LEFT JOIN pole_binding t2 ON t1.id = t2.pole_id
        LEFT JOIN pole_lightemit t3 ON t2.device_code = t3.lightemit_control_code
        WHERE
        t2.device_type = 10
        <if test="lightemitControlCode != null">
            AND t3.lightemit_control_code = #{lightemitControlCode}
        </if>
    </select>
    <select id="listLedOnBinding" resultType="com.sandu.ximon.dao.domain.PoleLightemitEntity">
        SELECT
        t1.*, t2.pole_id as streetlight_id,
        t3.pole_name as streetlight_name, t3.id
        FROM
        pole_lightemit t1
        LEFT JOIN pole_binding t2 ON t1.lightemit_control_code = t2.device_code
        AND t2.device_type = 10
        LEFT JOIN pole t3 ON t3.id = t2.pole_id
        <where>
            <if test="keyword != null and keyword != ''">
                AND (t1.lightemit_name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
                OR t1.lightemit_control_code LIKE CONCAT(CONCAT('%', #{keyword}), '%'))
            </if>
            <if test="userid != null">
                AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
            </if>
        </where>
    </select>
</mapper>