Mybatis 多条件查询

来源:互联网 发布:socket编程基础知识 编辑:程序博客网 时间:2024/06/04 18:45

<selectid="GetRecordCountByCondition1"parameterType="java.util.Map"resultType="int">

select count(*) from record where

<iftest="startime != null and startime != ''">

record_time>=#{startime} and

</if>

<iftest="stoptime != null and stoptime != ''">

record_time<![CDATA[ <= ]]>#{stoptime} and

</if>

<iftest="mintemp != null and mintemp != ''">

record_temp>=#{mintemp} and

</if>

<iftest="maxtemp != null and maxtemp != ''">

record_time<![CDATA[ <= ]]>#{maxtemp} and

</if>

record_p_pk=${id}

</select>

0 0