liusuyi
2026-05-06 99ab0d46d30b095d0e1c9d31349f42e0cefc9881
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
<?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.ard.zlm.mapper.ZlmRecordPlanItemMapper">
 
    <resultMap type="ZlmRecordPlanItem" id="ZlmRecordPlanItemResult">
        <result property="id" column="id"/>
        <result property="start" column="start"/>
        <result property="stop" column="stop"/>
        <result property="weekDay" column="week_day"/>
        <result property="planId" column="plan_id"/>
    </resultMap>
 
    <sql id="selectZlmRecordPlanItemVo">
        select id, start, stop, week_day, plan_id
        from zlm_record_plan_item
    </sql>
 
    <select id="selectZlmRecordPlanItemList" parameterType="ZlmRecordPlanItem" resultMap="ZlmRecordPlanItemResult">
        <include refid="selectZlmRecordPlanItemVo"/>
        <where>
            <if test="start != null ">and start = #{start}</if>
            <if test="stop != null ">and stop = #{stop}</if>
            <if test="weekDay != null ">and week_day = #{weekDay}</if>
            <if test="planId != null ">and plan_id = #{planId}</if>
        </where>
    </select>
 
    <select id="selectZlmRecordPlanItemById" parameterType="Long" resultMap="ZlmRecordPlanItemResult">
        <include refid="selectZlmRecordPlanItemVo"/>
        where id = #{id}
    </select>
 
    <select id="getItemList" resultMap="ZlmRecordPlanItemResult"
            parameterType="java.lang.Long">
        <include refid="selectZlmRecordPlanItemVo"/>
        where plan_id = #{planId}
    </select>
 
    <insert id="insertZlmRecordPlanItem" parameterType="ZlmRecordPlanItem" useGeneratedKeys="true" keyProperty="id">
        insert into zlm_record_plan_item
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="start != null">start,</if>
            <if test="stop != null">stop,</if>
            <if test="weekDay != null">week_day,</if>
            <if test="planId != null">plan_id,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="start != null">#{start},</if>
            <if test="stop != null">#{stop},</if>
            <if test="weekDay != null">#{weekDay},</if>
            <if test="planId != null">#{planId},</if>
        </trim>
    </insert>
 
    <insert id="batchAddItem">
        insert into zlm_record_plan_item(start,stop,week_day,plan_id)
        values
        <foreach collection="planItemList" item="item" index="index" separator=",">
            (#{item.start},#{item.stop},#{item.weekDay},#{planId})
        </foreach>
    </insert>
 
    <update id="updateZlmRecordPlanItem" parameterType="ZlmRecordPlanItem">
        update zlm_record_plan_item
        <trim prefix="SET" suffixOverrides=",">
            <if test="start != null">start = #{start},</if>
            <if test="stop != null">stop = #{stop},</if>
            <if test="weekDay != null">week_day = #{weekDay},</if>
            <if test="planId != null">plan_id = #{planId},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteZlmRecordPlanItemById" parameterType="Long">
        delete
        from zlm_record_plan_item
        where id = #{id}
    </delete>
 
    <delete id="deleteZlmRecordPlanItemByIds" parameterType="String">
        delete from zlm_record_plan_item where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <delete id="cleanItems" parameterType="java.lang.Long">
        delete from zlm_record_plan_item where plan_id = #{planId}
    </delete>
</mapper>