|  |  | 
 |  |  |     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} | 
 |  |  |       RIGHT JOIN system_user_role sur on sur.USER_ID = usr.ID and sur.DELETED = 0  and sur.ROLE_ID = #{dto.roleId} | 
 |  |  |     </if> | 
 |  |  |     <where> | 
 |  |  |       usr.DELETED = 0 | 
 |  |  | 
 |  |  |         AND  usr.`status` = #{dto.status} | 
 |  |  |       </if> | 
 |  |  |       <if test="dto.memberType != null "> | 
 |  |  |         AND  m.`type` = #{dto.memberType} | 
 |  |  |         AND  usr.`type` = #{dto.memberType} | 
 |  |  |       </if> | 
 |  |  |       <if test="dto.workStatus != null "> | 
 |  |  |         AND  m.WORK_STATUS = #{dto.workStatus} | 
 |  |  |       </if> | 
 |  |  |       <if test="dto.companyId != null "> | 
 |  |  |         AND  usr.COMPANY_ID  = #{dto.companyId} | 
 |  |  | 
 |  |  |       <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 test="dto.querySpecial != null and dto.querySpecial == 1 "> | 
 |  |  |             AND find_in_set(#{dto.companySpecialId},REPLACE(sd.company_path,'/',',')) | 
 |  |  |       </if> | 
 |  |  |     </where> | 
 |  |  |     ${orderByClause} |