|  |  |  | 
|---|
|  |  |  | sd.ID AS DEPARTMENT_ID, sd.`NAME` AS DEPARTMENT_NAME,usr.wechat_name,usr.status,usr.OPENID,usr.type, | 
|---|
|  |  |  | create_user.ID CREATE_USER_ID, create_user.`USERNAME` CREATE_USER_NAME, create_user.`REALNAME` CREATE_REAL_NAME, | 
|---|
|  |  |  | update_user.ID UPDETE_USER_ID, update_user.`USERNAME` UPDATE_USER_NAME, create_user.`REALNAME` UPDATE_REAL_NAME, | 
|---|
|  |  |  | sd.name as companyName | 
|---|
|  |  |  | sd.company_name_path as companyName | 
|---|
|  |  |  | FROM `SYSTEM_USER` usr | 
|---|
|  |  |  | LEFT JOIN `SYSTEM_USER` create_user ON create_user.ID = usr.CREATE_USER | 
|---|
|  |  |  | LEFT JOIN `SYSTEM_USER` update_user ON update_user.ID = usr.UPDATE_USER | 
|---|
|  |  |  | LEFT JOIN `company` sd ON sd.ID = usr.COMPANY_ID AND sd.ISDELETED = 0 | 
|---|
|  |  |  | LEFT JOIN `member` m ON usr.MEMBER_ID = m.id | 
|---|
|  |  |  | <if test="dto.roleId != null"> | 
|---|
|  |  |  | RIGHT JOIN system_user_role sur on sur.USER_ID = usr.ID and sur.ROLE_ID = #{dto.roleId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | usr.DELETED = 0 | 
|---|
|  |  |  | and usr.SOURCE = 0 | 
|---|
|  |  |  | <!--      <if test="dto.positionId != null">--> | 
|---|
|  |  |  | <!--        AND spu.POSITION_ID = #{dto.positionId}--> | 
|---|
|  |  |  | <!--      </if>--> | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="dto.mobile != null and dto.mobile != ''"> | 
|---|
|  |  |  | AND usr.`MOBILE` LIKE CONCAT('%', #{dto.mobile}, '%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="dto.companyName != null and dto.companyName != ''"> | 
|---|
|  |  |  | AND sd.`company_name_path` LIKE CONCAT('%', #{dto.companyName}, '%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="dto.status != null "> | 
|---|
|  |  |  | AND  usr.`status` = #{dto.status} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="dto.memberType != null "> | 
|---|
|  |  |  | AND  usr.`type` = #{dto.memberType} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="dto.memberType != null "> | 
|---|
|  |  |  | AND  usr.`type` = #{dto.memberType} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="dto.workStatus != null "> | 
|---|
|  |  |  | AND  m.WORK_STATUS = #{dto.workStatus} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="dto.memberType != null "> | 
|---|
|  |  |  | AND  m.`type` = #{dto.memberType} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="dto.companyId != null "> | 
|---|
|  |  |  | AND  usr.COMPANY_ID  = #{dto.companyId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="dto.companyType != null "> | 
|---|
|  |  |  | AND  sd.`type` = #{dto.companyType} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="dto.querySpecial != null and dto.querySpecial == 1 "> | 
|---|
|  |  |  | AND find_in_set(#{dto.companySpecialId},REPLACE(sd.company_path,'/',',')) | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | ${orderByClause} | 
|---|
|  |  |  | </select> | 
|---|