fix(UserBalanceLog): 优化 SQL 参数空值校验
- 在多个 SQL 查询条件中添加参数非空且非空字符串判断 - 防止空字符串导致的错误匹配或异常 - 统一调整语句格式,保持代码规范和可读性 - 优化关联查询时参数过滤逻辑,提升查询准确性
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
<if test="param.scene != null">
|
<if test="param.scene != null">
|
||||||
AND a.scene = #{param.scene}
|
AND a.scene = #{param.scene}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.sceneMultiple != null">
|
<if test="param.sceneMultiple != null and param.sceneMultiple != ''">
|
||||||
AND a.scene IN
|
AND a.scene IN
|
||||||
<foreach collection="param.sceneMultiple.split(',')" item="item" separator="," open="(" close=")">
|
<foreach collection="param.sceneMultiple.split(',')" item="item" separator="," open="(" close=")">
|
||||||
#{item}
|
#{item}
|
||||||
@@ -30,16 +30,16 @@
|
|||||||
<if test="param.balance != null">
|
<if test="param.balance != null">
|
||||||
AND a.balance = #{param.balance}
|
AND a.balance = #{param.balance}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.describe != null">
|
<if test="param.describe != null and param.describe != ''">
|
||||||
AND a.describe LIKE CONCAT('%', #{param.describe}, '%')
|
AND a.describe LIKE CONCAT('%', #{param.describe}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="param.remark != null">
|
<if test="param.remark != null and param.remark != ''">
|
||||||
AND a.remark LIKE CONCAT('%', #{param.remark}, '%')
|
AND a.remark LIKE CONCAT('%', #{param.remark}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="param.sortNumber != null">
|
<if test="param.sortNumber != null">
|
||||||
AND a.sort_number = #{param.sortNumber}
|
AND a.sort_number = #{param.sortNumber}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.comments != null">
|
<if test="param.comments != null and param.comments != ''">
|
||||||
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="param.status != null">
|
<if test="param.status != null">
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
<if test="param.deleted == null">
|
<if test="param.deleted == null">
|
||||||
AND a.deleted = 0
|
AND a.deleted = 0
|
||||||
</if>
|
</if>
|
||||||
<if test="param.merchantCode != null">
|
<if test="param.merchantCode != null and param.merchantCode != ''">
|
||||||
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
|
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="param.createTimeStart != null">
|
<if test="param.createTimeStart != null">
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
<if test="param.createTimeEnd != null">
|
<if test="param.createTimeEnd != null">
|
||||||
AND a.create_time <= #{param.createTimeEnd}
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.keywords != null">
|
<if test="param.keywords != null and param.keywords != ''">
|
||||||
AND (
|
AND (
|
||||||
a.user_id = #{param.keywords}
|
a.user_id = #{param.keywords}
|
||||||
OR b.nickname LIKE CONCAT('%', #{param.keywords}, '%')
|
OR b.nickname LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
|||||||
Reference in New Issue
Block a user