zjk
5 小时以前 8ea6a7dd1fcdbd4e22c564ed63a5a8023510161a
hugray-server/ruoyi-modules/ruoyi-user/src/main/resources/mapper/user/AccountUserMapper.xml
@@ -17,6 +17,7 @@
        <result property="systemLevel"     column="system_level"      />
        <result property="subjectType"     column="subject_type"      />
        <result property="authStatus"      column="auth_status"       />
        <result property="companyAuthStatus" column="company_auth_status" />
        <result property="city"            column="city"              />
        <result property="referrerId"      column="referrer_id"       />
        <result property="referrerBindTime" column="referrer_bind_time" />
@@ -53,7 +54,7 @@
    <sql id="selectAccountUserVo">
        select user_id, username, phone, password, nickname, avatar, gender, birthday, status,
               system_level, subject_type, auth_status, city,
               system_level, subject_type, auth_status, company_auth_status, city,
               referrer_id, referrer_bind_time, supplier_id, supplier_bind_time,
               buy_order_count, buy_amount_total, sell_order_count, sell_amount_total,
               purchase_order_count, purchase_amount_total, sell_profit_total,
@@ -245,6 +246,38 @@
    </update>
    <!--
        企业/个体认证审核通过/驳回后回写,只动 company_auth_status 一列;
        与 updateUserAuthStatus 分开是因为企业认证状态与个人认证状态是两列,不能互相覆盖。
        审核通过时服务层把 subjectType 一起带上(=2/3),此处 <if> 才写 subject_type;
        驳回时服务层不传 subjectType,列保持不变——否则会把未通过审核的会员标成企业主体。
    -->
    <update id="updateUserCompanyAuthStatus" parameterType="AccountUser">
        update account_user
        <set>
            company_auth_status = #{companyAuthStatus},
            <if test="subjectType != null and subjectType != ''">subject_type = #{subjectType},</if>
            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
            update_time = sysdate()
        </set>
        where user_id = #{userId} and del_flag = '0'
    </update>
    <!--
        头像更新专用:只动 avatar 一列。绝不能挂到共享的 updateAccountUser 上——
        那是后台编辑接口(/account/user)的入口,挂上去等于请求体带个 avatar 就能改任意会员头像。
        与 updateUserStatus / updateUserAuthStatus 同一套路,头像只能由会员本人在 C 端接口里改写。
    -->
    <update id="updateUserAvatar" parameterType="AccountUser">
        update account_user
        <set>
            avatar = #{avatar},
            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
            update_time = sysdate()
        </set>
        where user_id = #{userId} and del_flag = '0'
    </update>
    <!--
        服务商标识专用:与 updateUserAuthStatus 同一个套路——别的模块要给会员打标识,
        就单开一条只写该列的语句,绝不挂到共享的 insertAccountUser / updateAccountUser 上
        (那两个按 <if> 拼列,挂上去等于 /account/user 的请求体里带个 providerFlag 就能自己打标)。
@@ -272,6 +305,18 @@
        </foreach>
    </update>
    <!--
        「我邀请的」列表:按 referrer_id 过滤 + referrer_bind_time 倒序,命中 idx_account_user_referrer。
        显式列出所需列(禁 SELECT *);不挂 join,避免干扰 PageHelper 的 count SQL。
        referrer_bind_time 为空的历史行,MySQL 中 NULL 视为最小值,倒序时自然排在最后。
    -->
    <select id="selectInvitees" parameterType="Long" resultMap="AccountUserResult">
        select user_id, nickname, avatar, phone, system_level, referrer_bind_time, buy_amount_total
        from account_user
        where del_flag = '0' and referrer_id = #{referrerId}
        order by referrer_bind_time desc
    </select>
    <resultMap type="MemberOptionVo" id="MemberOptionVoResult">
        <id     property="userId"      column="user_id"      />
        <result property="memberName"  column="member_name"  />