From 61bfb895cdee1ff3bf22da89ae7167aa8ffe9da3 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Wed, 15 Feb 2023 18:01:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=A5=E5=8F=A3=EF=BC=9A?= =?UTF-8?q?=E5=BC=BA=E5=88=B6=E6=B3=A8=E5=86=8C=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xkrs/controller/SysUserController.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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); + } + /** * 删除系统用户 */