zhangnaisong
2024-08-06 4dbd2e0a473ef33ecf8a7200f62b61d4dbd87f25
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?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.ruoyi.sy.mapper.ArdTankWallTemporaryMapper">
    
    <resultMap type="ArdTankWallTemporary" id="ArdTankWallTemporaryResult">
        <result property="id"    column="id"    />
        <result property="wallName"    column="wall_name"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
        <result property="distance"    column="distance"    />
        <result property="interval"    column="interval"    />
        <result property="processTime"    column="process_time"    />
        <result property="processMark"    column="process_mark"    />
        <result property="userId"    column="user_id"    />
        <result property="userName"    column="user_name"    />
    </resultMap>
 
    <resultMap type="ArdTankWallTemporary" id="ArdTankWallTemporaryMarkResult">
        <result property="id"    column="id"    />
        <result property="wallName"    column="wall_name"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
        <result property="distance"    column="distance"    />
        <result property="interval"    column="interval"    />
        <result property="processTime"    column="process_time"    />
        <result property="processMark"    column="process_mark"    />
        <result property="userId"    column="user_id"    />
        <result property="userName"    column="user_name"    />
        <result property="mark"    column="mark"    />
    </resultMap>
 
    <sql id="selectArdTankWallTemporaryVo">
        select id, wall_name, longitude, latitude, distance, interval, process_time, process_mark, user_id, user_name from ard_tank_wall_temporary
    </sql>
 
    <select id="selectArdTankWallTemporaryList" parameterType="ArdTankWallTemporary" resultMap="ArdTankWallTemporaryResult">
        <include refid="selectArdTankWallTemporaryVo"/>
        <where>  
            <if test="wallName != null  and wallName != ''"> and wall_name like '%'||#{wallName}||'%'</if>
            <if test="longitude != null "> and longitude = #{longitude}</if>
            <if test="latitude != null "> and latitude = #{latitude}</if>
            <if test="distance != null "> and distance = #{distance}</if>
            <if test="interval != null  and interval != ''"> and interval = #{interval}</if>
            <if test="processTime != null  and processTime != ''"> and process_time = #{processTime}</if>
            <if test="processMark != null  and processMark != ''"> and process_mark = #{processMark}</if>
            <if test="userId != null  and userId != ''"> and user_id = #{userId}</if>
            <if test="userName != null  and userName != ''"> and user_name like '%'||#{userName}||'%'</if>
        </where>
    </select>
    
    <select id="selectArdTankWallTemporaryById" parameterType="String" resultMap="ArdTankWallTemporaryResult">
        <include refid="selectArdTankWallTemporaryVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertArdTankWallTemporary" parameterType="ArdTankWallTemporary">
        insert into ard_tank_wall_temporary
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="wallName != null">wall_name,</if>
            <if test="longitude != null">longitude,</if>
            <if test="latitude != null">latitude,</if>
            <if test="distance != null">distance,</if>
            <if test="interval != null">interval,</if>
            <if test="processTime != null">process_time,</if>
            <if test="processMark != null">process_mark,</if>
            <if test="userId != null">user_id,</if>
            <if test="userName != null">user_name,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="wallName != null">#{wallName},</if>
            <if test="longitude != null">#{longitude},</if>
            <if test="latitude != null">#{latitude},</if>
            <if test="distance != null">#{distance},</if>
            <if test="interval != null">#{interval},</if>
            <if test="processTime != null">#{processTime},</if>
            <if test="processMark != null">#{processMark},</if>
            <if test="userId != null">#{userId},</if>
            <if test="userName != null">#{userName},</if>
         </trim>
    </insert>
 
    <update id="updateArdTankWallTemporary" parameterType="ArdTankWallTemporary">
        update ard_tank_wall_temporary
        <trim prefix="SET" suffixOverrides=",">
            <if test="wallName != null">wall_name = #{wallName},</if>
            <if test="longitude != null">longitude = #{longitude},</if>
            <if test="latitude != null">latitude = #{latitude},</if>
            <if test="distance != null">distance = #{distance},</if>
            <if test="interval != null">interval = #{interval},</if>
            <if test="processTime != null">process_time = #{processTime},</if>
            <if test="processMark != null">process_mark = #{processMark},</if>
            <if test="userId != null">user_id = #{userId},</if>
            <if test="userName != null">user_name = #{userName},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteArdTankWallTemporaryById" parameterType="String">
        delete from ard_tank_wall_temporary where id = #{id}
    </delete>
 
    <delete id="deleteArdTankWallTemporaryByIds" parameterType="String">
        delete from ard_tank_wall_temporary where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <!--<select id="getArdTankWallTemporaryByCarId" parameterType="java.lang.String" resultMap="ArdTankWallTemporaryMarkResult">
        select atwt.*,case process_mark
        when '1'  then 1
        when '0'  then 2
        when '-1' then 3
        end as mark from ard_sy_car "asc"
        inner join ard_tank_lock atl on "asc".car_id = atl.car_id
        inner join ard_tank_wall_lock_temporary atwlt on atl."id" = atwlt.lock_id
        inner join ard_tank_wall_temporary atwt on atwlt.wall_id = atwt."id"
        where "asc".car_id = #{carId} order by mark asc,process_time desc
    </select>-->
 
    <select id="getArdTankWallTemporaryByCarId" parameterType="java.lang.String" resultMap="ArdTankWallTemporaryResult">
        select atwt.* from ard_sy_car "asc"
        inner join ard_tank_lock atl on "asc".car_id = atl.car_id
        inner join ard_tank_wall_lock_temporary atwlt on atl."id" = atwlt.lock_id
        inner join ard_tank_wall_temporary atwt on atwlt.wall_id = atwt."id"
        where "asc".car_id = #{carId} and atwt.process_mark = '1' order by process_time desc
    </select>
 
    <!--<select id="selectArdTankWallTemporaryTotalByCarId" parameterType="java.lang.String" resultType="java.lang.Long">
        select count(distinct atwt.*) from ard_sy_car "asc"
        inner join ard_tank_lock atl on "asc".car_id = atl.car_id
        inner join ard_tank_wall_lock_temporary atwlt on atl."id" = atwlt.lock_id
        inner join ard_tank_wall_temporary atwt on atwlt.wall_id = atwt."id"
        where "asc".car_id = #{carId}
    </select>-->
 
    <select id="selectArdTankWallTemporaryTotalByCarId" parameterType="java.lang.String" resultType="java.lang.Long">
        select count(distinct atwt.*) from ard_sy_car "asc"
        inner join ard_tank_lock atl on "asc".car_id = atl.car_id
        inner join ard_tank_wall_lock_temporary atwlt on atl."id" = atwlt.lock_id
        inner join ard_tank_wall_temporary atwt on atwlt.wall_id = atwt."id"
        where "asc".car_id = #{carId} and atwt.process_mark = '1'
    </select>
 
    <select id="getAliveArdTankWallTemporaryWithCarId" resultType="java.util.Map">
        select distinct atwt."id",atwt.wall_name as "wallName",
        atwt.longitude,atwt.latitude,atwt.distance,atwt."interval",
        atwt.process_time as "processTime",atwt.process_mark as "processMark",
        atwt.user_id as "userId",atwt.user_name as "userName",
        "asy".car_id as "carId" from ard_tank_wall_temporary atwt
        inner join ard_tank_wall_lock_temporary atwlt on atwt."id" = atwlt.wall_id
        inner join ard_tank_lock atl on atwlt.lock_id = atl."id"
        inner join ard_sy_car "asy" on atl.car_id = "asy".car_id
        where atwt.process_mark = '1'
    </select>
</mapper>