XML中SQL的if标签使用

判断不为空
where 1=1 // 此句用来处理某些全要判空的情况
<
if test="compShopMO.uciCompName != null and compShopMO.uciCompName != ''"> and USER_COMPANY_INFO.UCI_COMP_NAME = #{compShopMO.uciCompName} </if>
判断为空
<
if test="compShopMO.uciCompName == null or compShopMO.uciCompName == ''"> and USER_COMPANY_INFO.UCI_COMP_NAME = #{compShopMO.uciCompName} </if>

 

posted @ 2020-12-03 11:06  CEO雷总  阅读(3594)  评论(0编辑  收藏  举报