本文主要是介绍mybaits where标签的使用和写法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
<!-- 统计侧坡数据记录 --><select id="count" parameterType="com.XinjueManager.common.InquiryCondition" resultType="int">SELECT count(*) from sys_evaluatio_data<where><if test="cndtn1 !=null and cndtn1 !='' "> platform = #{cndtn1}</if><if test="cndtn2 !=null and cndtn2 !='' "> and province = #{cndtn2}</if><if test="cndtn3 !=null and cndtn3 !='' "> and evaluationId = #{cndtn3}</if><if test="cndtn4 !=null and cndtn4 !='' "> and formNumber LIKE CONCAT("%",#{cndtn4},"%")</if><if test="cndtn5 !=null and cndtn5 !='' "> and city = #{cndtn5}</if></where></select>
在上面的 where标签中的判断语句 如何在第二个判断语句不加上 and的话 查询如果是需要多个条件 就会报错
where 元素知道只有在一个以上的if条件有值的情况下才去插入“WHERE”子句。而且,若最后的内容是“AND”或“OR”开头的,where 元素也知道如何将他们去除。
这篇关于mybaits where标签的使用和写法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!