From 074513acdfed38c8537a046801ee5dbc8f01e2eb Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 22 二月 2024 10:06:42 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/UserController.java |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/UserController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/UserController.java
index bcaba13..c1dcd49 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/UserController.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/UserController.java
@@ -36,6 +36,14 @@
     }
 
     @PreAuthorize("hasAuthority('system:user:list')")
+    @PostMapping("/user/page1")
+    public R page1(@RequestBody Map<String, Object> map) {
+        BaseParam baseParam = buildParam(map, BaseParam.class);
+        PageParam<User, BaseParam> pageParam = new PageParam<>(baseParam, User.class);
+        return R.ok().add(userService.pageRel(pageParam));
+    }
+
+    @PreAuthorize("hasAuthority('system:user:list')")
     @PostMapping("/user/list")
     public R list(@RequestBody Map<String, Object> map) {
         return R.ok().add(userService.list());
@@ -51,6 +59,18 @@
     @OperationLog("娣诲姞鐢ㄦ埛")
     @PostMapping("/user/save")
     public R save(@RequestBody User user) {
+        if (!Cools.isEmpty(user.getUsername())
+                && userService.count(new LambdaQueryWrapper<User>().eq(User::getUsername, user.getUsername())) > 0) {
+            return R.error("鐧诲綍璐﹀彿宸插瓨鍦�");
+        }
+        if (!Cools.isEmpty(user.getNickname())
+                && userService.count(new LambdaQueryWrapper<User>().eq(User::getNickname, user.getNickname())) > 0) {
+            return R.error("鐢ㄦ埛鍚嶇О宸插瓨鍦�");
+        }
+        if (!Cools.isEmpty(user.getPhone())
+                && userService.count(new LambdaQueryWrapper<User>().eq(User::getPhone, user.getPhone())) > 0) {
+            return R.error("鎵嬫満鍙峰凡瀛樺湪");
+        }
 
         user.setPassword(userService.encodePassword(COMMON_PASSWORD));
 
@@ -69,6 +89,21 @@
     @OperationLog("淇敼鐢ㄦ埛")
     @PostMapping("/user/update")
     public R update(@RequestBody User user) {
+        if (!Cools.isEmpty(user.getUsername()) && userService.count(new LambdaQueryWrapper<User>()
+                .eq(User::getUsername, user.getUsername())
+                .ne(User::getId, user.getId())) > 0) {
+            return R.error("鐧诲綍璐﹀彿宸插瓨鍦�");
+        }
+        if (!Cools.isEmpty(user.getNickname()) && userService.count(new LambdaQueryWrapper<User>()
+                .eq(User::getNickname, user.getNickname())
+                .ne(User::getId, user.getId())) > 0) {
+            return R.error("鐢ㄦ埛鍚嶇О宸插瓨鍦�");
+        }
+        if (!Cools.isEmpty(user.getPhone()) && userService.count(new LambdaQueryWrapper<User>()
+                .eq(User::getPhone, user.getPhone())
+                .ne(User::getId, user.getId())) > 0) {
+            return R.error("鎵嬫満鍙峰凡瀛樺湪");
+        }
 
         if (!Cools.isEmpty(user.getPassword())) {
             user.setPassword(userService.encodePassword(user.getPassword()));

--
Gitblit v1.9.1