feat(shop): 新增根据userId查询推荐人接口- 在控制器中增加 getByUserId 接口,支持通过 userId 查询推荐人信息- 优化服务层逻辑,查询时限定 level 为 1 的推荐关系
- 引入 ShopUserReferee 实体类以支持关联查询功能
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.gxwebsoft.shop.controller;
|
package com.gxwebsoft.shop.controller;
|
||||||
|
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.shop.entity.ShopUserReferee;
|
||||||
import com.gxwebsoft.shop.service.ShopDealerRefereeService;
|
import com.gxwebsoft.shop.service.ShopDealerRefereeService;
|
||||||
import com.gxwebsoft.shop.entity.ShopDealerReferee;
|
import com.gxwebsoft.shop.entity.ShopDealerReferee;
|
||||||
import com.gxwebsoft.shop.param.ShopDealerRefereeParam;
|
import com.gxwebsoft.shop.param.ShopDealerRefereeParam;
|
||||||
@@ -55,6 +56,13 @@ public class ShopDealerRefereeController extends BaseController {
|
|||||||
return success(shopDealerRefereeService.getByIdRel(id));
|
return success(shopDealerRefereeService.getByIdRel(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据userId查询推荐人信息")
|
||||||
|
@GetMapping("/getByUserId/{userId}")
|
||||||
|
public ApiResult<ShopDealerReferee> getByUserId(@PathVariable("userId") Integer userId) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(shopDealerRefereeService.getByUserIdRel(userId));
|
||||||
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:shopDealerReferee:save')")
|
@PreAuthorize("hasAuthority('shop:shopDealerReferee:save')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@Operation(summary = "添加分销商推荐关系表")
|
@Operation(summary = "添加分销商推荐关系表")
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public class ShopDealerRefereeServiceImpl extends ServiceImpl<ShopDealerRefereeM
|
|||||||
public ShopDealerReferee getByUserIdRel(Integer userId) {
|
public ShopDealerReferee getByUserIdRel(Integer userId) {
|
||||||
ShopDealerRefereeParam param = new ShopDealerRefereeParam();
|
ShopDealerRefereeParam param = new ShopDealerRefereeParam();
|
||||||
param.setUserId(userId);
|
param.setUserId(userId);
|
||||||
|
param.setLevel(1);
|
||||||
return param.getOne(baseMapper.selectListRel(param));
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user