# Conflicts:
#	src/main/java/com/guaiguailang/harmony/controller/UserController.java
This commit is contained in:
萌狼蓝天 2024-11-05 16:09:47 +08:00
commit e5b519f56b

View File

@ -3,6 +3,7 @@ package com.guaiguailang.harmony.controller;
import com.guaiguailang.harmony.domain.dto.ParamLogin; import com.guaiguailang.harmony.domain.dto.ParamLogin;
import com.guaiguailang.harmony.domain.dto.ParamUserAdd; import com.guaiguailang.harmony.domain.dto.ParamUserAdd;
import com.guaiguailang.harmony.domain.dto.ParamUserList; import com.guaiguailang.harmony.domain.dto.ParamUserList;
import com.guaiguailang.harmony.domain.entity.UserInfo;
import com.guaiguailang.harmony.domain.vo.ResponseResult; import com.guaiguailang.harmony.domain.vo.ResponseResult;
import com.guaiguailang.harmony.service.UserService; import com.guaiguailang.harmony.service.UserService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
@ -10,6 +11,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.apache.commons.lang3.StringUtils;
@RestController @RestController
@ -59,7 +61,7 @@ public class UserController {
description = "加载可以分配的角色,以供用户添加子用户", description = "加载可以分配的角色,以供用户添加子用户",
tags = {"用户相关接口"} tags = {"用户相关接口"}
) )
@GetMapping("/add/roleList") @PostMapping("/add/roleList")
public ResponseEntity getRoleListWhenAddUser(@RequestParam String role){ public ResponseEntity getRoleListWhenAddUser(@RequestParam String role){
/* /*
@ -75,11 +77,17 @@ public class UserController {
) )
@PostMapping("/add") @PostMapping("/add")
public ResponseEntity addUser(@RequestBody ParamUserAdd userAddParam){ public ResponseEntity addUser(@RequestBody ParamUserAdd userAddParam){
// System.out.println("==============得到数据=======");
// System.out.println(userAddParam.toString()); // 校验字段
if (StringUtils.isAnyBlank(userAddParam.getName(), userAddParam.getUserName(), userAddParam.getPassword(), userAddParam.getRoleId())) {
return ResponseEntity.badRequest().body("用户账号不能为空");
} else {
return ResponseEntity.ok(userService.addUser(userAddParam)); return ResponseEntity.ok(userService.addUser(userAddParam));
} }
}
@Operation( @Operation(
summary = "用户 注册", summary = "用户 注册",
description = "用户自行注册", description = "用户自行注册",