您现在的位置是: 首页 > 运维 mybatis中大于等于小于等于的写法
mybatis中大于等于小于等于的写法
2020-05-20 【运维】 3111人已围观 5527次浏览
简介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突然没声音的问题
相关文章
- Linux 修改默认的 ssh 22 端口
- 解决443端口被VMWare Workstation占用
- LNMP 手动更新 SSL 证书
- ElasticSearch安装踩坑指南
- Linux 服务器之间传输大文件(压缩文件、查看MD5、后台传输)
- CentOS 安装JDK
- linux下各文件夹的结构说明及用途介绍
- Redis 提示 MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk 解决方案
- Zookeeper 找不到或无法加载主类 org.apache.zookeeper.server.quorum.QuorumPeerMain
- CentOS 安装Python3
点击排行
- 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 项目完整部署方案
站长推荐
猜你喜欢
- springboot引入mybatis-plus后出现ClassNotFoundException: org.mybatis.logging.LoggerFactory
- Mac禁用Adobe Creative Cloud自启状态栏
- SpringBoot @NotBlank 不生效问题
- Mac 设置允许任何来源
- idea去掉Smart commands execution提示
- gulp3 在 node12 上运行出现异常 primordials is not defined
- SqlServer 优化技巧
- Oracle ORA-12541:TNS:no listener错误解决方法
- 记一次 Mybatis-Plus 自动填充无效问题解决
- mysql 索引过长1071-max key length is 767 byte