zhangnaisong
2024-07-24 675075c8e140ee0882c5277bd68468fe6194b207
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
<?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.ArdTankLoadLogMapper">
    
    <resultMap type="ArdTankLoadLog" id="ArdTankLoadLogResult">
        <result property="id"    column="id"    />
        <result property="carId"    column="car_id"    />
        <result property="wallId"    column="wall_id"    />
        <result property="beginTime"    column="begin_time"    />
        <result property="endTime"    column="end_time"    />
    </resultMap>
 
    <sql id="selectArdTankLoadLogVo">
        select id, car_id, wall_id, begin_time, end_time from ard_tank_load_log
    </sql>
 
    <select id="selectArdTankLoadLogList" parameterType="ArdTankLoadLog" resultMap="ArdTankLoadLogResult">
        <include refid="selectArdTankLoadLogVo"/>
        <where>  
            <if test="carId != null  and carId != ''"> and car_id = #{carId}</if>
            <if test="wallId != null  and wallId != ''"> and wall_id = #{wallId}</if>
            <if test="beginTime != null  and beginTime != ''"> and begin_time = #{beginTime}</if>
            <if test="endTime != null  and endTime != ''"> and end_time = #{endTime}</if>
        </where>
    </select>
    
    <select id="selectArdTankLoadLogById" parameterType="String" resultMap="ArdTankLoadLogResult">
        <include refid="selectArdTankLoadLogVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertArdTankLoadLog" parameterType="ArdTankLoadLog">
        insert into ard_tank_load_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="carId != null">car_id,</if>
            <if test="wallId != null">wall_id,</if>
            <if test="beginTime != null">begin_time,</if>
            <if test="endTime != null">end_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="carId != null">#{carId},</if>
            <if test="wallId != null">#{wallId},</if>
            <if test="beginTime != null">#{beginTime},</if>
            <if test="endTime != null">#{endTime},</if>
         </trim>
    </insert>
 
    <update id="updateArdTankLoadLog" parameterType="ArdTankLoadLog">
        update ard_tank_load_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="carId != null">car_id = #{carId},</if>
            <if test="wallId != null">wall_id = #{wallId},</if>
            <if test="beginTime != null">begin_time = #{beginTime},</if>
            <if test="endTime != null">end_time = #{endTime},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteArdTankLoadLogById" parameterType="String">
        delete from ard_tank_load_log where id = #{id}
    </delete>
 
    <delete id="deleteArdTankLoadLogByIds" parameterType="String">
        delete from ard_tank_load_log where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <select id="selectArdTankLoadLogByCarIdAndWallIdAndEndTimeIsNull" parameterType="java.lang.String" resultMap="ArdTankLoadLogResult">
        select * from ard_tank_load_log atll where atll.car_id = #{carId} and atll.wall_id = #{wallId}
        and atll.end_time is null
    </select>
 
    <select id="selectArdTankLoadLogByCarIdAndEndTimeIsNull" parameterType="java.lang.String" resultMap="ArdTankLoadLogResult">
        select * from ard_tank_load_log atll where atll.car_id = #{carId} and atll.end_time is null
    </select>
 
    <delete id="deleteArdTankLoadLogByCarId" parameterType="java.lang.String">
        delete from ard_tank_load_log atll where atll.car_id = #{carId}
    </delete>
 
    <select id="selectArdTankLoadLogByCarIdAndEndTimeIsNotNull" parameterType="java.lang.String" resultMap="ArdTankLoadLogResult">
        select * from ard_tank_load_log atll where atll.car_id = #{carId} and atll.end_time is not null
    </select>
 
    <delete id="deleteArdTankLoadLogByEndTime" >
        delete from ard_tank_load_log atll where atll.end_time is not null
    </delete>
</mapper>