模糊查询
<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>