Commit 9711c09f authored by 黎博's avatar 黎博

update

parent 5ba76bdb
......@@ -2,14 +2,13 @@ package cn.qg.holmes.controller.auth;
import cn.qg.holmes.common.JsonResult;
import cn.qg.holmes.entity.auth.User;
import cn.qg.holmes.entity.auth.UserInfoVo;
import cn.qg.holmes.service.auth.LoginService;
import cn.qg.holmes.service.auth.TokenService;
import cn.qg.holmes.service.auth.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
......@@ -17,6 +16,7 @@ import java.util.Map;
@CrossOrigin
@RestController
@RequestMapping("/auth")
public class LoginController {
@Autowired
......@@ -55,4 +55,10 @@ public class LoginController {
tokenService.invalidateToken(token);
return JsonResult.buildSuccessResult("登出成功!", true);
}
@GetMapping("/info")
public JsonResult getInfo(String username) {
UserInfoVo userInfoVo = userService.getUserInfoByUsername(username);
return JsonResult.buildSuccessResult(userInfoVo);
}
}
package cn.qg.holmes.controller.auth;
import cn.qg.holmes.common.JsonResult;
import cn.qg.holmes.entity.auth.Role;
import cn.qg.holmes.service.auth.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@CrossOrigin
@RestController
@RequestMapping("/role")
public class RoleController {
@Autowired
RoleService roleService;
@PostMapping("/add")
public JsonResult addRole(@RequestBody Role role) {
return JsonResult.buildSuccessResult(roleService.save(role));
}
@PostMapping("/edit")
public JsonResult editRole(@RequestBody Role role) {
return JsonResult.buildSuccessResult(roleService.saveOrUpdate(role));
}
@PostMapping("/delete")
public JsonResult delRole(Integer roleId) {
return JsonResult.buildSuccessResult(roleService.removeById(roleId));
}
}
package cn.qg.holmes.controller.auth;
public class RolePermissionController {
}
package cn.qg.holmes.controller.auth;
import cn.qg.holmes.common.JsonResult;
import cn.qg.holmes.service.auth.UserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@CrossOrigin
@RestController
@RequestMapping("/user/role")
public class UserRoleController {
@Autowired
UserRoleService userRoleService;
@PostMapping("/add")
public JsonResult addUserRole() {
return null;
}
}
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