首页 > 其他分享 >mybatis判断字符串等于

mybatis判断字符串等于

时间:2022-08-17 12:11:25浏览次数:56  
标签:00 字符串 cyrq params 等于 mybatis endRyrq null

前言:我们通常使用mybatis过程中,对于判断一个变量是否为空的时候,使用 <if test="xxx != null and xxx !=''">进行。

有个小坑如下:

<if test=" name!=null && name =='admin' "><if/>

这样子写会出现 后面的 name =='admin' 失效问题。

 

解决方案1:

<if test='name!=null && name =="admin"'><if/> # 把这个转换成 单引号。
解决方案2:

<if test=" name!=null && name =='admin'.toString() "><if/>
————————————————

 

 

<if test="params.cyzt!= null and params.cyzt != ''">
<choose>
<when test='params.cyzt =="在院"'>
and cyrq is null or cyrq='0000-00-00 00:00:00'
<if test="params.beginRyrq != null and params.beginRyrq != '' and params.endRyrq != null and params.endRyrq != ''"> and ryrq between #{params.beginRyrq} and #{params.endRyrq}</if>
</when>
<when test='params.cyzt =="出院"'>
and cyrq is not null and cyrq!='0000-00-00 00:00:00'
<if test="params.beginRyrq != null and params.beginRyrq != '' and params.endRyrq != null and params.endRyrq != ''"> and cyrq between #{params.beginRyrq} and #{params.endRyrq}</if>
</when>

<otherwise>
</otherwise>
</choose>

</if>

标签:00,字符串,cyrq,params,等于,mybatis,endRyrq,null
From: https://www.cnblogs.com/zhyp/p/16594651.html

相关文章

  • 使用Jquery的ajaxprefilter来拼接url字符串
    目的:我们每次发请求,如果都需要拼接字符串的话,会特别浪费时间,以及不利于后期维护例如如下代码:$('#form_login').on('submit',function(e){e.preventDefault(......
  • mybatis-日志(log4j)
    ###日志####1、日志:如果数据库操作出现异常,需要拍错。日志就是最好的助手。以前soutdebug现在日志<setting>配置|logImpl|指定MyBatis所用日志的具体实现,......
  • MyBatisPlus(四、代码生成器)
    一、旧版本注意适用版本:mybatis-plus-generator3.5.1以下版本  AutoGenerator是MyBatis-Plus的代码生成器,通过AutoGenerator可以快速根据数据表自动生成实体......
  • IDEA中创建的Mybatis项目使用LOG4J生成的log日志文件无法打开的问题
    最近跟着狂神老师学习Mybatis,当我把我的日志配置文件都弄好之后,发现老师能正常打开定义的日志文件,而我的就是显示一个带问号的文件,  网上看了好多博客,发现原来是因为......
  • 字符串添加颜色
    想给字符串一些颜色进行展示lis=[31,32,33,34,35,36]msg='''断了的弦再怎么连,我的感觉你已听不见你的转变像断掉的弦,再怎么接音都不对你的改变我能够分......
  • kmp字符串
    给定一个字符串S,以及一个模式串P,所有字符串中只包含大小写英文字母以及阿拉伯数字。模式串P在字符串S中多次作为子串出现。求出模式串P在字符串S中所有出现的......
  • mybatisplus入门
    一、maven项目文件点击查看代码<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifact......
  • 整数型转字符串
    1.itoa();参考:C语言整数与字符串的相互转换|菜鸟教程(runoob.com) C语言itoa()函数和atoi()函数详解(整数转字符C实现)_p312011150的博客-CSDN博客_itoa头文件:<s......
  • 1047.remove-all-adjacent-duplicates-in-string 删除字符串中所有相邻重复项
    利用stack(栈)这一数据结构,当前字符与栈顶字符相等时,pop(),最后把栈中的字符还原成字符串,注意栈是LIFO的,因此还原字符串时要注意顺序。#include<stack>#include<string>......
  • python 中 如何提取或者删除列表的最后几个元素(适用于元组、字符串序列)
     001、>>>test=["a","b","c","d","e","f","g","h","i","j"]##测试列表>>>test['a','b','c'......