From dcb61e1a63ff32ebb2388955c622374b434ff2d6 Mon Sep 17 00:00:00 2001 From: lbw Date: Mon, 20 Jun 2022 11:19:57 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20Introducing=20new=20features.=20?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=A0=A1=E9=AA=8C=E6=8E=A5=E5=8F=A3=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pig/common/core/exception/ErrorCodes.java | 5 ++++ .../resources/i18n/messages_zh_CN.properties | 29 ++++++++++--------- .../security/component/PermissionService.java | 1 + .../pig/admin/controller/UserController.java | 18 +++++++----- 4 files changed, 32 insertions(+), 21 deletions(-) diff --git a/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/exception/ErrorCodes.java b/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/exception/ErrorCodes.java index 36696ec2..4161e548 100644 --- a/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/exception/ErrorCodes.java +++ b/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/exception/ErrorCodes.java @@ -21,6 +21,11 @@ public interface ErrorCodes { /** * 用户已存在 */ + String SYS_USER_EXISTING = "sys.user.existing"; + + /** + * 用户名已存在 + */ String SYS_USER_USERNAME_EXISTING = "sys.user.username.existing"; /** diff --git a/pig-common/pig-common-core/src/main/resources/i18n/messages_zh_CN.properties b/pig-common/pig-common-core/src/main/resources/i18n/messages_zh_CN.properties index 4f8556ab..6812a666 100644 --- a/pig-common/pig-common-core/src/main/resources/i18n/messages_zh_CN.properties +++ b/pig-common/pig-common-core/src/main/resources/i18n/messages_zh_CN.properties @@ -1,23 +1,24 @@ -sys.user.update.passwordError=\u539f\u5bc6\u7801\u9519\u8bef\uff0c\u4fee\u6539\u5931\u8d25 -sys.user.query.error=\u83b7\u53d6\u5f53\u524d\u7528\u6237\u4fe1\u606f\u5931\u8d25 +sys.user.update.passwordError=\u539F\u5BC6\u7801\u9519\u8BEF\uFF0C\u4FEE\u6539\u5931\u8D25 +sys.user.query.error=\u83B7\u53D6\u5F53\u524D\u7528\u6237\u4FE1\u606F\u5931\u8D25 +sys.user.existing=\u7528\u6237\u5DF2\u5B58\u5728 sys.user.username.existing={0} \u7528\u6237\u540D\u5DF2\u5B58\u5728 -sys.user.userInfo.empty={0} \u7528\u6237\u4fe1\u606f\u4e3a\u7a7a +sys.user.userInfo.empty={0} \u7528\u6237\u4FE1\u606F\u4E3A\u7A7A -sys.dept.deptName.inexistence={0} \u90e8\u95e8\u540d\u79f0\u4e0d\u5b58\u5728 +sys.dept.deptName.inexistence={0} \u90E8\u95E8\u540D\u79F0\u4E0D\u5B58\u5728 -sys.post.postName.inexistence={0} \u5c97\u4f4d\u540d\u79f0\u4e0d\u5b58\u5728 -sys.post.nameOrCode.existing={0} {1} \u5c97\u4f4d\u540d\u6216\u5c97\u4f4d\u7f16\u7801\u5df2\u7ecf\u5b58\u5728 +sys.post.postName.inexistence={0} \u5C97\u4F4D\u540D\u79F0\u4E0D\u5B58\u5728 +sys.post.nameOrCode.existing={0} {1} \u5C97\u4F4D\u540D\u6216\u5C97\u4F4D\u7F16\u7801\u5DF2\u7ECF\u5B58\u5728 -sys.role.roleName.inexistence={0} \u89d2\u8272\u540d\u79f0\u4e0d\u5b58\u5728 -sys.role.nameOrCode.existing={0} {1} \u89d2\u8272\u540d\u6216\u89d2\u8272\u7f16\u7801\u5df2\u7ecf\u5b58\u5728 +sys.role.roleName.inexistence={0} \u89D2\u8272\u540D\u79F0\u4E0D\u5B58\u5728 +sys.role.nameOrCode.existing={0} {1} \u89D2\u8272\u540D\u6216\u89D2\u8272\u7F16\u7801\u5DF2\u7ECF\u5B58\u5728 -sys.param.delete.system=\u7cfb\u7edf\u5185\u7f6e\u53c2\u6570\u4e0d\u80fd\u5220\u9664 +sys.param.delete.system=\u7CFB\u7EDF\u5185\u7F6E\u53C2\u6570\u4E0D\u80FD\u5220\u9664 sys.param.config.error={0} \u7CFB\u7EDF\u53C2\u6570\u914D\u7F6E\u9519\u8BEF -sys.menu.delete.existing=\u83dc\u5355\u542b\u6709\u4e0b\u7ea7\u4e0d\u80fd\u5220\u9664 +sys.menu.delete.existing=\u83DC\u5355\u542B\u6709\u4E0B\u7EA7\u4E0D\u80FD\u5220\u9664 -sys.app.sms.often=\u9a8c\u8bc1\u7801\u53d1\u9001\u8fc7\u9891\u7e41 -sys.app.phone.unregistered={0} \u624b\u673a\u53f7\u672a\u6ce8\u518c +sys.app.sms.often=\u9A8C\u8BC1\u7801\u53D1\u9001\u8FC7\u9891\u7E41 +sys.app.phone.unregistered={0} \u624B\u673A\u53F7\u672A\u6CE8\u518C -sys.dict.delete.system=\u7cfb\u7edf\u5185\u7f6e\u5b57\u5178\u9879\u76ee\u4e0d\u80fd\u5220\u9664 -sys.dict.update.system=\u7cfb\u7edf\u5185\u7f6e\u5b57\u5178\u9879\u76ee\u4e0d\u80fd\u4fee\u6539 +sys.dict.delete.system=\u7CFB\u7EDF\u5185\u7F6E\u5B57\u5178\u9879\u76EE\u4E0D\u80FD\u5220\u9664 +sys.dict.update.system=\u7CFB\u7EDF\u5185\u7F6E\u5B57\u5178\u9879\u76EE\u4E0D\u80FD\u4FEE\u6539 diff --git a/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PermissionService.java b/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PermissionService.java index 00227c8e..fcf394a4 100755 --- a/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PermissionService.java +++ b/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PermissionService.java @@ -1,3 +1,4 @@ + /* * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/UserController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/UserController.java index b1f2194d..7fc3c72e 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/UserController.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/UserController.java @@ -16,6 +16,7 @@ package com.pig4cloud.pig.admin.controller; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -115,15 +116,18 @@ public class UserController { } /** - * 根据用户名查询用户信息 - * @param username 用户名 + * 判断用户是否存在 + * @param userDTO 查询条件 * @return */ - @GetMapping("/details/{username}") - public R user(@PathVariable String username) { - SysUser condition = new SysUser(); - condition.setUsername(username); - return R.ok(userService.getOne(new QueryWrapper<>(condition))); + @Inner(false) + @GetMapping("/check/exsit") + public R isExsit(UserDTO userDTO) { + List sysUserList = userService.list(new QueryWrapper<>(userDTO)); + if (CollUtil.isNotEmpty(sysUserList)) { + return R.ok(Boolean.TRUE, MsgUtils.getMessage(ErrorCodes.SYS_USER_EXISTING)); + } + return R.ok(Boolean.FALSE); } /**