mybaits 中没有else要用chose when otherwise 代替

详情可以参考此文章:mybatis if-else(写法)

我在项目中的写法如下:

<select id="searchCorpList" parameterType="java.lang.String"resultType="com.pccwhkt.ump.portal.umportal.sys.user.bean.SearchCorpResultBean">select CORP_ACC_ID, CORP_ID, CORP_ACC_NAME CORP_NAME, STATUS, TYPEfrom UMG_CORP_ACC<if test="corp_id != null and corp_id != ''">where LOCATE(#{corp_id}, CORP_ID)>0</if><if test="corp_name != null and corp_name != ''"><choose><when test="corp_id != null and corp_id != ''">and LOCATE(#{corp_name}, CORP_ACC_NAME)>0</when><otherwise>where LOCATE(#{corp_name}, CORP_ACC_NAME)>0</otherwise></choose></if><if test="status != null and status != ''"><choose><when test="(corp_id != null and corp_id != '') or (corp_name != null and corp_name != '')">and LOCATE(#{status}, STATUS)>0</when><otherwise>where LOCATE(#{status}, STATUS)>0</otherwise></choose></if><if test="type != null and type != ''"><choose><when test="(corp_id != null and corp_id != '') or (corp_name != null and corp_name != '') or (status != null and status != '')">and LOCATE(#{type}, TYPE)>0</when><otherwise>where LOCATE(#{type}, TYPE)>0</otherwise></choose></if></select>

mybatis if-else(chose when otherwise )相关推荐

  1. mybatis if-else(写法)

    mybaits 中没有else要用chose when otherwise 代替 范例一 <!--批量插入用户--> <insert id="insertBusinessU ...

  2. mybatis高级查询,批量新增

    review sql脚本 实体类 sql watch out mapper mapper test 之前的比较分散,自己用... sql脚本 -- auto-generated definition ...

  3. Hibernate 多表映射(Mybatis,Springjdbc,Hibernate ,JDBC的多表映射学习比较)

    from:http://blog.zenika.com/index.php?post/2012/03/28/Presentation-de-MyBatis Mybatis,Springjdbc,Hib ...

  4. SSM框架专题-MyBatis框架老杜版从零入门笔记(下)

    七.MyBatis参数处理 7.1 单个简单参数 parameterType表示传入参数的类型,官方文档有很多别名可以参考 <insert id="insertStu" pa ...

  5. MyBatis中if - else if - else 的使用

    http://www.leftso.com/blog/765.html 不过有他的替代  choose,写法如下: <choose><when test="params!= ...

  6. mybatis使用<choose> <when>

    mybatis使用<choose> <when> 一.需求 后台使用orcale数据库,mybatis做持久层,前台搜索功能,根据类型搜索,但是数据库中没有类型字段, 所以需要 ...

  7. mybatis的函数

    mybatis的函数 1) with .. as ( select * from *) 相当于提取一个临时表,以便于复用,在union all中经常用到,以及需要复用的时候用到; 这是CTE的格式,使 ...

  8. mybatis 中 if else 用法

    mybaits 中没有 else 要用 chose when otherwise 代替 下面就是MyBatis中的if....else...表示方法 <choose><when te ...

  9. mybatis查询报错:com.mysql.cj.exceptions.DataConversionException: Cannot determine value type from string

    mybatis查询报错: com.mysql.cj.exceptions.DataConversionException: Cannot determine value type from strin ...

最新文章

  1. b树与b+树的区别_一篇文章理清B树、B-树、B+树、B*树索引之间的区别与联系
  2. 在NamedParameterJdbcTemplate中使用like查询
  3. 收藏!细胞增殖实验要点详解
  4. 究极日月服务器维护时间,超激斗梦境9月25日终极测试服务器维护公告_超激斗梦境9月25日更新了什么_玩游戏网...
  5. LEAGUE TABLES【模拟】
  6. Date-calendar 类
  7. Wireshark使用教程用户手册
  8. 小程序:npm下载使用weiui
  9. 解决百度云管家导入未完成下载任务
  10. 基于 Python 的时序模型——AMIRA模型
  11. 带阻滤波器对周期性噪声消除matlab实现
  12. 如何安装cnpm和检查cnpm是否已经安装成功
  13. Windows系统怎样配置PHP环境
  14. 【转】“产品策划大神 如何进行用户需求分析,这篇文章实在说的透彻!!!【互联网方向】
  15. 「硬见小百科」一文读懂电子元器件
  16. NB-IoT门磁报警器 物联网门磁传感器 电子封条报警器
  17. HTML和CSS做优惠券效果
  18. Linux(ubuntu16.04)FTP服务器搭建详细步骤
  19. Edge浏览器黑色背景设置
  20. 数据科学家是干什么的,成为一名数据科学家,主要划分为哪几个步骤?

热门文章

  1. 【转】流体动力学控制方程(详细推导)
  2. tkinter显示图片
  3. 请问在C#中如何实现声音报警?
  4. 记录:谷歌地图google map api实现基本测距功能
  5. 猫眼5万条评论告诉你《飞驰人生》值不值得看?!
  6. Linux下安装安装redis
  7. 【笔记】微信小程序基础
  8. 利用电脑投放手机声音且可不冲突同时播放电脑声音的方法
  9. 三个点带你解读Smartbi商业智能大数据分析平台
  10. 把妹导论第二版(Hunting-Girls Introduction II)