You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
36 lines
1.1 KiB
package com.aiprose.scauth.controller;
|
|
|
|
import com.aiprose.scauth.entity.Role;
|
|
import com.aiprose.scauth.entity.User;
|
|
import com.aiprose.scauth.entity.UserRole;
|
|
import com.aiprose.scauth.service.IRoleService;
|
|
import com.aiprose.scauth.service.IUserService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
/**
|
|
* @author nelson
|
|
* @desc TODO
|
|
* @company 北京中经网软件有限公司
|
|
* @date 2020/11/27 17:21
|
|
* @since 1.0
|
|
*/
|
|
@RestController()
|
|
@RequestMapping("role")
|
|
public class RoleController {
|
|
|
|
@Autowired
|
|
private IRoleService roleService;
|
|
|
|
// roleName 必须要有ROLE_前缀
|
|
@PostMapping("save")
|
|
public UserRole save(String roleName,Integer userId){
|
|
Role role = new Role();
|
|
role.setRole(roleName);
|
|
UserRole userRole = roleService.save(role,userId);
|
|
return userRole;
|
|
}
|
|
}
|
|
|