ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

Mybatis动态sql,比较datetime类型大小及大于小于号转义

2019-01-29 17:06:40  阅读:386  来源: 互联网

标签:username LIKE create UNIX datetime email state sql 小于号


	<select id="fuzzySearchUserid" parameterType="String"
		resultType="com.joshvm.commons.bean.mysql.User">
		SELECT
		*
		FROM
		user
		<where>
			<if test="username!=null">
				username LIKE '%${username}%'
			</if>
			<if test="nickname!=null">
				AND nickname LIKE '%${nickname}%'
			</if>
			<if test="email!=null">
				AND email LIKE '%${email}%'
			</if>
			<if test="state!=null">
				AND state = ${state}
			</if>
			<if test="createTimeBetween!=null">
				AND UNIX_TIMESTAMP(create_time) &gt;= ${createTimeBetween}
			</if>
			<if test="createTimeTo!=null">
				AND UNIX_TIMESTAMP(create_time) &lt;= ${createTimeTo}
			</if>
		</where>
	</select>

 

标签:username,LIKE,create,UNIX,datetime,email,state,sql,小于号
来源: https://blog.csdn.net/ASDQWE09876/article/details/86692412

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有