feat(shop): 添加分销商和用户信息关联查询
- 在 ShopUserReferee 实体类中添加分销商和用户的相关字段- 更新 ShopUserRefereeMapper.xml,实现分销商和用户的关联查询 - 新增字段包括昵称、头像和手机号等信息
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.gxwebsoft.shop.entity;
|
package com.gxwebsoft.shop.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
@@ -29,9 +30,33 @@ public class ShopUserReferee implements Serializable {
|
|||||||
@Schema(description = "推荐人ID")
|
@Schema(description = "推荐人ID")
|
||||||
private Integer dealerId;
|
private Integer dealerId;
|
||||||
|
|
||||||
|
@Schema(description = "分销商名称")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String dealerName;
|
||||||
|
|
||||||
|
@Schema(description = "分销商头像")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String dealerAvatar;
|
||||||
|
|
||||||
|
@Schema(description = "分销商手机号")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String dealerPhone;
|
||||||
|
|
||||||
@Schema(description = "用户id(被推荐人)")
|
@Schema(description = "用户id(被推荐人)")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
|
@Schema(description = "昵称")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
@Schema(description = "头像")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
@Schema(description = "手机号")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String phone;
|
||||||
|
|
||||||
@Schema(description = "推荐关系层级(1,2,3)")
|
@Schema(description = "推荐关系层级(1,2,3)")
|
||||||
private Integer level;
|
private Integer level;
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,10 @@
|
|||||||
|
|
||||||
<!-- 关联查询sql -->
|
<!-- 关联查询sql -->
|
||||||
<sql id="selectSql">
|
<sql id="selectSql">
|
||||||
SELECT a.*
|
SELECT a.*, d.nickname AS dealerNickname, u.nickname, d.avatar AS dealerAvatar, u.avatar, d.phone AS dealerPhone, u.phone
|
||||||
FROM shop_user_referee a
|
FROM shop_user_referee a
|
||||||
|
LEFT JOIN gxwebsoft_core.sys_user d ON a.dealer_id = d.user_id
|
||||||
|
LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id
|
||||||
<where>
|
<where>
|
||||||
<if test="param.id != null">
|
<if test="param.id != null">
|
||||||
AND a.id = #{param.id}
|
AND a.id = #{param.id}
|
||||||
|
|||||||
Reference in New Issue
Block a user