2021与蓝度共同重构项目,服务端
liuhaonan
2022-10-14 8c122287a93011af68067dc1cb2e9a86dbdfb86a
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
<?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.AirDataNongGengMapper">
 
    <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.AirDataNongGeng">
            <id property="id" column="id" jdbcType="BIGINT"/>
            <result property="mac" column="mac" jdbcType="VARCHAR"/>
            <result property="noise" column="noise" jdbcType="VARCHAR"/>
            <result property="hydrogenSulfide" column="hydrogen_sulfide" jdbcType="VARCHAR"/>
            <result property="so2" column="so2" jdbcType="VARCHAR"/>
            <result property="no2" column="no2" jdbcType="VARCHAR"/>
            <result property="co" column="co" jdbcType="VARCHAR"/>
            <result property="o3" column="o3" jdbcType="VARCHAR"/>
            <result property="pm2point5" column="pm2point5" jdbcType="VARCHAR"/>
            <result property="pm10" column="pm10" jdbcType="VARCHAR"/>
            <result property="airTemperature" column="air_temperature" jdbcType="VARCHAR"/>
            <result property="airHumidity" column="air_humidity" jdbcType="VARCHAR"/>
            <result property="airPressure" column="air_pressure" jdbcType="VARCHAR"/>
            <result property="windDirection" column="wind_direction" jdbcType="VARCHAR"/>
            <result property="windSpeed" column="wind_speed" jdbcType="VARCHAR"/>
            <result property="tenRainfallMin" column="ten_rainfall_min" jdbcType="VARCHAR"/>
            <result property="radiation" column="radiation" jdbcType="VARCHAR"/>
            <result property="illumination" column="illumination" jdbcType="VARCHAR"/>
            <result property="ultraviolet" column="ultraviolet" jdbcType="VARCHAR"/>
            <result property="co2" column="co2" jdbcType="VARCHAR"/>
            <result property="o2" column="o2" jdbcType="VARCHAR"/>
            <result property="type" column="type" jdbcType="VARCHAR"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
    </resultMap>
 
    <sql id="Base_Column_List">
        id,mac,noise,
        hydrogen_sulfide,so2,no2,
        co,o3,pm2point5,
        pm10,air_temperature,air_humidity,
        air_pressure,wind_direction,wind_speed,
        ten_rainfall_min,radiation,illumination,
        ultraviolet,co2,o2,
        type,create_time
    </sql>
    <select id="listAirId" resultType="java.lang.Long">
        SELECT
        MAX(t1.id) AS air_id
        FROM
        air_data_nong_geng t1
        <if test="keyword != null and keyword != ''">
            LEFT JOIN pole_binding t2 ON t1.mac = t2.device_code
            AND t2.device_type = 11
            LEFT JOIN pole t3 ON t3.id = t2.pole_id
        </if>
        <where>
            <if test="keyword != null and keyword != ''">
                AND t3.pole_name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
            </if>
            <if test="userid != null">
                AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
            </if>
        </where>
        GROUP BY
        t1.mac
    </select>
    <select id="listAirDataByIds" resultType="com.sandu.ximon.dao.bo.AirDataNongGengBo">
        SELECT
        t1.*, t2.pole_id,
        t3.pole_name
        FROM
        air_data_nong_geng t1
        LEFT JOIN pole_binding t2 ON t1.mac = t2.device_code
        AND t2.device_type = 11
        LEFT JOIN pole t3 ON t3.id = t2.pole_id
        <where>
            t1.id IN
            <foreach collection="airIdList" open="(" close=")" item="airId" separator=",">
                #{airId}
            </foreach>
        </where>
    </select>
 
</mapper>