动态IF语句拼接sql语句
<!--列表 正式(非居民) -->
<select id="listFormatNodWeller" resultType="com.jczb.binhe.oa.model.NodwellerFormal">
SELECT
formal.*,@rownum :=@rownum + 1 AS rownum
FROM
`tw_nodweller` formal,
(SELECT @rownum := 0) AS rr
WHERE
recycle = 0 and type = 1
<if test="regionId != null and regionId != ''">
and regionId = #{regionId}
</if>
<if test="regionSonId != null and regionSonId != ''">
and regionSonId = #{regionSonId}
</if>
<if test="userName != null and userName != ''">
and name LIKE CONCAT("%",#{userName},"%")
</if>
<if test="linkMan != null and linkMan != ''">
and linkMan LIKE CONCAT("%",#{linkMan},"%")
</if>
ORDER BY createTime DESC
LIMIT #{start},#{pageSize}
</select>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)