update zk_transfer_info <trim prefix="set" suffixOverrides=","> cwz_status=#{zkTransferInfo.cwzStatus},cwz_date=#{zkTransferInfo.cwzDate},approval_status=#{zkTransferInfo.approvalStatus}, <if test="zkTransferInfo.receiptsTatus != '' and zkTransferInfo.receiptsTatus != null"> receipts_tatus=#{zkTransferInfo.receiptsTatus} </if> <if test="zkTransferInfo.cwzReason != '' and zkTransferInfo.cwzReason != null"> cwz_reason=#{zkTransferInfo.cwzReason} </if> </trim> <where> flag=1 and applicant_num=#{zkTransferInfo.applicantNum} </where> 当两个if 条件都满足时会报错 怎么修改
时间: 2024-01-11 15:02:27 浏览: 153
UTL-FILE导出使用说明
可以尝试将两个if条件改为使用<choose>标签,如下所示:
```
<update id="updateZkTransferInfo" parameterType="Map">
update zk_transfer_info
<trim prefix="set" suffixOverrides=",">
cwz_status=#{zkTransferInfo.cwzStatus},
cwz_date=#{zkTransferInfo.cwzDate},
approval_status=#{zkTransferInfo.approvalStatus},
<choose>
<when test="zkTransferInfo.receiptsTatus != '' and zkTransferInfo.receiptsTatus != null">
receipts_tatus=#{zkTransferInfo.receiptsTatus},
</when>
<otherwise></otherwise>
</choose>
<choose>
<when test="zkTransferInfo.cwzReason != '' and zkTransferInfo.cwzReason != null">
cwz_reason=#{zkTransferInfo.cwzReason}
</when>
<otherwise></otherwise>
</choose>
</trim>
<where>
flag=1 and applicant_num=#{zkTransferInfo.applicantNum}
</where>
</update>
```
这样可以避免在两个if条件都满足时多出逗号导致报错的问题。
阅读全文