Browse Source

完成ShopDealerApply经销商入驻模块

main
科技小王子 7 days ago
parent
commit
c431a12560
  1. 8
      src/main/java/com/gxwebsoft/shop/controller/ShopDealerApplyController.java
  2. 2
      src/main/java/com/gxwebsoft/shop/controller/ShopDealerUserController.java
  3. 6
      src/main/java/com/gxwebsoft/shop/entity/ShopGift.java
  4. 2
      src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGiftMapper.xml
  5. 2
      src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerApplyServiceImpl.java
  6. 2
      src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerUserServiceImpl.java

8
src/main/java/com/gxwebsoft/shop/controller/ShopDealerApplyController.java

@ -54,7 +54,7 @@ public class ShopDealerApplyController extends BaseController {
}
@PreAuthorize("hasAuthority('shop:shopDealerApply:list')")
@Operation(summary = "根据id查询分销商申请记录表")
@Operation(summary = "根据userId查询分销商申请记录表")
@GetMapping("/{id}")
public ApiResult<ShopDealerApply> get(@PathVariable("id") Integer id) {
// 使用关联查询
@ -72,6 +72,12 @@ public class ShopDealerApplyController extends BaseController {
shopDealerApply.setApplyTime(LocalDateTime.now());
shopDealerApply.setUserId(loginUser.getUserId());
}
if (shopDealerApply.getRefereeId() != null) {
if(shopDealerUserService.getByIdRel(shopDealerApply.getRefereeId()) == null){
return fail("推荐人不存在");
}
}
if (shopDealerApplyService.save(shopDealerApply)) {
return success("添加成功");
}

2
src/main/java/com/gxwebsoft/shop/controller/ShopDealerUserController.java

@ -47,7 +47,7 @@ public class ShopDealerUserController extends BaseController {
}
@PreAuthorize("hasAuthority('shop:shopDealerUser:list')")
@Operation(summary = "根据id查询分销商用户记录表")
@Operation(summary = "根据userId查询分销商用户")
@GetMapping("/{id}")
public ApiResult<ShopDealerUser> get(@PathVariable("id") Integer id) {
// 使用关联查询

6
src/main/java/com/gxwebsoft/shop/entity/ShopGift.java

@ -3,6 +3,8 @@ 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.math.BigDecimal;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.TableLogic;
@ -43,6 +45,10 @@ public class ShopGift implements Serializable {
@TableField(exist = false)
private String goodsImage;
@Schema(description = "面值")
@TableField(exist = false)
private BigDecimal faceValue;
@Schema(description = "使用地点")
private String useLocation;

2
src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGiftMapper.xml

@ -4,7 +4,7 @@
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*,b.name as goodsName,b.image as goodsImage,c.nickname, u.nickname as operatorUserName
SELECT a.*,b.name as goodsName, b.price as faceValue, b.image as goodsImage,c.nickname, u.nickname as operatorUserName
FROM shop_gift a
LEFT JOIN shop_goods b ON a.goods_id = b.goods_id
LEFT JOIN gxwebsoft_core.sys_user c ON a.user_id = c.user_id

2
src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerApplyServiceImpl.java

@ -40,7 +40,7 @@ public class ShopDealerApplyServiceImpl extends ServiceImpl<ShopDealerApplyMappe
@Override
public ShopDealerApply getByIdRel(Integer applyId) {
ShopDealerApplyParam param = new ShopDealerApplyParam();
param.setApplyId(applyId);
param.setUserId(applyId);
return param.getOne(baseMapper.selectListRel(param));
}

2
src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerUserServiceImpl.java

@ -40,7 +40,7 @@ public class ShopDealerUserServiceImpl extends ServiceImpl<ShopDealerUserMapper,
@Override
public ShopDealerUser getByIdRel(Integer id) {
ShopDealerUserParam param = new ShopDealerUserParam();
param.setId(id);
param.setUserId(id);
return param.getOne(baseMapper.selectListRel(param));
}

Loading…
Cancel
Save