欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

sql语句查询之concat()及条件嵌套应用

程序员文章站 2024-03-02 18:39:04
...
<select id="selectFreezeList" resultMap="resultMap">
		SELECT * FROM freeze_list WHERE status = '1' 
		 <if test="cusName != null and cusName != '' and cusId = null and cusId ='' ">
	    and enterprise_name like CONCAT('%',#{cusName},'%')
	 	 </if>
	 	 <if test="cusId != null and cusId != ''">
	    and bill_code like CONCAT('%',#{cusId},'%')
	 	 </if>
		 ORDER BY create_time DESC
	</select>

concat 拼接