Commit f6e3fb00 authored by shangtx's avatar shangtx

feat: 用户类型接口

parent f35564e4
...@@ -33,8 +33,8 @@ public class HomeCommonController { ...@@ -33,8 +33,8 @@ public class HomeCommonController {
@ApiOperation(value = "首页") @ApiOperation(value = "首页")
@GetMapping("home") @GetMapping("home")
public Result<HomeViewVO> home(@CurrentUserId Long userId) { public Result<HomeViewVO> home() {
return homeCommonService.home(userId); return homeCommonService.home();
} }
@ApiOperation(value = "地域树") @ApiOperation(value = "地域树")
......
...@@ -47,5 +47,11 @@ public class UserController { ...@@ -47,5 +47,11 @@ public class UserController {
return ResultGenerator.success(userService.getInfo(userId)); 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 { ...@@ -64,7 +64,7 @@ public class HomeCommonService {
private SysParamMapper sysParamMapper; private SysParamMapper sysParamMapper;
public Result<HomeViewVO> home(Long userId) { public Result<HomeViewVO> home() {
// 轮播图 // 轮播图
List<Banner> bannerList = bannerMapper.selectAll(); List<Banner> bannerList = bannerMapper.selectAll();
List<BannerVO> bannerVOList = bannerList.parallelStream() List<BannerVO> bannerVOList = bannerList.parallelStream()
...@@ -84,7 +84,6 @@ public class HomeCommonService { ...@@ -84,7 +84,6 @@ public class HomeCommonService {
.bannerList(bannerVOList) .bannerList(bannerVOList)
.noticeList(homeNoticeVOList) .noticeList(homeNoticeVOList)
.serviceList(serviceResult.getData()) .serviceList(serviceResult.getData())
.roleType(getRoleType(userId))
.build(); .build();
return ResultGenerator.success(homeViewVO); return ResultGenerator.success(homeViewVO);
...@@ -110,14 +109,6 @@ public class HomeCommonService { ...@@ -110,14 +109,6 @@ public class HomeCommonService {
return ResultGenerator.success(list); 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() { public Result aboutUs() {
return ResultGenerator.success(sysParamMapper.selectOne(SysParam.builder().code(SysParamConstants.ABOUT_US).build()).getValue(), ""); return ResultGenerator.success(sysParamMapper.selectOne(SysParam.builder().code(SysParamConstants.ABOUT_US).build()).getValue(), "");
......
...@@ -143,4 +143,12 @@ public class UserService extends AbstractMapper<User> { ...@@ -143,4 +143,12 @@ public class UserService extends AbstractMapper<User> {
)); ));
return vo; 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