增加用户接口
This commit is contained in:
parent
650f347ab6
commit
6a31efbd0b
|
@ -7,6 +7,7 @@ import com.isu.gaswellwatch.dto.ModifyPasswordDTO;
|
|||
import com.isu.gaswellwatch.dto.UserDTO;
|
||||
import com.isu.gaswellwatch.dto.UserEditDTO;
|
||||
import com.isu.gaswellwatch.entity.Response;
|
||||
import com.isu.gaswellwatch.entity.User;
|
||||
import com.isu.gaswellwatch.enums.LogType;
|
||||
import com.isu.gaswellwatch.service.UserService;
|
||||
import com.isu.gaswellwatch.vo.MenuTreeVO;
|
||||
|
@ -48,6 +49,11 @@ public class UserController {
|
|||
return Response.succeed();
|
||||
}
|
||||
|
||||
@GetMapping("/getUser")
|
||||
public Response<UserVO> getUser(@RequestParam Long id){
|
||||
return Response.succeed(userService.getUser(id));
|
||||
}
|
||||
|
||||
@PostMapping("/modifyPassword")
|
||||
public Response<String> modifyPassword(@RequestBody @Valid ModifyPasswordDTO modifyPasswordDTO){
|
||||
userService.modifyPassword(modifyPasswordDTO);
|
||||
|
|
|
@ -24,6 +24,7 @@ public interface UserService extends IService<User> {
|
|||
Page<UserVO> page(Integer currentPage, Integer pageSize, String username, String name, Long roleId, String isEnable);
|
||||
void add(UserDTO userDTO);
|
||||
void edit(UserEditDTO userEditDTO);
|
||||
UserVO getUser(Long id);
|
||||
void delete(Long id);
|
||||
void reset(Long id);
|
||||
void export(HttpServletResponse response, String username, String name, Long roleId, String isEnable);
|
||||
|
|
|
@ -145,6 +145,13 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
|||
addRelation(userEditDTO.getRoles(), user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserVO getUser(Long id) {
|
||||
User user = getById(id);
|
||||
if(user == null) return null;
|
||||
return userDao.selectUserInfo(user.getUsername());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Long id){
|
||||
//如果是超管 不能删除
|
||||
|
@ -157,6 +164,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void reset(Long id){
|
||||
User byId = getById(id);
|
||||
|
|
Loading…
Reference in New Issue