mybatis查询mysql的时间段

时间:2014-07-12 17:43:38   收藏:0   阅读:247

   mapper文件的写法为:(模糊查询,查询时间段)

                <if test="com_name!=null and com_name!=''">
			and sc.com_name like CONCAT(CONCAT('%',#{com_name}),'%')
		</if>
		<if test="check_begin_date!=null and check_begin_date!=''">
		<![CDATA[
			  and DATE_FORMAT(tcb.check_begin_date, '%Y-%m-%d') >=  DATE_FORMAT(#{check_begin_date}, '%Y-%m-%d')
		]]>
		</if>
		<if test="check_end_date!=null and check_end_date!=''">
		<![CDATA[
			  and DATE_FORMAT(tcb.check_begin_date, '%Y-%m-%d') <=  DATE_FORMAT(#{check_end_date}, '%Y-%m-%d')
		]]>
		</if>


mybatis查询mysql的时间段,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!