AppUserMapper.xml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.poyee.mapper.AppUserMapper">
  6. <resultMap id="appUserListMap" type="com.poyee.dto.AppUserListDTO">
  7. <id column="user_id" property="userId"/>
  8. <result column="nickname" property="nickname"/>
  9. <result column="phone" property="phone"/>
  10. <result column="register_time" property="registerTime"/>
  11. <result column="register_channel" property="registerChannel"/>
  12. <result column="face_verify" property="faceVerify"/>
  13. </resultMap>
  14. <select id="selectList" resultMap="appUserListMap">
  15. select
  16. abu.id as user_id,
  17. abu.nickname,
  18. aa.phone,
  19. abu.create_time as register_time,
  20. abu.register_channel,
  21. abu.avatar,
  22. coalesce(abu.face_verify, 0) as face_verify
  23. from app_base_user abu
  24. left join app_account aa on aa.account = abu.username and aa.del_flg = 0
  25. <where>
  26. and coalesce(abu.del_flg, 0) = 0
  27. <if test="query.nickname != null and query.nickname != ''">
  28. and abu.nickname like concat('%', #{query.nickname}, '%')
  29. </if>
  30. <if test="query.phone != null and query.phone != ''">
  31. and aa.phone = #{query.phone}
  32. </if>
  33. <if test="query.faceVerify != null">
  34. and coalesce(abu.face_verify, 0) = #{query.faceVerify}
  35. </if>
  36. <if test="query.registerChannel != null and query.registerChannel != ''">
  37. and abu.register_channel = #{query.registerChannel}
  38. </if>
  39. <if test="query.registerTimeStart != null">
  40. and abu.create_time &gt;= #{query.registerTimeStart}
  41. </if>
  42. <if test="query.registerTimeEnd != null">
  43. and abu.create_time &lt;= #{query.registerTimeEnd}
  44. </if>
  45. </where>
  46. order by abu.create_time desc, abu.id desc
  47. </select>
  48. <resultMap id="sysUserProfileMap" type="com.poyee.dto.SysUserProfileDTO">
  49. <result column="user_name" property="nickname"/>
  50. <result column="avatar" property="avatar"/>
  51. </resultMap>
  52. <select id="selectSysUserProfile" resultMap="sysUserProfileMap">
  53. select su.user_name, su.avatar
  54. from sys_user su
  55. where su.user_id = #{userId}
  56. and coalesce(su.del_flag, '0') = '0'
  57. limit 1;
  58. </select>
  59. </mapper>