| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.zhongzheng.modules.distribution.mapper.DistributionSellerMapper">
- <resultMap type="com.zhongzheng.modules.distribution.domain.DistributionSeller" id="DistributionSellerResult">
- <result property="sellerId" column="seller_id"/>
- <result property="realname" column="realname"/>
- <result property="status" column="status"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="userAccount" column="user_account"/>
- <result property="gzhOpenId" column="gzh_open_id"/>
- <result property="unionId" column="union_id"/>
- <result property="parentId" column="parent_id"/>
- <result property="shareCode" column="share_code"/>
- <result property="registerFrom" column="register_from"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.distribution.vo.DistributionSellerVo" id="DistributionSellerVoResult">
- <result property="sellerId" column="seller_id"/>
- <result property="realname" column="realname"/>
- <result property="status" column="status"/>
- <result property="userAccount" column="user_account"/>
- <result property="gzhOpenId" column="gzh_open_id"/>
- <result property="unionId" column="union_id"/>
- <result property="parentId" column="parent_id"/>
- <result property="shareCode" column="share_code"/>
- <result property="idCard" column="id_card" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
- <result property="phonenumber" column="phonenumber"/>
- <result property="avatar" column="avatar"/>
- <result property="cash" column="cash"/>
- <result property="usedCash" column="used_cash"/>
- <result property="freezeCash" column="freeze_cash"/>
- <result property="parentName" column="parent_name"/>
- <result property="parentAccount" column="parent_account"/>
- <result property="promotionNum" column="promotion_num"/>
- </resultMap>
- <select id="getSellerListByTenant" parameterType="com.zhongzheng.modules.top.distribution.bo.DistributionSellerQuery" resultType="com.zhongzheng.modules.distribution.vo.DistributionSellerVo">
- SELECT ds.*,sr.realname as parentName,sr.user_account,t.tenant_name,u.id_card,u.phonenumber,
- (SELECT COUNT(*) FROM distribution_seller dr WHERE dr.parent_id = ds.seller_id) promotionNum
- FROM `distribution_seller` ds
- LEFT JOIN distribution_seller sr ON ds.parent_id = sr.seller_id
- LEFT JOIN sys_user u ON ds.seller_id = u.seller_id
- LEFT JOIN sys_tenant t ON ds.tenant_id = t.tenant_id
- WHERE 1 = 1
- <if test="tenantId != null and tenantId != ''">
- AND ds.tenant_id = #{tenantId}
- </if>
- <if test="parentName != null and parentName != ''">
- AND sr.realname = #{parentName}
- </if>
- <if test="realname != null and realname != ''">
- AND ds.realname = #{realname}
- </if>
- </select>
- <select id="findList" parameterType="com.zhongzheng.modules.top.distribution.bo.DistributionSellerQuery" resultMap="DistributionSellerVoResult">
- SELECT
- s.realname,
- s.seller_id,
- s.user_account,
- s.share_code,
- s.gzh_open_id,
- u.id_card,
- u.phonenumber,
- u.`status`,
- ds.realname as parent_name,
- ds.user_account as parent_account,
- (SELECT count(*) from distribution_seller d where d.parent_id = s.seller_id) as promotion_num
- FROM
- distribution_seller s
- LEFT JOIN sys_user u ON s.seller_id = u.seller_id
- LEFT JOIN distribution_seller ds on s.parent_id = ds.seller_id
- WHERE
- 1=1
- <if test="realname != null and realname != ''">
- AND s.realname like concat('%', #{realname}, '%')
- </if>
- <if test="parentName != null and parentName != ''">
- AND ds.realname like concat('%', #{parentName}, '%')
- </if>
- ORDER BY
- s.seller_id DESC
- </select>
- <select id="findDetail" parameterType="Long" resultMap="DistributionSellerVoResult">
- SELECT
- s.realname,
- s.seller_id,
- s.user_account,
- s.share_code,
- s.gzh_open_id,
- s.cash,
- s.used_cash,
- s.freeze_cash,
- u.id_card,
- u.phonenumber,
- u.`status`,
- u.avatar
- FROM
- distribution_seller s
- LEFT JOIN sys_user u ON s.seller_id = u.seller_id
- WHERE s.seller_id = #{sellerId}
- </select>
- </mapper>
|