Browse Source

feat(shop): 添加分销商和用户信息关联查询

- 在 ShopUserReferee 实体类中添加分销商和用户的相关字段- 更新 ShopUserRefereeMapper.xml,实现分销商和用户的关联查询
- 新增字段包括昵称、头像和手机号等信息
pan
科技小王子 3 weeks ago
parent
commit
ce65eefb41
  1. 25
      src/main/java/com/gxwebsoft/shop/entity/ShopUserReferee.java
  2. 4
      src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserRefereeMapper.xml

25
src/main/java/com/gxwebsoft/shop/entity/ShopUserReferee.java

@ -1,6 +1,7 @@
package com.gxwebsoft.shop.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
@ -29,9 +30,33 @@ public class ShopUserReferee implements Serializable {
@Schema(description = "推荐人ID")
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(被推荐人)")
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)")
private Integer level;

4
src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserRefereeMapper.xml

@ -4,8 +4,10 @@
<!-- 关联查询sql -->
<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
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>
<if test="param.id != null">
AND a.id = #{param.id}

Loading…
Cancel
Save