fix: 修复财务单据存在性校验空列表导致的SQL语法错误
- 为付款申请、开票申请、收款单的存在性查询添加空集合判断,
当传入的出入库记录ID列表为空时跳过动态条件,避免生成
无效SQL语法
- 统一使用<where>标签或显式AND拼接条件,规范动态SQL写法,
涉及account/purchase与account/sales模块的三个Mapper文件
| | |
| | | <select id="existsByStockInRecordId" resultType="java.lang.Boolean"> |
| | | SELECT COUNT(*) > 0 |
| | | FROM account_payment_application |
| | | WHERE status != 2 |
| | | <foreach collection="stockInRecordIds" item="id" open="(" separator=" OR " close=")"> |
| | | FIND_IN_SET(#{id}, stock_in_record_ids) |
| | | </foreach> |
| | | WHERE status != 2 |
| | | <if test="stockInRecordIds != null and stockInRecordIds.size() > 0"> |
| | | AND ( |
| | | <foreach collection="stockInRecordIds" item="id" separator=" OR "> |
| | | FIND_IN_SET(#{id}, stock_in_record_ids) |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <select id="existsByStockOutRecordId" resultType="java.lang.Boolean"> |
| | | SELECT COUNT(*) > 0 |
| | | FROM account_invoice_application |
| | | WHERE status!=2 |
| | | <foreach collection="stockOutRecordIds" item="id" open="(" separator=" OR " close=")"> |
| | | FIND_IN_SET(#{id}, stock_out_record_ids) |
| | | </foreach> |
| | | WHERE status != 2 |
| | | <if test="stockOutRecordIds != null and stockOutRecordIds.size() > 0"> |
| | | AND ( |
| | | <foreach collection="stockOutRecordIds" item="id" separator=" OR "> |
| | | FIND_IN_SET(#{id}, stock_out_record_ids) |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <select id="existsByStockOutRecordId" resultType="java.lang.Boolean"> |
| | | SELECT COUNT(*) > 0 |
| | | FROM account_sales_collection |
| | | WHERE |
| | | <foreach collection="stockOutRecordIds" item="id" open="(" separator=" OR " close=")"> |
| | | FIND_IN_SET(#{id}, stock_out_record_ids) |
| | | </foreach> |
| | | <where> |
| | | <foreach collection="stockOutRecordIds" item="id" open="(" separator=" OR " close=")"> |
| | | FIND_IN_SET(#{id}, stock_out_record_ids) |
| | | </foreach> |
| | | </where> |
| | | </select> |
| | | <select id="getOutboundBatchesByCustomer" |
| | | resultType="com.ruoyi.account.bean.vo.sales.SalesOutboundVo"> |