zjk
7 小时以前 8ea6a7dd1fcdbd4e22c564ed63a5a8023510161a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package com.ruoyi.user.mapper;
 
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.user.domain.AccountUser;
import com.ruoyi.user.domain.vo.AccountUserVo;
import com.ruoyi.user.domain.vo.MemberOptionVo;
 
/**
 * 会员用户 数据层
 *
 * @author ruoyi
 */
public interface AccountUserMapper
{
    /**
     * 根据会员ID查询
     */
    public AccountUser selectAccountUserById(Long userId);
 
    /**
     * 根据用户名查询(查重用)
     */
    public AccountUser selectAccountUserByUsername(String userName);
 
    /**
     * 根据手机号查询(查重用)
     */
    public AccountUser selectAccountUserByPhone(String phone);
 
    /**
     * 根据推荐码查询(注册时定位推荐人)
     */
    public AccountUser selectAccountUserByReferralCode(String referralCode);
 
    /**
     * 查询会员列表
     */
    public List<AccountUser> selectAccountUserList(AccountUser accountUser);
 
    /**
     * 新增会员
     */
    public int insertAccountUser(AccountUser accountUser);
 
    /**
     * 修改会员
     */
    public int updateAccountUser(AccountUser accountUser);
 
    /**
     * 逻辑删除会员
     */
    public int deleteAccountUserById(Long userId);
 
    /**
     * 批量逻辑删除会员
     */
    public int deleteAccountUserByIds(Long[] userIds);
 
    /**
     * 查询会员详情(含推荐人/供货人的手机号、等级、昵称派生列)
     */
    public AccountUserVo selectAccountUserVoById(Long userId);
 
    /**
     * 修改推荐人/供货人关系(只更新关系相关的 4 列)
     */
    public int updateUserRelation(AccountUser accountUser);
 
    /**
     * 修改账户状态(只更新 status 列)
     */
    public int updateUserStatus(AccountUser accountUser);
 
    /**
     * 修改认证状态(只更新 auth_status 列,主体认证审核通过/驳回时回写)
     */
    public int updateUserAuthStatus(AccountUser accountUser);
 
    /**
     * 修改企业/个体认证状态(只更新 company_auth_status 列,企业认证审核通过/驳回时回写)
     *
     * 与 updateUserAuthStatus 的区别:个人认证写 auth_status,企业/个体认证写 company_auth_status,
     * 两者互不覆盖。审核通过时一并把 subject_type 同步为 2/3(由 XML 的 &lt;if&gt; 控制),
     * 驳回则不动 subject_type——避免审核未通过就把会员标成企业主体。
     */
    public int updateUserCompanyAuthStatus(AccountUser accountUser);
 
    /**
     * 修改会员头像(只更新 avatar 一列)
     *
     * 刻意单开:avatar 若挂到共享的 updateAccountUser 上,后台编辑接口(/account/user)
     * 的请求体带个 avatar 就能改任意会员头像。与 updateUserStatus / updateUserAuthStatus 同一套路,
     * 头像只能由会员本人在 C 端接口里改写。
     */
    public int updateUserAvatar(AccountUser accountUser);
 
    /**
     * 修改服务商标识(只更新 provider_flag 列,服务商建档时置 '1')
     *
     * 刻意不做进 insertAccountUser / updateAccountUser 的动态列:那两个是共享入口,
     * 挂上去等于 POST/PUT /account/user 的请求体里带个 providerFlag=1 就能把任意会员标成服务商。
     * 与 updateUserStatus / updateUserAuthStatus 一样,标识只能由模块内显式调用改写。
     */
    public int updateUserProviderFlag(AccountUser accountUser);
 
    /**
     * 查询某会员的直接下级(被邀请人)列表
     *
     * 按 referrer_id 过滤(命中 idx_account_user_referrer)+ referrer_bind_time 倒序;
     * 不挂 join,避免干扰 PageHelper 的 count SQL。
     */
    public List<AccountUser> selectInvitees(Long referrerId);
 
    /**
     * 搜索可绑定为城市公司档案关联用户的会员(限 L4,最多 20 条)
     *
     * keyword 与 keywordId 由服务层同时算好:keywordId 仅在 keyword 为纯数字时非空,
     * 用来等值命中用户编号——写进 SQL 的 like/cast 会让主键索引失效,故单独走一个参数。
     */
    public List<MemberOptionVo> selectL4MemberOptions(@Param("keyword") String keyword, @Param("keywordId") Long keywordId);
 
    /**
     * 搜索可指定为供货人的会员(等级严格高于指定会员,最多 20 条)
     *
     * levels 由服务层按 AccountUser.levelsAbove 算好,且必须非空——空集合会让 SQL 拼出
     * in () 的语法错误;该会员已是最高等级时服务层直接提前返回,不会走到这里。
     *
     * keyword 与 keywordId 的口径同 selectL4MemberOptions:keywordId 仅在 keyword 为
     * 纯数字时非空,用来等值命中用户编号(写进 SQL 的 like/cast 会让主键索引失效)。
     */
    public List<MemberOptionVo> selectSupplierCandidates(@Param("userId") Long userId,
                                                         @Param("levels") List<String> levels,
                                                         @Param("keyword") String keyword,
                                                         @Param("keywordId") Long keywordId);
}