ibatis的sql配置文件sql.xml大于小于等于的写法
来源:互联网 发布:不停打电话的软件 编辑:程序博客网 时间:2024/05/16 05:48
在ibatis的sql语句xml配置文件中,写sql语句会经常用到大于等于小于等于等等符号。网上搜罗了一些写法,大致有3种:
其实就是xml特殊符号,转义的方式。
<
<>
><>
<>&
&'
’"
”
比如:select (case when (UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(ur.offline_time)-5*60*1000)>0 then '1' else '0' end) as offline_flag from ……
使用
<![CDATA[ sql语句]]>
符号进行说明,将此类符号不进行解析 。
比如:<isEqual property="offline_flag" compareValue="0">
and <![CDATA[((UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(ur.offline_time)-5*60*1000)<=0 or u.record_id=0)]]>
</isEqual>如果是参数字段,可以用ibatis的语法。
<isEqual> 相等。
<isNotEqual> 不等。
<isGreaterThan> 大于
<isGreaterEqual> 大于等于
<isLessThan> 小于
<isLessEqual> 小于等于
比如:<isNotEmpty prepend="AND" property="username">
u.username like '%$username$%'
</isNotEmpty>
<isNotEmpty prepend="AND" property="location">
concat(u.country,u.province,u.city) like '%$location$%'
</isNotEmpty>
<isEqual property="offline_flag" compareValue="1">
and (UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(ur.offline_time)-5*60*1000)>0
</isEqual>
<isEqual property="offline_flag" compareValue="0">
and <![CDATA[((UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(ur.offline_time)-5*60*1000)<=0 or u.record_id=0)]]>
</isEqual>
<!-- sort -->
<isEqual property="sort_onlinetime" compareValue="asc">
order by u.online_time asc
</isEqual>
<isEqual property="sort_onlinetime" compareValue="desc">
order by u.online_time desc
</isEqual>
<isEqual property="sort_registtime" compareValue="asc">
order by u.register_time asc
</isEqual>
<isEqual property="sort_registtime" compareValue="desc">
order by u.register_time desc
</isEqual>
<isEqual property="sort_appversion" compareValue="asc">
order by u.app_version asc
</isEqual>
<isEqual property="sort_appversion" compareValue="desc">
order by u.app_version desc
</isEqual>
- ibatis的sql配置文件sql.xml大于小于等于的写法
- ibatis 大于等于小于等于的写法
- mybatis处理xml中SQL语句的大于、小于、大于等于、小于等于
- ibatis 动态SQL like 的写法和 大于小于不等于的写法
- ibatis 动态SQL like 的写法和 大于小于不等于的写法
- mybatis中大于等于小于等于的写法
- mybatis中大于等于小于等于的写法
- iBATIS sql(XML)中的大于、小于、like等符号写法
- iBATIS sql(XML)中的大于、小于、like等符号写法
- ibatis 包含大于小于号的sql语句
- 当ibatis 包含大于小于号的sql语句
- 当ibatis 包含大于小于号的sql语句
- 当ibatis 包含大于小于号的sql语句
- iBATIS sql中的大于、小于、like等符号写法
- iBATIS sql中的大于、小于、like等符号写法
- MyBatis 处理sql中的 大于,小于,大于等于,小于等于
- Ibatis大于,小于等于
- sql——查询大于、小于某个日期的写法
- Linux Kernel 学习笔记12:定时任务
- 基于flask的数据分析平台
- Process crashed问题分析
- 文章标题
- ORACLE中高效SQL的写法
- ibatis的sql配置文件sql.xml大于小于等于的写法
- 前端收集
- 如何在一家大公司里受到重用
- Windows系统如何查IP和DNS
- Base64编码学习
- 非变易算法
- BZOJ 4668 冷战
- java 学习 第二天 核心类
- Java-json解析:GSON解析,java bean 编写