ibatis 大于等于小于等于的写法
在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 大于等于小于等于的写法的更多相关文章
- mybatis中大于等于小于等于的写法
标准写法如下: 第一种写法(1): 原符号 < <= > >= & ' "替换符号 < <= > >= & &apos ...
- MySQL中大于等于小于等于的写法
由于在mybatis框架的xml中<= , >=解析会出现问题,编译报错,所以需要转译 第一种写法: 原符号 < <= > >= & ' " 替换 ...
- mybatis大于等于小于等于的写法
第一种写法(1): 原符号 < <= > >= & ' " 替换符号 < <= > >= & ' " ...
- 【新】mybatis中大于等于小于等于的两种常用写法
mybatis中大于等于小于等于的写法 原符号 < <= > >= & ' " 替换符号 < <= > >= & &a ...
- mybatis中大于等于、小于等于的写法
在xml格式中,常常会遇到xml解析sql时候出错,这个时候需要用其他符号来表示.在mybatis中会遇到,需要做如下的转换:
- mybatis中大于等于小于的写法
第一种写法(1): 原符号 < <= > >= & ' "替换符号 < <= > >= & ' " ...
- sql中大于等于小于的写法
由于在mybatis框架的xml中<= , >=解析会出现问题,编译报错,所以需要转译第一种写法: 原符号 < <= > >= & ' "替换符号 ...
- iBatis 中 Like 的写法实现模糊查询
iBatis 开发指南告诉我们,当 Person 对象的 name 属性不为 null 时启用 name 查询条件在映射文件 person.xml 中的配置为 <select id=" ...
- IBATIS sql 小于(<) 写法 特殊符号写法
SELECT * FROM XXX where column1 <![CDATA [ < 100 ]]> ************************************ ...
随机推荐
- vue手机端横屏竖屏切换
1.建一个空白的vue文件,添加上如下代码 data() { this.$router.go(-1) return {} } 2.在需要横屏竖屏切换的页面中加入如下代码: beforeMount( ...
- Ubuntu git 安装、生成sshkey、克隆、切换分支
#1.安装git apt-get install git; #2生成公钥私钥文件 2.配置git账户: git config --global user.name "yourname&quo ...
- LoadRunner监控tomcat
LoadRunner监控tomcat (2012-10-25 14:01:42)转载▼ double atof (const char * string);Action(){ // 保存JVM内 ...
- 改动Androidproject的名称(非Eclipse重命名)
问题背景 在Eclipse,Import新的Android源代码project时.假设Eclipse的workspace已经存在同样名称project,是无法导入的. 网上有非常多改动工程名的方法.是 ...
- tomcat war包自动化部署脚本
#/bin/bash #带发布build的war包名称 war_name="weiFeng.war" war_dir="/home/deploy/wei_feng_tar ...
- atitit.解决struts2 SpringObjectFactory.getClassInstance NullPointerException v2 q31
atitit.解决struts2 SpringObjectFactory.getClassInstance NullPointerExceptionv2 q31 1. #--现象 java.lang. ...
- Atitit 文件上传 架构设计 实现机制 解决方案 实践java php c#.net js javascript c++ python
Atitit 文件上传 架构设计 实现机制 解决方案 实践java php c#.net js javascript c++ python 1. 上传的几点要求2 1.1. 本地预览2 1.2 ...
- 初识WatiN
WatiN —— Web Application Testing In .Net 为什么会有WatiN? 给用户提供一个.Net平台下,将Web测试自动化的便捷途径. 如何通过WatiN来进行自动化测 ...
- kafka 部分问题处理记录
转载请注明原创地址:http://www.cnblogs.com/dongxiao-yang/p/7600561.html 一 broker启动后ReplicaFetcherThread OOM 版 ...
- 动态设置spring配置PropertyPlaceholderConfigurer location的路径
在spring中经常将常用的属性放在properties文件中,然后再spring的配置文件中使用PropertyPlaceholderConfigurer引用properties文件.对于web项目 ...