2021与蓝度共同重构项目,服务端
liuhaonan
2022-11-18 385b687cc1a0a8f6de2320af6b6e0d654cd658ed
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
<?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.NewNovaLedMapper">
 
    <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.NewNovaLed">
        <id property="id" column="id" jdbcType="BIGINT"/>
        <result property="name" column="name" jdbcType="VARCHAR"/>
        <result property="sn" column="sn" jdbcType="VARCHAR"/>
        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
        <result property="onlineSign" column="online_sign" jdbcType="VARCHAR"/>
        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
    </resultMap>
 
    <sql id="Base_Column_List">
        id
        ,name,player_name,
        player_id,sn,create_time,
        resolution,update_time
    </sql>
    <select id="listLed" resultType="com.sandu.ximon.dao.domain.NewNovaLed">
        SELECT
        t1.*,
        t3.id AS pole_id,
        t3.pole_name
        FROM
        new_nova_led t1
        LEFT JOIN pole_binding t2 ON t1.sn = t2.device_code
        AND t2.device_type = 12
        LEFT JOIN pole t3 ON t2.pole_id = t3.id
        LEFT JOIN new_nova_group_relation t4 ON t4.nova_id = t1.id
        LEFT JOIN new_nova_group t5 ON t5.group_id = t4.nova_group_id
        <where>
            1=1
            <if test="groupId != null">
                AND t5.group_id=#{groupId}
            </if>
            <if test="keyword != null and keyword != ''">
                AND (t1.name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
                OR t1.sn LIKE CONCAT(CONCAT('%', #{keyword}), '%'))
            </if>
            <if test="userId != null">
                AND (t3.user_id = #{userId} OR t3.client_id = #{userId})
            </if>
        </where>
        GROUP BY t1.id
    </select>
    <select id="getListByGroupId" resultType="com.sandu.ximon.dao.bo.NewNovaGroupListBo">
        SELECT
        t1.*
        FROM
        new_nova_led t1
        INNER JOIN new_nova_group_relation t2 ON t1.id = t2.nova_id
        LEFT JOIN new_nova_group t3 ON t3.group_id = t2.nova_group_id
        WHERE
        t3.group_id=#{groupId}
        <if test="clientId != null">
            AND (t3.user_id = #{clientId} OR t3.client_id = #{clientId})
        </if>
    </select>
</mapper>