`
八贤王
  • 浏览: 38722 次
社区版块
存档分类
最新评论

mybits中IN和LIKE查询

阅读更多
<select useCache="false" id="getConcernPageByUserEname" resultType="com.zbxsoft.chtrans.entity.ChConcern"  parameterType="java.util.Map">
    SELECT * FROM
      (select co.*,rownum as row_num from (
SELECT * FROM CH_CONCERN h where 1=1
<if test="usercname !=null and usercname != ''">
AND h.USERCNAME like concat(concat('%', #{usercname}),'%')
</if>
  <if test="userenames !=null and userenames != ''">
  AND h.USERENAME in
  <foreach item="item" index="index" collection="userenames"
            open="(" separator="," close=")">
            #{item}
        </foreach>
  </if>
  <if test="userenames == ''">
AND 1=-1
</if>
              order by h.creattime desc ) co) tt
     WHERE tt.row_num BETWEEN #{offset} AND #{limit}
    
  </select>
分享到:
评论

相关推荐

    springmybatis

    mybatis实战教程mybatis in action之四实现关联数据的查询 mybatis实战教程mybatis in action之五与spring3集成附源码 mybatis实战教程mybatis in action之六与Spring MVC 的集成 mybatis实战教程mybatis in action...

    mybatis-3.4.2.pdf

    1.1.1 What is My Batis? My Batis is a first ...You’re the best author of this documentation, people like you have to read it! 1.1.3 Translations Users can read about My Batis in following translations:

    MyBatisCodeHelper-Pro.zip

    Full mybatis sql auto complete, recognize mybatis tag in xml, like where trim set include ect,provide sql completion after those tag Jump from mybatis dao interface to mapper xml each other Refactor ...

    MyBatis的学习笔记

    一、mapper.xml 头部文件: 二、查询 1.简单查询 ...2.含 in 关键字的查询 SELECT * FROM BLOG id in #{id} 三、新增 1.单次 insert into news_comment newsid, author, #{newsid}, #{autho

    intellij-mybaitslog:用于在IDEA将MybatisSQL日志还原为可执行SQL,Used to restore Mybatis SQL logs to executable SQL in IDEA,

    2020.08.25 重构代码所有代码,代码中完善备注信息 2020.09.19 添加对特点类型的引号支持 2020.10.07 支持2020.2.3版本 2020.11.20 改进分隔判断,由单纯通过,判断会存在无法对文本正常分隔的情况下。 2020.12.18 改进...

    JAVA代码审计之SQL注入

    1、JDBC连接方式下sql注入的存在的形态及修复方法,like、in情况在如何安全使用预处理来防范sql注入 2、在使用Mybatis框架下如何审计sql注入代码,并详细的介绍了如何编写安全的数据库查询语句。 3、在使用Hibernate...

    scanner-ui:UI界面

    Sql语句和Mybatis互转工具Sql转Mybatis支持批量INSERT,UPDATE,DELETE语句支持数字、字符串、IN、BETWEEN、LIKE等常用表达式支持特定特定条件不转换(数值前加#)使用事例Sql语句:select a from table where b in ...

    mysql提示got timeout reading communication packets的解决方法

    mysql&gt;show gloable variables like “%timeout%”; 进行查看 interactive_timeout 的黓认值为28800 wait_timeout 的默认值这:120 根据情况增加吧. 这两个值是一个全局变量,可以动态增加,如: mysql&gt; set ...

    Pro Spring 3

    How to build transaction engines for your enterprise application and take advantage of other middle-tier features in Spring How to build Spring-based web applications using Spring MVC and more How to ...

    ORM软件monalisa-orm.zip

    for(User x:User.WHERE().name.like("zzg%").status.in(0, 1).SELECT().select()){ System.out.println(x); } //SQL: SELECT * FROM `user` WHERE (`name` like 'zzg%' AND `status` &gt;= 0)  // OR (`name` = '...

Global site tag (gtag.js) - Google Analytics