|
|
@@ -41,6 +41,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
@@ -52,7 +53,6 @@ import java.util.Map;
|
|
|
@RestController
|
|
|
@RequestMapping("blade-user")
|
|
|
@AllArgsConstructor
|
|
|
-@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
|
|
|
public class UserController {
|
|
|
|
|
|
private IUserService userService;
|
|
|
@@ -64,6 +64,7 @@ public class UserController {
|
|
|
*/
|
|
|
@ApiOperation(value = "查看详情", notes = "传入id", position = 1)
|
|
|
@GetMapping("/detail")
|
|
|
+ @PreAuth(RoleConstant.HAS_ROLE_ADMIN)
|
|
|
public R<UserVO> detail(User user) {
|
|
|
User detail = userService.getOne(Condition.getQueryWrapper(user));
|
|
|
UserWrapper userWrapper = new UserWrapper(userService, dictService);
|
|
|
@@ -79,6 +80,7 @@ public class UserController {
|
|
|
@ApiImplicitParam(name = "realName", value = "姓名", paramType = "query", dataType = "string")
|
|
|
})
|
|
|
@ApiOperation(value = "列表", notes = "传入account和realName", position = 2)
|
|
|
+ @PreAuth(RoleConstant.HAS_ROLE_ADMIN)
|
|
|
public R<IPage<UserVO>> list(@ApiIgnore @RequestParam Map<String, Object> user, Query query, BladeUser bladeUser) {
|
|
|
QueryWrapper<User> queryWrapper = Condition.getQueryWrapper(user, User.class);
|
|
|
IPage<User> pages = userService.page(Condition.getPage(query), (!bladeUser.getTenantCode().equals(BladeConstant.ADMIN_TENANT_CODE)) ? queryWrapper.lambda().eq(User::getTenantCode, bladeUser.getTenantCode()) : queryWrapper);
|
|
|
@@ -91,6 +93,7 @@ public class UserController {
|
|
|
*/
|
|
|
@PostMapping("/submit")
|
|
|
@ApiOperation(value = "新增或修改", notes = "传入User", position = 3)
|
|
|
+ @PreAuth(RoleConstant.HAS_ROLE_ADMIN)
|
|
|
public R submit(@Valid @RequestBody User user) {
|
|
|
return R.status(userService.submit(user));
|
|
|
}
|
|
|
@@ -99,7 +102,8 @@ public class UserController {
|
|
|
* 修改
|
|
|
*/
|
|
|
@PostMapping("/update")
|
|
|
- @ApiOperation(value = "修改", notes = "传入User", position = 3)
|
|
|
+ @ApiOperation(value = "修改", notes = "传入User", position = 4)
|
|
|
+ @PreAuth(RoleConstant.HAS_ROLE_ADMIN)
|
|
|
public R update(@Valid @RequestBody User user) {
|
|
|
return R.status(userService.updateById(user));
|
|
|
}
|
|
|
@@ -108,7 +112,8 @@ public class UserController {
|
|
|
* 删除
|
|
|
*/
|
|
|
@PostMapping("/remove")
|
|
|
- @ApiOperation(value = "删除", notes = "传入地基和", position = 4)
|
|
|
+ @ApiOperation(value = "删除", notes = "传入地基和", position = 5)
|
|
|
+ @PreAuth(RoleConstant.HAS_ROLE_ADMIN)
|
|
|
public R remove(@RequestParam String ids) {
|
|
|
return R.status(userService.deleteLogic(Func.toIntList(ids)));
|
|
|
}
|
|
|
@@ -121,18 +126,40 @@ public class UserController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/grant")
|
|
|
- @ApiOperation(value = "权限设置", notes = "传入roleId集合以及menuId集合", position = 5)
|
|
|
+ @ApiOperation(value = "权限设置", notes = "传入roleId集合以及menuId集合", position = 6)
|
|
|
+ @PreAuth(RoleConstant.HAS_ROLE_ADMIN)
|
|
|
public R grant(@ApiParam(value = "userId集合", required = true) @RequestParam String userIds,
|
|
|
@ApiParam(value = "roleId集合", required = true) @RequestParam String roleIds) {
|
|
|
boolean temp = userService.grant(userIds, roleIds);
|
|
|
return R.status(temp);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 重置密码
|
|
|
+ *
|
|
|
+ * @param userIds
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/reset-password")
|
|
|
- @ApiOperation(value = "初始化密码", notes = "传入userId集合", position = 5)
|
|
|
+ @ApiOperation(value = "初始化密码", notes = "传入userId集合", position = 7)
|
|
|
+ @PreAuth(RoleConstant.HAS_ROLE_ADMIN)
|
|
|
public R resetPassword(@ApiParam(value = "userId集合", required = true) @RequestParam String userIds) {
|
|
|
boolean temp = userService.resetPassword(userIds);
|
|
|
return R.status(temp);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 用户列表
|
|
|
+ *
|
|
|
+ * @param user
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/user-list")
|
|
|
+ @ApiOperation(value = "用户列表", notes = "传入user", position = 8)
|
|
|
+ public R<List<User>> userList(User user) {
|
|
|
+ List<User> list = userService.list(Condition.getQueryWrapper(user));
|
|
|
+ return R.data(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|