日期:2014-05-16  浏览次数:20472 次

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>