标签:app stat can state flow contract creat null 方案
有时候我们会直接在where后面跟if标签的情况
解决方案如下:
WHERE 1=1
<if test="request.orderName != null and request.orderName != ‘‘" >
AND o.order_name = #{request.orderName}
</if>
<if test="request.contractName != null and request.request.contractName != ‘‘" >
AND c.contract_name = #{request.contractName}
</if>
<if test="request.sheetWorkflowApplicant != null and request.sheetWorkflowApplicant != ‘‘" >
AND swf.created_by = #{request.sheetWorkflowApplicant}
</if>
<if test="request.auditState != null and request.auditState != ‘‘ or request.auditState==0 ">
AND swf.audit_state #{request.auditState}
</if>
在where后面加1=1即可
标签:app stat can state flow contract creat null 方案
原文地址:https://www.cnblogs.com/yanyanp/p/11648064.html