TaUserMapper.xml 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.huiju.estateagents.center.taUser.mapper.TaUserMapper">
  4. <select id="getPageList" resultType="map">
  5. SELECT
  6. t.user_id AS userId,
  7. t.org_id AS orgId,
  8. t.user_name AS userName,
  9. t.login_name AS loginName,
  10. t.phone,
  11. t.avatar,
  12. t.create_date AS createDate,
  13. t.status,
  14. o.NAME AS orgName,
  15. o.address,
  16. o.logo,
  17. o.remark,
  18. m.miniapp_id AS miniappId,
  19. m.secret,
  20. m.token,
  21. m.NAME AS miniappName,
  22. m.qr_code AS qrCode,
  23. t.exp_date as expire_date,
  24. m.org_id
  25. FROM
  26. ta_user t
  27. LEFT JOIN ta_org o ON t.org_id = o.org_id
  28. LEFT JOIN ta_miniapp m ON o.org_id = m.org_id
  29. left join ta_channel_app_relation n on o.org_id = n.org_id
  30. left join ta_channel_proxy z on z.channel_id = n.channel_id
  31. WHERE
  32. t.is_admin =1
  33. <if test="channelId != null and channelId != ''">
  34. and n.channel_id = #{channelId}
  35. </if>
  36. </select>
  37. <select id="getTagsList" resultType="com.huiju.estateagents.center.taUser.entity.TaTags">
  38. SELECT
  39. t.*
  40. FROM
  41. ta_tag_user u
  42. LEFT JOIN ta_tags t ON u.tag_id = t.tag_id
  43. AND t.org_id = #{orgId}
  44. WHERE
  45. u.user_id = #{userId}
  46. </select>
  47. <select id="getUserList" resultType="com.huiju.estateagents.center.taUser.entity.TaUser">
  48. SELECT
  49. *
  50. FROM
  51. ta_user
  52. WHERE
  53. <if test="orgId != null and orgId != ''">
  54. org_id = #{orgId} and
  55. </if>
  56. (phone = #{phone}
  57. OR login_Name = #{loginName})
  58. </select>
  59. <select id="seleUserList" resultType="com.huiju.estateagents.center.taUser.entity.TaUser">
  60. SELECT
  61. t.*,
  62. b.building_id
  63. FROM
  64. ta_user t
  65. LEFT JOIN ta_person_building b ON t.user_id = b.user_id
  66. WHERE
  67. t.org_id = #{taUser.orgId}
  68. <if test="taUser.userName != null and taUser.userName != ''">
  69. and t.user_name like CONCAT('%', #{taUser.userName}, '%')
  70. </if>
  71. <if test="taUser.phone != null and taUser.phone != ''">
  72. and t.phone like CONCAT('%', #{taUser.phone}, '%')
  73. </if>
  74. <if test="taUser.status != null and taUser.status != ''">
  75. and t.status = #{taUser.status}
  76. </if>
  77. <if test="taUser.isConsultant != null and taUser.isConsultant != '' or taUser.isConsultant ==0">
  78. and t.is_consultant = #{taUser.isConsultant}
  79. </if>
  80. <if test="personBuildingList != null and personBuildingList.size > 0">
  81. AND b.building_id in
  82. <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
  83. #{personBuilding.buildingId}
  84. </foreach>
  85. </if>
  86. GROUP BY user_id
  87. order by t.weight desc, create_date desc
  88. </select>
  89. <select id="validateWeight" resultType="integer">
  90. select count(*) from ta_user t
  91. LEFT JOIN ta_person_building a on t.user_id = a.user_id
  92. where 1=1
  93. <if test="weight != null and weight != ''">
  94. and t.weight = #{weight}
  95. </if>
  96. <if test="buildingIds != null and buildingIds.size() > 0 ">
  97. and a.building_id in
  98. <foreach collection="buildingIds" item="item" index="index" open="(" close=")" separator=",">
  99. #{item}
  100. </foreach>
  101. </if>
  102. <if test="buildingId != null and buildingId != '' ">
  103. and a.building_id = #{buildingId}
  104. </if>
  105. <if test="userId != null and userId != ''">
  106. and t.user_id != #{userId}
  107. </if>
  108. </select>
  109. <select id="getAdminByAppID" resultType="com.huiju.estateagents.center.taUser.entity.TaUser">
  110. SELECT
  111. m.*
  112. FROM
  113. ta_miniapp t
  114. JOIN ta_user m USING (org_id)
  115. WHERE
  116. t.miniapp_id = #{appid}
  117. AND m.is_admin = 1
  118. </select>
  119. </mapper>