2021与蓝度共同重构项目,服务端
liuhaonan
2022-02-14 930f0e76c430a3450144aedac9628b3e9af2ed9d
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
<?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.BroadcastV2TaskTerminalMapper">
 
    <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.BroadcastV2TaskTerminal">
            <result property="taskId" column="task_id" jdbcType="INTEGER"/>
            <result property="terminalId" column="terminal_id" jdbcType="INTEGER"/>
    </resultMap>
 
    <sql id="Base_Column_List">
        id,task_id,terminal_id
    </sql>
 
 
 
    <insert id="insertTask">
        INSERT INTO
            broadcast_v2_task_terminal ( task_id, terminal_id )
        VALUES
            (
                #{taskId}, #{terminalId}
            )
    </insert>
    <!-- <insert id="insertTaskTerminal"
             parameterType="java.util.List&lt;com.sandu.ximon.dao.domain.BroadcastV2TaskTerminal&gt;">
         INSERT INTO
         broadcast_v2_task_terminal ( task_id, terminal_id )
         VALUES
         <foreach collection="list" item="item" index="index" separator=",">
             (
             #{item.taskId}, #{item.terminalId}
             )
         </foreach>
     </insert>-->
 
    <delete id="deleteByTaskId" parameterType="java.lang.Integer">
        delete
        from
        broadcast_v2_task_terminal
        <!-- <if test="_parameter !=null" >
              and task_id=#{taskId,jdbcType=INTEGER}
         </if >-->
        where
        task_id=#{taskId}
    </delete>
 
 
 
 
    <select id="listAll" resultType="com.sandu.ximon.dao.domain.BroadcastTerminalV2Entity">
        SELECT
        a.*, b.pole_name
        FROM
        broadcast_v2_terminal a
        LEFT JOIN pole b ON a.streetlight_id = b.id
        WHERE
        1 = 1
        <if test="terminalName != null and terminalName != ''">
            AND a.terminal_name like '%${terminalName}%'
        </if>
    </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="clientId != null">
                AND t3.client_id = #{clientId}
            </if>
            <if test="bindingState != 2">
                AND t1.bind_states = #{bindingState}
            </if>
        </where>
    </select>
 
</mapper>