From 3bf14a7c469a7157734b25b439eb9e906522fcf9 Mon Sep 17 00:00:00 2001
From: zjk <852185829@qq.com>
Date: 星期一, 12 十月 2026 14:45:12 +0800
Subject: [PATCH] feat(miniapp, ruoyi-auth, ruoyi-user): 实现C端会员小程序登录注册与推荐码系统

---
 hugray-server/ruoyi-modules/ruoyi-user/src/main/resources/mapper/user/AccountUserMapper.xml |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/hugray-server/ruoyi-modules/ruoyi-user/src/main/resources/mapper/user/AccountUserMapper.xml b/hugray-server/ruoyi-modules/ruoyi-user/src/main/resources/mapper/user/AccountUserMapper.xml
index e7c989d..f2594b3 100644
--- a/hugray-server/ruoyi-modules/ruoyi-user/src/main/resources/mapper/user/AccountUserMapper.xml
+++ b/hugray-server/ruoyi-modules/ruoyi-user/src/main/resources/mapper/user/AccountUserMapper.xml
@@ -15,6 +15,8 @@
         <result property="birthday"   column="birthday"    />
         <result property="status"     column="status"      />
         <result property="delFlag"    column="del_flag"    />
+        <result property="myReferralCode"   column="my_referral_code"   />
+        <result property="referrerUserId"   column="referrer_user_id"   />
         <result property="createBy"   column="create_by"   />
         <result property="createTime" column="create_time" />
         <result property="updateBy"   column="update_by"   />
@@ -23,7 +25,7 @@
     </resultMap>
 
     <sql id="selectAccountUserVo">
-        select user_id, username, phone, password, nickname, avatar, gender, birthday, status, del_flag, create_by, create_time, update_by, update_time, remark
+        select user_id, username, phone, password, nickname, avatar, gender, birthday, status, del_flag, my_referral_code, referrer_user_id, create_by, create_time, update_by, update_time, remark
         from account_user
     </sql>
 
@@ -61,6 +63,11 @@
         where del_flag = '0' and phone = #{phone}
     </select>
 
+    <select id="selectAccountUserByReferralCode" parameterType="String" resultMap="AccountUserResult">
+        <include refid="selectAccountUserVo"/>
+        where del_flag = '0' and my_referral_code = #{referralCode}
+    </select>
+
     <insert id="insertAccountUser" parameterType="AccountUser" useGeneratedKeys="true" keyProperty="userId">
         insert into account_user(
             <if test="userName != null and userName != ''">username,</if>
@@ -71,6 +78,8 @@
             <if test="gender != null and gender != ''">gender,</if>
             <if test="birthday != null">birthday,</if>
             <if test="status != null and status != ''">status,</if>
+            <if test="myReferralCode != null and myReferralCode != ''">my_referral_code,</if>
+            <if test="referrerUserId != null">referrer_user_id,</if>
             <if test="remark != null">remark,</if>
             <if test="createBy != null and createBy != ''">create_by,</if>
             create_time
@@ -83,6 +92,8 @@
             <if test="gender != null and gender != ''">#{gender},</if>
             <if test="birthday != null">#{birthday},</if>
             <if test="status != null and status != ''">#{status},</if>
+            <if test="myReferralCode != null and myReferralCode != ''">#{myReferralCode},</if>
+            <if test="referrerUserId != null">#{referrerUserId},</if>
             <if test="remark != null">#{remark},</if>
             <if test="createBy != null and createBy != ''">#{createBy},</if>
             sysdate()
@@ -100,6 +111,8 @@
             <if test="gender != null and gender != ''">gender = #{gender},</if>
             <if test="birthday != null">birthday = #{birthday},</if>
             <if test="status != null and status != ''">status = #{status},</if>
+            <if test="myReferralCode != null and myReferralCode != ''">my_referral_code = #{myReferralCode},</if>
+            <if test="referrerUserId != null">referrer_user_id = #{referrerUserId},</if>
             <if test="remark != null">remark = #{remark},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             update_time = sysdate()

--
Gitblit v1.7.1