|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | 
|---|
|  |  |  | <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} | 
|---|