Home > Database > Mysql Tutorial > mybatis查询mysql的时间段

mybatis查询mysql的时间段

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:58:30
Original
2703 people have browsed it

mapper文件的写法为:(模糊查询,查询时间段) if test=com_name!=null and com_name!=and sc.com_name like CONCAT(CONCAT(%,#{com_name}),%)/ifif test=check_begin_date!=null and check_begin_date!=![CDATA[ and DATE_FORMAT(tcb.check_begin_date, %Y

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

                <if test="com_name!=null and com_name!=&#39;&#39;">
			and sc.com_name like CONCAT(CONCAT(&#39;%&#39;,#{com_name}),&#39;%&#39;)
		</if>
		<if test="check_begin_date!=null and check_begin_date!=&#39;&#39;">
		<![CDATA[
			  and DATE_FORMAT(tcb.check_begin_date, &#39;%Y-%m-%d&#39;) >=  DATE_FORMAT(#{check_begin_date}, &#39;%Y-%m-%d&#39;)
		]]>
		</if>
		<if test="check_end_date!=null and check_end_date!=&#39;&#39;">
		<![CDATA[
			  and DATE_FORMAT(tcb.check_begin_date, &#39;%Y-%m-%d&#39;) <=  DATE_FORMAT(#{check_end_date}, &#39;%Y-%m-%d&#39;)
		]]>
		</if>
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Mybatis mapping problem
From 1970-01-01 08:00:00
0
0
0
java - Mybatis related query
From 1970-01-01 08:00:00
0
0
0
REGEXP in mybatis
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template