zoukankan      html  css  js  c++  java
  • 模糊查询

     <select id="queryUserList" resultType="com.kakarote.admin.entity.VO.AdminUserVO">
            select a.realname,a.username,a.user_id,a.sex,a.mobile,a.email,e.name as deptName,a.status,a.create_time,a.dept_id,
            a.post,a.parent_id,a.customer_service,
            (select b.realname from wk_admin_user as b where b.user_id = a.parent_id) as parentName,
            (select m.realname from wk_admin_user as m where m.user_id = a.customer_service) as customerServiceName
            from wk_admin_user as a
            left join wk_admin_dept as e on a.dept_id = e.dept_id
            <if test="data.roleId != null">
                left join wk_admin_user_role as g on a.user_id = g.user_id
            </if>
            where  1=1
            <if test="data.realname != null and data.realname != ''">
                and (a.realname like concat('%', #{data.realname}, '%') or a.mobile like concat('%',#{data.realname}, '%'))
            </if>
            <if test="data.deptIdList.size()>0">
                and a.dept_id in
                <foreach item="item" collection="data.deptIdList" separator="," open="(" close=")" index="">
                   #{item}
                </foreach>
            </if>
            <if test="data.status != null">
                and a.status = #{data.status}
            </if>
            <choose>
                <when test="data.label != null and data.label==1">
                  AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(a.create_time)
                </when>
                <when test="data.label != null and data.label==2">
                    and a.status='2'
                </when>
                <when test="data.label != null and data.label==3">
                    and a.status = '0'
                </when>
            </choose>
            <if test="data.roleId != null">
                and g.role_id=#{data.roleId}
            </if>
            order by status desc
        </select>
    

      

  • 相关阅读:
    【leetcode】N叉树的前序遍历
    【leetcode】第 N 个泰波那契数
    【leetcode】下一个更大元素 I
    【leetcode】Nim 游戏
    【leetcode】非递减数列
    053-208
    053-211
    053-56
    053-53
    053-236
  • 原文地址:https://www.cnblogs.com/xianz666/p/13964641.html
Copyright © 2011-2022 走看看