您现在的位置是: 首页 > 运维 mybatis中大于等于小于等于的写法
mybatis中大于等于小于等于的写法
2020-05-20 【运维】 2076人已围观 3920次浏览
简介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突然没声音的问题
相关文章
- Redis 提示 MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk 解决方案
- Linux no space left on device 出现设备上没有空间问题
- 解决Lost connection to MySQL server at 'reading initial communication packet' 的方法
- Nginx转发阿里云OSS内网流量
- Docker 批量操作命令
- nginx 出现 the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in 错误解决方案
- Linux 安装 Tengine
- 自建Ngrok服务端
- 常见端口号
- CentOS 安装JDK
点击排行
- 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 自动填充无效问题解决
- nuxt 项目完整部署方案
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
站长推荐
猜你喜欢
- Zookeeper 找不到或无法加载主类 org.apache.zookeeper.server.quorum.QuorumPeerMain
- nuxt 项目完整部署方案
- Nginx转发阿里云OSS内网流量
- PHP 在执行 composer install 时出现提示 PHP Fatal error: Allowed memory size of XXXXXX bytes exhausted <...>
- 防止Time Machine备份Parallels Desktop的虚拟硬盘文件
- CentOS 安装Python3
- Windows CMD 常用命令
- 迁移 Docker 目录
- mac idea spring boot 启动慢
- SqlServer字符串处理