<select id="selectAllByType" parameterType="com.acp.dto.AcpUserDto" resultMap="UserApiMap">
select
d.id,d.username,d.user_type,c.name
,c.email,c.mobile
,c.unified_credit_id,d.last_login_ip,d.last_login_time,f.name
as rolename,c.id as infoId
from acp_user d
left join acp_user_developer
c on c.user_id=d.id
left join acp_user_role e on d.id=e.user_id
left join acp_role f on f.id=e.role_id
<trim prefix=" WHERE " prefixOverrides="AND">
d.user_type = 5 and d.del=1
<if test="id != 0"> AND d.id = #{id} </if>
<if test="username != null"> AND username like '%${username}%'</if>
<if test="userType != 0"> AND user_type = #{userType} </if>
</trim>ideunion all select d.id,d.username,d.user_type,b.`name` ,b.email,b.mobile ,b.unified_credit_id ,d.last_login_ip,d.last_login_time,f.`name` as rolename,b.id as infoId from acp_user d left join acp_user_agent b on b.user_id=d.id left join acp_user_role e on d.id=e.user_id left join acp_role f on f.id=e.role_id <trim prefix=" WHERE " prefixOverrides="AND"> d.user_type = 4 and d.del=1 <if test="id != 0"> AND d.id = #{id} </if> <if test="username != null"> AND username like '%${username}%' </if> <if test="userType != 0"> AND user_type = #{userType} </if> </trim> union all select d.id,d.username,d.user_type,a.`name`,a.email ,a.mobile ,null ,d.last_login_ip,d.last_login_time ,f.`name` as rolename,a.id as infoId from acp_user d left join acp_user_reviewer a on a.user_id=d.id left join acp_user_role e on d.id=e.user_id left join acp_role f on f.id=e.role_id <trim prefix=" WHERE " prefixOverrides="AND"> d.user_type = 3 and d.del=1 <if test="id != 0"> AND d.id = #{id} </if> <if test="username != null"> AND username like '%${username}%'</if> <if test="userType != 0"> AND user_type = #{userType} </if> </trim></select>code