您现在的位置是: 首页 > 运维 mybatis中大于等于小于等于的写法
mybatis中大于等于小于等于的写法
2020-05-20 【运维】 2641人已围观 4766次浏览
简介mybatis中大于等于小于等于的写法
第一种方法:
用转义字符把">“和”<"替换掉,就没有问题了。
mapper文件示例代码:
<if test="startTime != null ">
AND order_date >= #{startTime,jdbcType=DATE}
</if>
<if test="endTime != null ">
AND order_date <= #{endTime,jdbcType=DATE}
</if>
附:XML转义字符
| < | < | 小于号 |
| > | > | 大于号 |
| & | & | 和 |
| ' | ’ | 单引号 |
| " | " | 双引号 |
第二种方法:
因为这个是xml格式的,所以不允许出现类似">"这样的字符,但是可以使用符号进行说明,将此类符号不进行解析
mapper文件示例代码:
<if test="startTime != null ">
AND <![CDATA[ order_date >= #{startTime,jdbcType=DATE} ]]>
</if>
<if test="endTime != null ">
AND <![CDATA[ order_date <= #{endTime,jdbcType=DATE} ]]>
</if>
目前显示有问题,本站也将字符转义了。后面处理
很赞哦! (0)
下一篇:解决Mac突然没声音的问题
相关文章
- 查看MySQL默认读取的配置文件
- mysql 索引过长1071-max key length is 767 byte
- 常见端口号
- sentinel directive while not in sentinel mode 问题解决
- CentOS 安装Python3
- ElasticSearch安装踩坑指南
- Windows CMD 常用命令
- nginx 出现 the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in 错误解决方案
- Linux 常用命令 持续更新中...
- Linux 修改默认的 ssh 22 端口
点击排行
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- Debian apt 使用国内镜像
- RocketMQ 出现 sendDefaultImpl call timeout 问题
- 类 BASE64Decoder 程序包 sun.misc 找不到符号
- SpringBoot @NotBlank 不生效问题
- 记一次 Mybatis-Plus 自动填充无效问题解决
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
- nuxt 项目完整部署方案
站长推荐
猜你喜欢
- nuxt 项目完整部署方案
- 自建Ngrok服务端
- CentOS 安装JDK
- Mac 设置允许任何来源
- Vue 路由跳转错误 NavigationDuplicated: Avoided redundant navigation to current location
- 在使用Flutter进行网络请求时,使用Dio访问https地址出现unable to get local issuer certificate错误
- nginx 出现 the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in 错误解决方案
- Laravel项目出现could not be opened: failed to open stream: Permission denied
- Win10 安装适用于Linux的Windows子系统
- Debian apt 使用国内镜像