2021与蓝度共同重构项目,服务端
liuhaonan
2022-10-24 7a00187d197548e23a38dcb87187ef6b2b7f8bfb
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
<?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.LightPoleHeelingMapper">
 
    <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.LightPoleHeeling">
        <id property="warningNumber" column="warning_number" jdbcType="BIGINT"/>
        <result property="mac" column="mac" jdbcType="VARCHAR"/>
        <result property="warningLevel" column="warning_level" jdbcType="INTEGER"/>
        <result property="theXAxis" column="the_x_axis" jdbcType="DOUBLE"/>
        <result property="theYAxis" column="the_y_axis" jdbcType="DOUBLE"/>
        <result property="theZAxis" column="the_z_axis" jdbcType="DOUBLE"/>
        <result property="processingState" column="processing_state" jdbcType="INTEGER"/>
        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
    </resultMap>
 
    <sql id="Base_Column_List">
        warning_number,mac,warning_level,
        the_x_axis,the_y_axis,the_z_axis,
        processing_state,create_time
    </sql>
 
    <select id="listLightPoleHeeling" resultType="com.sandu.ximon.dao.domain.LightPoleHeeling">
        SELECT t1.*, t3.pole_code,
        t3.pole_name
        FROM light_pole_heeling t1
        LEFT JOIN pole_binding t2 ON t1.mac = t2.device_code
        AND t2.device_type = 8
        LEFT JOIN pole t3 ON t3.id = t2.pole_id
        <where>
            (t1.warning_level = 1 OR t1.warning_level = 2)
            <if test="keyword != null and keyword != ''">
                AND (t1.warning_number LIKE CONCAT(CONCAT('%', #{keyword}), '%') OR (t3.pole_name LIKE
                CONCAT(CONCAT('%', #{keyword}), '%'))OR (t3.pole_code LIKE CONCAT(CONCAT('%', #{keyword}), '%')))
            </if>
            <if test="processingState != null and processingState != 2">
                AND t1.processing_state = #{processingState}
            </if>
            <if test="userid != null">
                AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
            </if>
        </where>
    </select>
 
    <select id="lightPoleHeelingDetail" resultType="com.sandu.ximon.dao.domain.LightPoleHeeling">
        SELECT t1.*, t3.pole_code,
        t3.pole_name
        FROM light_pole_heeling t1
        LEFT JOIN pole_binding t2 ON t1.mac = t2.device_code
        AND t2.device_type = 8
        LEFT JOIN pole t3 ON t3.id = t2.pole_id
        <where>
            (t1.warning_level = 1 OR t1.warning_level = 2)
            AND
            (t1.processing_state = 0)
            <if test="warningNumber != null">
                AND t1.warning_number = #{warningNumber}
            </if>
            <if test="userId != null">
                AND (t3.user_id = #{userId} OR t3.client_id = #{userId})
            </if>
        </where>
 
    </select>
</mapper>