<select id="selectAndUser" parameterType="Map" resultMap="BaseResultMapAndUser">
select t_user_auth.*,t_user.phone,t_user.inviter_count
from t_user_auth
inner join t_user on t_user_auth.user_id=t_user.id
<if test="status!=null and status!=''">
and t_user_auth.status =#{status}
</if>
<if test="startDate!=null">
and t_user_auth.create_date >=
FROM_UNIXTIME(#{startDate},'%Y-%m-%d %H:%i:%s')
</if>
<if test="endDate!=null">
and t_user_auth.create_date <=FROM_UNIXTIME(#{endDate},'%Y-%m-%d %H:%i:%s')
</if>
<if test="phone!=null">
and phone like CONCAT(
</if>
</select>
<select id="search" resultMap="BaseResultMapUserAndAuth" parameterType="map">
select
t_user.*,user1.username as inviterName
from t_user inner join t_user user1
on t_user.inviter_user_id=user1.id
where 1=1
<foreach collection="params" index="key" item="value">
<choose>
<when test="key=='startDate'">
and t_user.create_date >= str_to_date(#{value},'%Y-%m-%d %H:%i:%s')
</when>
<when test="key=='endDate'">
and t_user.create_date <= str_to_date(#{value},'%Y-%m-%d %H:%i:%s')
</when>
<when test="key=='inviterName'">
and user1.username like CONCAT('%',#{value},'%')
</when>
<otherwise>
and t_user.${key} like CONCAT('%',#{value},'%')
</otherwise>
</choose>
</foreach>
</select>