DistributionSellerMapper.xml 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zhongzheng.modules.distribution.mapper.DistributionSellerMapper">
  6. <resultMap type="com.zhongzheng.modules.distribution.domain.DistributionSeller" id="DistributionSellerResult">
  7. <result property="sellerId" column="seller_id"/>
  8. <result property="realname" column="realname"/>
  9. <result property="status" column="status"/>
  10. <result property="createTime" column="create_time"/>
  11. <result property="updateTime" column="update_time"/>
  12. <result property="userAccount" column="user_account"/>
  13. <result property="gzhOpenId" column="gzh_open_id"/>
  14. <result property="unionId" column="union_id"/>
  15. <result property="parentId" column="parent_id"/>
  16. <result property="shareCode" column="share_code"/>
  17. <result property="registerFrom" column="register_from"/>
  18. </resultMap>
  19. <resultMap type="com.zhongzheng.modules.distribution.vo.DistributionSellerVo" id="DistributionSellerVoResult">
  20. <result property="sellerId" column="seller_id"/>
  21. <result property="realname" column="realname"/>
  22. <result property="status" column="status"/>
  23. <result property="userAccount" column="user_account"/>
  24. <result property="gzhOpenId" column="gzh_open_id"/>
  25. <result property="unionId" column="union_id"/>
  26. <result property="parentId" column="parent_id"/>
  27. <result property="shareCode" column="share_code"/>
  28. <result property="idCard" column="id_card" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
  29. <result property="phonenumber" column="phonenumber"/>
  30. <result property="avatar" column="avatar"/>
  31. <result property="cash" column="cash"/>
  32. <result property="usedCash" column="used_cash"/>
  33. <result property="freezeCash" column="freeze_cash"/>
  34. </resultMap>
  35. <select id="getSellerListByTenant" parameterType="com.zhongzheng.modules.top.distribution.bo.DistributionSellerQuery" resultType="com.zhongzheng.modules.distribution.vo.DistributionSellerVo">
  36. SELECT ds.*,sr.realname,sr.user_account,t.tenant_name,
  37. (SELECT COUNT(*) FROM distribution_seller dr WHERE dr.parent_id = ds.seller_id) promotionNum
  38. FROM `distribution_seller` ds
  39. LEFT JOIN distribution_seller sr ON ds.parent_id = sr.seller_id
  40. LEFT JOIN sys_tenant t ON ds.tenant_id = t.tenant_id
  41. WHERE 1 = 1
  42. <if test="tenantId != null and tenantId != ''">
  43. AND ds.tenant_id = #{tenantId}
  44. </if>
  45. <if test="parentName != null and parentName != ''">
  46. AND sr.realname = #{parentName}
  47. </if>
  48. <if test="realname != null and realname != ''">
  49. AND ds.realname = #{realname}
  50. </if>
  51. </select>
  52. <select id="findList" parameterType="com.zhongzheng.modules.top.distribution.bo.DistributionSellerQuery" resultMap="DistributionSellerVoResult">
  53. SELECT
  54. s.*,
  55. u.id_card,
  56. u.phonenumber
  57. FROM
  58. distribution_seller s
  59. LEFT JOIN sys_user u ON s.seller_id = u.seller_id
  60. ORDER BY
  61. s.seller_id DESC
  62. </select>
  63. <select id="findDetail" parameterType="Long" resultMap="DistributionSellerVoResult">
  64. SELECT
  65. s.*,
  66. u.id_card,
  67. u.phonenumber,
  68. u.avatar
  69. FROM
  70. distribution_seller s
  71. LEFT JOIN sys_user u ON s.seller_id = u.seller_id
  72. WHERE s.seller_id = #{sellerId}
  73. </select>
  74. </mapper>