diff --git a/src/main/java/com/xkrs/controller/SysUserController.java b/src/main/java/com/xkrs/controller/SysUserController.java index 14ea613..dd1432b 100644 --- a/src/main/java/com/xkrs/controller/SysUserController.java +++ b/src/main/java/com/xkrs/controller/SysUserController.java @@ -219,6 +219,23 @@ public class SysUserController { return sysUserService.addUser(userQo, servletRequest); } + /** + * 注册系统用户 + */ + @RequestMapping(value = "/add2", method = RequestMethod.POST) + public String addUser2(@Validated({SysUserQoInsert.class}) @RequestBody SysUserQo userQo, BindingResult bindingResult, HttpServletRequest servletRequest) { + // 验证数据合法性 + if (bindingResult.hasErrors()) { + return outputEncapsulationErrorList(bindingResult.getFieldErrors(), locale); + } + // 验证用户名是否重复 + if (!sysUserService.checkUserName(userQo.getUserName())) { + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL, "该账号已经注册,请勿重复注册", locale); + } + // 添加新用户 + return sysUserService.addUser(userQo, servletRequest); + } + /** * 删除系统用户 */