select t1.id as accountId,t1.login as account,t2.id as userId,t5.staff_code as staffCode,t2.name as userName,t2.abbreviation,t4.name as roleName,t4.id as roleId,t1.password,t6.id as shopId,t9.name as companyName,t9.code as companyCode,t6.name as shopName,t6.code as shopCode,t4.code as roleCode,t9.id as orgId,t2.mobil
from privilage_account t1
join privilage_user t2 on t1.user_id = t2.id and t1.type = 1
join privilage_user_role t3 on t2.id = t3.user_id
join privilage_role t4 on t3.role_id = t4.id
left join poi_store_staff t5 on t5.user_id = t2.id
left join poi_store t6 on t6.id = t5.store_id
left join privilage_domain_entity t7 on t7.entity_id = t6.id and t7.type = 3
left join privilage_organizational_domain t8 on t8.domain_id = t7.domain_id
left join privilage_organizational t9 on t9.id = t8.org_id and t9.`level` = 3
WHERE 1=1
<iftest="roleId != 0">
and t3.role_id = #{roleId}
</if>
<iftest="searchContent != null and searchContent != ''">