zoukankan      html  css  js  c++  java
  • Mybatis的test字符串比较

    使用<choose>标签

    如:

            <choose>
                   <when test="query.auditType != null and query.auditType == '2'">
                       AND ci.audit_status = '2'
                   </when>
                   <otherwise>
                       AND ci.audit_status IN ('0', '3')
                   </otherwise>
            
    </choose>

    你会发现它一直执行的是<otherwise>内的

    如果要正确执行

    方法一:

    需要在'2' 加上.toString()

    如:

                 <choose>
    			   <when test="query.auditType != null and query.auditType == '2'.toString()">
    				   AND ci.audit_status = '2'
    			   </when>
    			   <otherwise>
    				   AND ci.audit_status IN ('0', '3')
    			   </otherwise>
    		   </choose>
    

     方法二:外层使用单引号,内层使用双引号

                  <choose>
    			   <when test='query.auditType != null and query.auditType == "2"'>
    				   AND ci.audit_status = '2'
    			   </when>
    			   <otherwise>
    				   AND ci.audit_status IN ('0', '3')
    			   </otherwise>
    		   </choose>            
    

      

  • 相关阅读:
    drf认证组件
    播放音频
    推荐
    makefile编写
    qt文件操作mv
    qt文件http网络下载
    为qt在window上用源代码编译库 (部分转载)
    qt线程池(转)
    crc校验
    树莓派网络配置查询
  • 原文地址:https://www.cnblogs.com/mlfz/p/14212020.html
Copyright © 2011-2022 走看看