liusheng
6 天以前 cc479e6a056785103996cc7ea67dbd5faa3e800e
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
<?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.inhospvisit.mapper.VisitPreachformMapper">
 
    <!--
      ============================================================================
      出入院随访模块自带的 service_subtask_preachform 读写。
      ============================================================================
      与 smartor 的 mapper/smartor/ServiceSubtaskPreachformMapper.xml 等价:
        · selectList ← selectServiceSubtaskPreachformList(原 XML L44-73)
        · insert     ← insertServiceSubtaskPreachform(原 XML L81-151,useGeneratedKeys)
      原 XML 用 <sql id="selectServiceSubtaskPreachformVo"> 共享片段;这里【显式列出同一批列】,
      不复制片段(与 VisitInhospMapper 同一做法:自包含、便于逐条比对)。
      ============================================================================
    -->
 
    <resultMap type="com.ruoyi.common.core.service.dto.VisitPreachformRow" id="VisitPreachformRowResult">
        <result property="id" column="id"/>
        <result property="subid" column="subid"/>
        <result property="taskid" column="taskid"/>
        <result property="preachform" column="preachform"/>
        <result property="sendstate" column="sendstate"/>
        <result property="currentSendTime" column="current_send_time"/>
        <result property="remark" column="remark"/>
        <result property="orgid" column="orgid"/>
        <result property="delFlag" column="del_flag"/>
        <result property="createTime" column="create_time"/>
        <result property="createBy" column="create_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="compensateTime" column="compensate_time"/>
        <result property="sort" column="sort"/>
    </resultMap>
 
    <!-- 条件与顺序逐条对齐原 XML L44-73 -->
    <select id="selectList" parameterType="com.ruoyi.common.core.service.dto.VisitPreachformRow"
            resultMap="VisitPreachformRowResult">
        select id,
               subid,
               taskid,
               preachform,
               sendstate,
               current_send_time,
               remark,
               orgid,
               del_flag,
               create_time,
               create_by,
               update_time,
               update_by,
               compensate_time,
               sort
        from service_subtask_preachform
        where 1=1
        and del_flag = 0
        <if test="subid != null ">
            and subid = #{subid}
        </if>
        <if test="taskid != null ">
            and taskid = #{taskid}
        </if>
        <if test="currentSendTime != null ">
            and current_send_time = #{currentSendTime}
        </if>
        <if test="preachform != null  and preachform != ''">
            and preachform = #{preachform}
        </if>
        <if test="sendstate != null  and sendstate != ''">
            and sendstate = #{sendstate}
        </if>
        <if test="orgid != null  and orgid != ''">
            and orgid = #{orgid}
        </if>
        <if test="sort != null ">
            and sort = #{sort}
        </if>
        <if test="compensateTime != null ">
            and compensate_time = #{compensateTime}
        </if>
    </select>
 
    <!-- 列与顺序逐条对齐原 XML L81-151 -->
    <insert id="insert" parameterType="com.ruoyi.common.core.service.dto.VisitPreachformRow"
            useGeneratedKeys="true" keyProperty="id">
        insert into service_subtask_preachform
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="subid != null">subid,</if>
            <if test="taskid != null">taskid,</if>
            <if test="preachform != null">preachform,</if>
            <if test="sendstate != null">sendstate,</if>
            <if test="remark != null">remark,</if>
            <if test="orgid != null">orgid,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="sort != null">sort,</if>
            <if test="compensateTime != null">compensate_time,</if>
            <if test="currentSendTime != null ">current_send_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="subid != null">#{subid},</if>
            <if test="taskid != null">#{taskid},</if>
            <if test="preachform != null">#{preachform},</if>
            <if test="sendstate != null">#{sendstate},</if>
            <if test="remark != null">#{remark},</if>
            <if test="orgid != null">#{orgid},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="sort != null">#{sort},</if>
            <if test="compensateTime != null">#{compensateTime},</if>
            <if test="currentSendTime != null ">#{currentSendTime},</if>
        </trim>
    </insert>
 
    <!--
      ============================================================================
      跨模块 SQL 收口补齐的 7 个 statement(照抄 smartor 原 XML,条件/列/顺序不变)
        · selectById             ← selectServiceSubtaskPreachformById
        · selectByTaskidAndOrgid ← selectBySubtask(原按 taskid + orgid,非主键)
        · updateById             ← updateServiceSubtaskPreachform(where id = #{id})
        · updateByCondition      ← updateSSPByCondition(SET 同 updateById,WHERE 按条件且无 id)
        · softDeleteById         ← deleteServiceSubtaskPreachformById(update 置 del_flag=1)
        · softDeleteByIds        ← deleteServiceSubtaskPreachformByIds(同上,in 集合)
        · softDeleteBySubid      ← deleteServiceSubtaskPreachformBySubid(同上,按 subid)
      注意:三个 delete* 在原 XML 里就是"软删"(update set del_flag=1),此处原样保留;
            其中 BySubid 原本用的就是 <delete> 标签,也照抄。
      ============================================================================
    -->
 
    <select id="selectById" parameterType="Long" resultMap="VisitPreachformRowResult">
        select id,
               subid,
               taskid,
               preachform,
               sendstate,
               current_send_time,
               remark,
               orgid,
               del_flag,
               create_time,
               create_by,
               update_time,
               update_by,
               compensate_time,
               sort
        from service_subtask_preachform
        where id = #{id}
    </select>
 
    <!-- 原 selectBySubtask:del_flag=0 + 可选 taskid/orgid(原参数是 ServiceSubtask,实际只用这两个字段) -->
    <select id="selectByTaskidAndOrgid" resultMap="VisitPreachformRowResult">
        select id,
               subid,
               taskid,
               preachform,
               sendstate,
               current_send_time,
               remark,
               orgid,
               del_flag,
               create_time,
               create_by,
               update_time,
               update_by,
               compensate_time,
               sort
        from service_subtask_preachform
        WHERE del_flag = 0
        <if test="taskid != null">
            AND taskid = #{taskid}
        </if>
        <if test="orgid != null and orgid != ''">
            AND orgid = #{orgid}
        </if>
    </select>
 
    <!-- 原 updateServiceSubtaskPreachform:where id = #{id} -->
    <update id="updateById" parameterType="com.ruoyi.common.core.service.dto.VisitPreachformRow">
        update service_subtask_preachform
        <trim prefix="SET" suffixOverrides=",">
            <if test="subid != null">subid =
                #{subid},
            </if>
            <if test="taskid != null">taskid =
                #{taskid},
            </if>
            <if test="preachform != null">preachform =
                #{preachform},
            </if>
            <if test="sendstate != null">sendstate =
                #{sendstate},
            </if>
            <if test="remark != null">remark =
                #{remark},
            </if>
            <if test="orgid != null">orgid =
                #{orgid},
            </if>
            <if test="delFlag != null">del_flag =
                #{delFlag},
            </if>
            <if test="createTime != null">create_time =
                #{createTime},
            </if>
            <if test="createBy != null">create_by =
                #{createBy},
            </if>
            <if test="updateTime != null">update_time =
                #{updateTime},
            </if>
            <if test="updateBy != null">update_by =
                #{updateBy},
            </if>
            <if test="sort != null">sort =
                #{sort},
            </if>
            <if test="compensateTime != null">compensate_time =
                #{compensateTime},
            </if>
            <if test="currentSendTime != null ">
                current_send_time = #{currentSendTime},
            </if>
        </trim>
        where id = #{id}
    </update>
 
    <!-- 原 updateSSPByCondition:SET 与 updateById 相同,WHERE 按条件且无 id -->
    <update id="updateByCondition" parameterType="com.ruoyi.common.core.service.dto.VisitPreachformRow">
        update service_subtask_preachform
        <trim prefix="SET" suffixOverrides=",">
            <if test="subid != null">subid =
                #{subid},
            </if>
            <if test="taskid != null">taskid =
                #{taskid},
            </if>
            <if test="preachform != null">preachform =
                #{preachform},
            </if>
            <if test="sendstate != null">sendstate =
                #{sendstate},
            </if>
            <if test="remark != null">remark =
                #{remark},
            </if>
            <if test="orgid != null">orgid =
                #{orgid},
            </if>
            <if test="delFlag != null">del_flag =
                #{delFlag},
            </if>
            <if test="createTime != null">create_time =
                #{createTime},
            </if>
            <if test="createBy != null">create_by =
                #{createBy},
            </if>
            <if test="updateTime != null">update_time =
                #{updateTime},
            </if>
            <if test="updateBy != null">update_by =
                #{updateBy},
            </if>
            <if test="sort != null">sort =
                #{sort},
            </if>
            <if test="compensateTime != null">compensate_time =
                #{compensateTime},
            </if>
            <if test="currentSendTime != null ">
                current_send_time = #{currentSendTime},
            </if>
        </trim>
        where 1=1
        <if test="subid != null">and subid =
            #{subid}
        </if>
        <if test="taskid != null">and taskid =
            #{taskid}
        </if>
        <if test="preachform != null">and preachform =
            #{preachform}
        </if>
        <if test="remark != null">and remark =
            #{remark}
        </if>
        <if test="orgid != null">and orgid =
            #{orgid}
        </if>
    </update>
 
    <!-- 原 deleteServiceSubtaskPreachformById:<update> 置 del_flag=1 -->
    <update id="softDeleteById" parameterType="Long">
        update service_subtask_preachform
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
        where id = #{id}
    </update>
 
    <!-- 原 deleteServiceSubtaskPreachformByIds:<update> + in 集合 -->
    <update id="softDeleteByIds" parameterType="String">
        update service_subtask_preachform
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
        where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>
 
    <!-- 原 deleteServiceSubtaskPreachformBySubid:<delete> 标签但语句是 update -->
    <delete id="softDeleteBySubid" parameterType="Long">
        update service_subtask_preachform
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
        where subid = #{subid}
    </delete>
 
</mapper>