From e306540bb81c24d91a38282566e3e0d774507df2 Mon Sep 17 00:00:00 2001 From: zhangzhiqiang Date: Thu, 1 Dec 2022 08:51:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E6=A0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nl/modules/system/service/dto/DeptTree.java | 3 ++- .../src/main/java/org/nl/sso/wql/SYS_DEPT.wql | 17 +++++++++++++++++ nladmin-ui/src/views/system/user/index.vue | 8 ++++---- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/dto/DeptTree.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/dto/DeptTree.java index ca8e585..20c8dbd 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/dto/DeptTree.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/dto/DeptTree.java @@ -31,8 +31,9 @@ import java.util.Objects; @Getter @Setter public class DeptTree implements Serializable { - + private Long Dept_id; + private Long pid; private String name; @JsonInclude(JsonInclude.Include.NON_EMPTY) diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/sso/wql/SYS_DEPT.wql b/nladmin-system/nlsso-server/src/main/java/org/nl/sso/wql/SYS_DEPT.wql index 2ac1a5b..cef3186 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/sso/wql/SYS_DEPT.wql +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/sso/wql/SYS_DEPT.wql @@ -92,3 +92,20 @@ ENDSELECT ENDPAGEQUERY ENDIF + + IF 输入.flag = "2" + PAGEQUERY + SELECT + max(t3.childId) + from + ( + select *, + if( find_in_set(t1.pid, @p) > 0,@p := concat(@p,',',id),0 ) as childId + from + (select dept_id as id, pid from sys_dept t order by id) t1, + (select @p := '输入.pid') t2 + ) t3 + where childId != '0' + ENDSELECT + ENDPAGEQUERY + ENDIF diff --git a/nladmin-ui/src/views/system/user/index.vue b/nladmin-ui/src/views/system/user/index.vue index 2c5c548..8e3898d 100644 --- a/nladmin-ui/src/views/system/user/index.vue +++ b/nladmin-ui/src/views/system/user/index.vue @@ -78,10 +78,9 @@ - @@ -365,7 +364,6 @@ export default { getDeptTree() { setTimeout(() => { getDeptTreee().then(res => { - debugger this.deptDatas = res.content }) }, 100) @@ -374,6 +372,7 @@ export default { console.log('获取部门') getDepts({ is_used: 1 }).then(res => { console.log('获取的部门信息', res) + this.depts = res.content.map(function(obj) { if (obj.hasChildren) { obj.children = null @@ -402,6 +401,7 @@ export default { }, // 获取弹窗内部门数据 loadDepts({ action, parentNode, callback }) { + debugger if (action === LOAD_CHILDREN_OPTIONS) { getDepts({ is_used: 1, pid: parentNode.id }).then(res => { parentNode.children = res.content.map(function(obj) { From 8781a991524c156915dc249233389349a2ca1042 Mon Sep 17 00:00:00 2001 From: zhangzhiqiang Date: Thu, 1 Dec 2022 10:12:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?mdf:=E7=94=A8=E6=88=B7=EF=BC=8C=E9=83=A8?= =?UTF-8?q?=E9=97=A8=E5=8E=BBjpa2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/system/rest/UserController.java | 13 ++++++----- .../system/service/dto/UserQueryCriteria.java | 3 +-- .../system/service/impl/DeptServiceImpl.java | 1 - .../system/service/impl/UserServiceImpl.java | 4 +++- .../src/main/java/org/nl/sso/wql/SYS_USER.wql | 6 ++--- nladmin-ui/src/api/system/dept.js | 5 ++-- nladmin-ui/src/views/system/user/index.vue | 23 ++++++------------- 7 files changed, 24 insertions(+), 31 deletions(-) diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/UserController.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/UserController.java index fc48eec..db6ec6d 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/UserController.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/UserController.java @@ -17,6 +17,7 @@ package org.nl.modules.system.rest; import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.secure.SaSecureUtil; +import cn.dev33.satoken.stp.StpUtil; import cn.hutool.core.util.ObjectUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -74,26 +75,26 @@ public class UserController { return new ResponseEntity<>(HttpStatus.CREATED); } - /* @Log("修改用户") + @Log("修改用户") @ApiOperation("修改用户") @PutMapping @SaCheckPermission("user:edit") - public ResponseEntity update(@Validated(User.Update.class) @RequestBody User resources) throws Exception { + public ResponseEntity update( @RequestBody User resources) throws Exception { checkLevel(resources); userService.update(resources); return new ResponseEntity<>(HttpStatus.NO_CONTENT); - }*/ + } - /* @Log("修改用户:个人中心") + @Log("修改用户:个人中心") @ApiOperation("修改用户:个人中心") @PutMapping(value = "center") - public ResponseEntity center(@Validated(User.Update.class) @RequestBody User resources){ + public ResponseEntity center(@RequestBody User resources){ if(!resources.getUser_id().equals(StpUtil.getLoginIdAsLong())){ throw new BadRequestException("不能修改他人资料"); } userService.updateCenter(resources); return new ResponseEntity<>(HttpStatus.NO_CONTENT); - }*/ + } @Log("删除用户") @ApiOperation("删除用户") diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/dto/UserQueryCriteria.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/dto/UserQueryCriteria.java index 2052510..4a4a518 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/dto/UserQueryCriteria.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/dto/UserQueryCriteria.java @@ -41,8 +41,7 @@ public class UserQueryCriteria implements Serializable { private Boolean needAll; - @Query - private Boolean is_used; + private String is_used; private Long deptId; diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DeptServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DeptServiceImpl.java index adb74cf..a2e94fb 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DeptServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DeptServiceImpl.java @@ -297,7 +297,6 @@ public class DeptServiceImpl implements DeptService { Set set = new HashSet<>(); //添加本级 set.add(pid); - //添加子节点 try { List list = Db.use((DataSource) SpringContextHolder.getBean("dataSource")).query(sql); diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/UserServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/UserServiceImpl.java index abdc2f9..0208caa 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/UserServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/UserServiceImpl.java @@ -81,12 +81,14 @@ public class UserServiceImpl implements UserService { } JSONObject o = (JSONObject)JSON.toJSON(criteria); HashMap map = MapOf.of("user_id", MapUtil.getStr(o, "user_id") - , "blurry", MapUtil.getStr(o, "blurry") , "is_used", MapUtil.getStr(o, "is_used") , "startTime", MapUtil.getStr(o, "startTime") , "endTime", MapUtil.getStr(o, "endTime") , "deptId", MapUtil.getStr(o, "deptId") ); + if (ObjectUtil.isNotEmpty(MapUtil.getStr(o, "blurry"))){ + map.put("blurry","'%"+MapUtil.getStr(o, "blurry")+"%'"); + } if (!CollectionUtils.isEmpty(criteria.getDeptIds())){ String collectSql = criteria.getDeptIds().stream().map(a -> String.valueOf(a)).collect(Collectors.joining("','")); map.put("deptIds","('"+collectSql+"')"); diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/sso/wql/SYS_USER.wql b/nladmin-system/nlsso-server/src/main/java/org/nl/sso/wql/SYS_USER.wql index 4027ded..fe217a1 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/sso/wql/SYS_USER.wql +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/sso/wql/SYS_USER.wql @@ -17,7 +17,7 @@ 输入.deptIds TYPEAS f_string 输入.deptId TYPEAS f_string 输入.id TYPEAS s_string - 输入.blurry TYPEAS s_string + 输入.blurry TYPEAS f_string 输入.is_used TYPEAS s_string 输入.startTime TYPEAS s_string 输入.endTime TYPEAS s_string @@ -63,10 +63,10 @@ sys_user_dept.dept_id in 输入.deptIds ENDOPTION OPTION 输入.blurry <> "" - (email like 输入.blurry or username like 输入.blurry or nickName like 输入.blurry) + (email like 输入.blurry or username like 输入.blurry or person_name like 输入.blurry) ENDOPTION OPTION 输入.is_used <> "" - sys_user.is_used = 输入.enabled + sys_user.is_used = 输入.is_used ENDOPTION OPTION 输入.deptId <> "" sys_user_dept.dept_id = 输入.deptId diff --git a/nladmin-ui/src/api/system/dept.js b/nladmin-ui/src/api/system/dept.js index b07cc27..2cbe31b 100644 --- a/nladmin-ui/src/api/system/dept.js +++ b/nladmin-ui/src/api/system/dept.js @@ -8,10 +8,11 @@ export function getDepts(params) { }) } -export function getDeptTreee() { +export function getDeptTreee(params) { return request({ url: '/api/dept/allTree', - method: 'get' + method: 'get', + params }) } diff --git a/nladmin-ui/src/views/system/user/index.vue b/nladmin-ui/src/views/system/user/index.vue index 8e3898d..6956aa2 100644 --- a/nladmin-ui/src/views/system/user/index.vue +++ b/nladmin-ui/src/views/system/user/index.vue @@ -36,7 +36,7 @@ @keyup.enter.native="crud.toQuery" /> { - getDeptTreee().then(res => { + getDeptTreee({ name: node }).then(res => { console.log('res', res) if (resolve) { resolve(res.content)