陈昶聿
9 天以前 af6c73841b54f0c9002ce85b8c0d1679e25d5d7c
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<?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.smartor.mapper.ServiceTaskScheduleDetailMapper">
 
    <resultMap type="com.smartor.domain.ServiceTaskScheduleDetail" id="ServiceTaskScheduleDetailResult">
        <id property="id" column="id"/>
        <result property="taskid" column="taskid"/>
        <result property="scheduleid" column="scheduleid"/>
        <result property="seq" column="seq"/>
        <result property="dayOffset" column="day_offset"/>
        <result property="templateid" column="templateid"/>
        <result property="libtemplateid" column="libtemplateid"/>
        <result property="templatename" column="templatename"/>
        <result property="content" column="content"/>
        <result property="nextExecuteTime" column="next_execute_time"/>
        <result property="remark" column="remark"/>
        <result property="delFlag" column="del_flag"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="orgid" column="orgid"/>
        <result property="campusid" column="campusid"/>
    </resultMap>
 
    <sql id="selectServiceTaskScheduleDetailVo">
        select id,
               taskid,
               scheduleid,
               seq,
               day_offset,
               templateid,
               libtemplateid,
               templatename,
               content,
               next_execute_time,
               remark,
               del_flag,
               create_by,
               create_time,
               update_by,
               update_time,
               orgid,
               campusid
        from service_task_schedule_detail
    </sql>
 
    <select id="selectServiceTaskScheduleDetailById" parameterType="Long"
            resultMap="ServiceTaskScheduleDetailResult">
        <include refid="selectServiceTaskScheduleDetailVo"/>
        where id = #{id} and del_flag = '0'
    </select>
 
    <select id="selectServiceTaskScheduleDetailList"
            parameterType="com.smartor.domain.ServiceTaskScheduleDetail"
            resultMap="ServiceTaskScheduleDetailResult">
        <include refid="selectServiceTaskScheduleDetailVo"/>
        where del_flag = '0'
        <if test="taskid != null">and taskid = #{taskid}</if>
        <if test="scheduleid != null">and scheduleid = #{scheduleid}</if>
        <if test="seq != null">and seq = #{seq}</if>
        <if test="templateid != null">and templateid = #{templateid}</if>
        order by seq asc
    </select>
 
    <select id="selectByScheduleid" resultMap="ServiceTaskScheduleDetailResult">
        <include refid="selectServiceTaskScheduleDetailVo"/>
        where scheduleid = #{scheduleid} and del_flag = '0'
        order by seq asc
    </select>
 
    <select id="selectByTaskid" resultMap="ServiceTaskScheduleDetailResult">
        <include refid="selectServiceTaskScheduleDetailVo"/>
        where taskid = #{taskid} and del_flag = '0'
        order by seq asc
    </select>
 
    <insert id="insertServiceTaskScheduleDetail" parameterType="com.smartor.domain.ServiceTaskScheduleDetail"
            useGeneratedKeys="true" keyProperty="id">
        insert into service_task_schedule_detail
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="taskid != null">taskid,</if>
            <if test="scheduleid != null">scheduleid,</if>
            <if test="seq != null">seq,</if>
            <if test="dayOffset != null">day_offset,</if>
            <if test="templateid != null">templateid,</if>
            <if test="libtemplateid != null">libtemplateid,</if>
            <if test="templatename != null">templatename,</if>
            <if test="content != null">content,</if>
            <if test="nextExecuteTime != null">next_execute_time,</if>
            <if test="remark != null">remark,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="orgid != null">orgid,</if>
            <if test="campusid != null">campusid,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskid != null">#{taskid},</if>
            <if test="scheduleid != null">#{scheduleid},</if>
            <if test="seq != null">#{seq},</if>
            <if test="dayOffset != null">#{dayOffset},</if>
            <if test="templateid != null">#{templateid},</if>
            <if test="libtemplateid != null">#{libtemplateid},</if>
            <if test="templatename != null">#{templatename},</if>
            <if test="content != null">#{content},</if>
            <if test="nextExecuteTime != null">#{nextExecuteTime},</if>
            <if test="remark != null">#{remark},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="orgid != null">#{orgid},</if>
            <if test="campusid != null">#{campusid},</if>
        </trim>
    </insert>
 
    <insert id="batchInsertServiceTaskScheduleDetail" useGeneratedKeys="true" keyProperty="id">
        insert into service_task_schedule_detail
        (taskid, scheduleid, seq, day_offset, templateid, libtemplateid, templatename, content,
         next_execute_time, remark, del_flag, create_by, create_time, update_by, update_time, orgid, campusid)
        values
        <foreach collection="list" item="item" separator=",">
            (#{item.taskid}, #{item.scheduleid}, #{item.seq}, #{item.dayOffset},
             #{item.templateid}, #{item.libtemplateid}, #{item.templatename}, #{item.content},
             #{item.nextExecuteTime}, #{item.remark},
             <choose>
                 <when test="item.delFlag != null">#{item.delFlag}</when>
                 <otherwise>'0'</otherwise>
             </choose>,
             #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime},
             #{item.orgid}, #{item.campusid})
        </foreach>
    </insert>
 
    <update id="updateServiceTaskScheduleDetail" parameterType="com.smartor.domain.ServiceTaskScheduleDetail">
        update service_task_schedule_detail
        <trim prefix="SET" suffixOverrides=",">
            <if test="taskid != null">taskid = #{taskid},</if>
            <if test="scheduleid != null">scheduleid = #{scheduleid},</if>
            <if test="seq != null">seq = #{seq},</if>
            <if test="dayOffset != null">day_offset = #{dayOffset},</if>
            <if test="templateid != null">templateid = #{templateid},</if>
            <if test="libtemplateid != null">libtemplateid = #{libtemplateid},</if>
            <if test="templatename != null">templatename = #{templatename},</if>
            <if test="content != null">content = #{content},</if>
            <if test="nextExecuteTime != null">next_execute_time = #{nextExecuteTime},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="orgid != null">orgid = #{orgid},</if>
            <if test="campusid != null">campusid = #{campusid},</if>
        </trim>
        where id = #{id}
    </update>
 
    <update id="deleteServiceTaskScheduleDetailById" parameterType="Long">
        update service_task_schedule_detail
        set del_flag = '1',
            update_time = now()
        where id = #{id}
    </update>
 
    <update id="deleteByScheduleid">
        update service_task_schedule_detail
        set del_flag = '1',
            update_time = now()
        where scheduleid = #{scheduleid}
          and del_flag = '0'
    </update>
 
    <update id="deleteByTaskid">
        update service_task_schedule_detail
        set del_flag = '1',
            update_time = now()
        where taskid = #{taskid}
          and del_flag = '0'
    </update>
 
</mapper>