liusuyi
2024-10-10 38f29e38fcc668171dc05c53d40a36b895c86102
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
<?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.ArdSyCarDayMapper">
    
    <resultMap type="ArdSyCarDay" id="ArdSyCarDayResult">
        <result property="id"    column="id"    />
        <result property="carId"    column="car_id"    />
        <result property="day"    column="day"    />
        <result property="firstTime"    column="first_time"    />
        <result property="endTime"    column="end_time"    />
    </resultMap>
 
    <sql id="selectArdSyCarDayVo">
        select id, car_id, day, first_time, end_time from ard_sy_car_day
    </sql>
 
    <select id="selectArdSyCarDayList" parameterType="ArdSyCarDay" resultMap="ArdSyCarDayResult">
        <include refid="selectArdSyCarDayVo"/>
        <where>  
            <if test="carId != null  and carId != ''"> and car_id = #{carId}</if>
            <if test="day != null  and day != ''"> and day = #{day}</if>
            <if test="firstTime != null  and firstTime != ''"> and first_time = #{firstTime}</if>
            <if test="endTime != null  and endTime != ''"> and end_time = #{endTime}</if>
        </where>
    </select>
    
    <select id="selectArdSyCarDayById" parameterType="String" resultMap="ArdSyCarDayResult">
        <include refid="selectArdSyCarDayVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertArdSyCarDay" parameterType="ArdSyCarDay">
        insert into ard_sy_car_day
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="carId != null">car_id,</if>
            <if test="day != null">day,</if>
            <if test="firstTime != null">first_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="day != null">#{day},</if>
            <if test="firstTime != null">#{firstTime},</if>
            <if test="endTime != null">#{endTime},</if>
         </trim>
    </insert>
 
    <update id="updateArdSyCarDay" parameterType="ArdSyCarDay">
        update ard_sy_car_day
        <trim prefix="SET" suffixOverrides=",">
            <if test="carId != null">car_id = #{carId},</if>
            <if test="day != null">day = #{day},</if>
            <if test="firstTime != null">first_time = #{firstTime},</if>
            <if test="endTime != null">end_time = #{endTime},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteArdSyCarDayById" parameterType="String">
        delete from ard_sy_car_day where id = #{id}
    </delete>
 
    <delete id="deleteArdSyCarDayByIds" parameterType="String">
        delete from ard_sy_car_day where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <update id="updateArdSyCarDayByCarIdAndDay" parameterType="java.lang.String">
        update ard_sy_car_day set end_time = #{endTime} where car_id = #{carId} and day = #{day}
    </update>
 
    <select id="selectArdSyCarDayByCarIdAndDay" parameterType="java.lang.String" resultMap="ArdSyCarDayResult">
        select * from ard_sy_car_day ascd
        where ascd.car_id = #{carId} and ascd.day like #{day}
        order by ascd.day desc
    </select>
</mapper>