提交 b0ce7494 编写于 作者: 别团等shy哥发育's avatar 别团等shy哥发育

后台管理-用户管理-用户详情接口开发

上级 9d8cbeb2
...@@ -6,12 +6,15 @@ import com.atguigu.yygh.vo.user.UserInfoQueryVo; ...@@ -6,12 +6,15 @@ import com.atguigu.yygh.vo.user.UserInfoQueryVo;
import com.atguigu.yygu.common.result.Result; import com.atguigu.yygu.common.result.Result;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController @RestController
@RequestMapping("/admin/user") @RequestMapping("/admin/user")
public class UserController { public class UserController {
...@@ -19,6 +22,7 @@ public class UserController { ...@@ -19,6 +22,7 @@ public class UserController {
private UserInfoService userInfoService; private UserInfoService userInfoService;
//用户列表(条件查询带分页) //用户列表(条件查询带分页)
@ApiOperation(value = "用户列表条件查询带分页")
@GetMapping("{page}/{limit}") @GetMapping("{page}/{limit}")
public Result list(@PathVariable Long page, public Result list(@PathVariable Long page,
@PathVariable Long limit, @PathVariable Long limit,
...@@ -29,10 +33,19 @@ public class UserController { ...@@ -29,10 +33,19 @@ public class UserController {
} }
//用户锁定 //用户锁定
@ApiOperation(value = "用户锁定")
@GetMapping("lock/{userId}/{status}") @GetMapping("lock/{userId}/{status}")
public Result lock(@PathVariable Long userId, public Result lock(@PathVariable Long userId,
@PathVariable Integer status){ @PathVariable Integer status){
userInfoService.lock(userId,status); userInfoService.lock(userId,status);
return Result.ok(); return Result.ok();
} }
//用户详情
@ApiOperation(value = "用户详情")
@GetMapping("show/{userId}")
public Result show(@PathVariable Long userId){
Map<String,Object> map = userInfoService.show(userId);
return Result.ok(map);
}
} }
...@@ -25,4 +25,7 @@ public interface UserInfoService extends IService<UserInfo> { ...@@ -25,4 +25,7 @@ public interface UserInfoService extends IService<UserInfo> {
//用户锁定 //用户锁定
void lock(Long userId, Integer status); void lock(Long userId, Integer status);
//用户详情
Map<String, Object> show(Long userId);
} }
package com.atguigu.yygh.user.service.impl; package com.atguigu.yygh.user.service.impl;
import com.atguigu.yygh.enums.AuthStatusEnum; import com.atguigu.yygh.enums.AuthStatusEnum;
import com.atguigu.yygh.model.user.Patient;
import com.atguigu.yygh.model.user.UserInfo; import com.atguigu.yygh.model.user.UserInfo;
import com.atguigu.yygh.user.mapper.UserInfoMapper; import com.atguigu.yygh.user.mapper.UserInfoMapper;
import com.atguigu.yygh.user.service.PatientService;
import com.atguigu.yygh.user.service.UserInfoService; import com.atguigu.yygh.user.service.UserInfoService;
import com.atguigu.yygh.vo.user.LoginVo; import com.atguigu.yygh.vo.user.LoginVo;
import com.atguigu.yygh.vo.user.UserAuthVo; import com.atguigu.yygh.vo.user.UserAuthVo;
...@@ -20,6 +22,7 @@ import org.springframework.stereotype.Service; ...@@ -20,6 +22,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@Service @Service
...@@ -28,6 +31,9 @@ public class UserInfoServiceImpl extends ...@@ -28,6 +31,9 @@ public class UserInfoServiceImpl extends
@Autowired @Autowired
private RedisTemplate<String,String> redisTemplate; private RedisTemplate<String,String> redisTemplate;
@Autowired
private PatientService patientService;
//用户手机号登录接口 //用户手机号登录接口
@Override @Override
public Map<String, Object> loginUser(LoginVo loginVo) { public Map<String, Object> loginUser(LoginVo loginVo) {
...@@ -163,6 +169,20 @@ public class UserInfoServiceImpl extends ...@@ -163,6 +169,20 @@ public class UserInfoServiceImpl extends
} }
} }
//用户详情
@Override
public Map<String, Object> show(Long userId) {
Map<String,Object> map = new HashMap<>();
//根据userid查询用户基本信息
UserInfo userInfo = this.packageUserInfo(baseMapper.selectById(userId));
map.put("userInfo",userInfo);
//根据userid查询就诊人信息
List<Patient> patientList = patientService.findAllUserId(userId);
map.put("patientList",patientList);
return map;
}
//编号变成对应的值 //编号变成对应的值
private UserInfo packageUserInfo(UserInfo userInfo) { private UserInfo packageUserInfo(UserInfo userInfo) {
//处理认证状态编码 //处理认证状态编码
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册