Commit f6e3fb00 authored by shangtx's avatar shangtx

feat: 用户类型接口

parent f35564e4
......@@ -33,8 +33,8 @@ public class HomeCommonController {
@ApiOperation(value = "首页")
@GetMapping("home")
public Result<HomeViewVO> home(@CurrentUserId Long userId) {
return homeCommonService.home(userId);
public Result<HomeViewVO> home() {
return homeCommonService.home();
}
@ApiOperation(value = "地域树")
......
......@@ -47,5 +47,11 @@ public class UserController {
return ResultGenerator.success(userService.getInfo(userId));
}
@ApiOperation("用户身份 0 普通用户 1 客服 2 估价员 3 销售")
@GetMapping("/role-type")
public Result<Integer> getRoleType(@CurrentUserId Long userId) {
return ResultGenerator.success(userService.getRoleType(userId));
}
}
......@@ -64,7 +64,7 @@ public class HomeCommonService {
private SysParamMapper sysParamMapper;
public Result<HomeViewVO> home(Long userId) {
public Result<HomeViewVO> home() {
// 轮播图
List<Banner> bannerList = bannerMapper.selectAll();
List<BannerVO> bannerVOList = bannerList.parallelStream()
......@@ -84,7 +84,6 @@ public class HomeCommonService {
.bannerList(bannerVOList)
.noticeList(homeNoticeVOList)
.serviceList(serviceResult.getData())
.roleType(getRoleType(userId))
.build();
return ResultGenerator.success(homeViewVO);
......@@ -110,14 +109,6 @@ public class HomeCommonService {
return ResultGenerator.success(list);
}
private Integer getRoleType(Long userId) {
if(userId == null) {
return ServiceUserTypeEnum.USER.getId();
}
Condition condition = new Condition(User.class);
var user = userMapper.selectByPrimaryKey(userId);
return user.getRoleType();
}
public Result aboutUs() {
return ResultGenerator.success(sysParamMapper.selectOne(SysParam.builder().code(SysParamConstants.ABOUT_US).build()).getValue(), "");
......
......@@ -143,4 +143,12 @@ public class UserService extends AbstractMapper<User> {
));
return vo;
}
public Integer getRoleType(Long userId) {
if(userId == null) {
return ServiceUserTypeEnum.USER.getId();
}
var user = userMapper.selectByPrimaryKey(userId);
return user.getRoleType();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment