From e08757567285b6557d519217c25e4422f8aa1aa3 Mon Sep 17 00:00:00 2001 From: haha Date: Sun, 26 May 2024 00:36:15 +0800 Subject: [PATCH] update code --- .../src/main/resources/application-druid.yml | 4 ++-- .../service/impl/SysDeptServiceImpl.java | 4 ++-- .../service/impl/SysUserServiceImpl.java | 7 +++++- yanzhu-ui/src/views/login.vue | 2 +- yanzhu-ui/src/views/register.vue | 2 +- yanzhu-ui/src/views/system/user/index.vue | 23 +++++++++++++++---- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/yanzhu-admin/src/main/resources/application-druid.yml b/yanzhu-admin/src/main/resources/application-druid.yml index 91dbbb1..4f6a92b 100644 --- a/yanzhu-admin/src/main/resources/application-druid.yml +++ b/yanzhu-admin/src/main/resources/application-druid.yml @@ -39,9 +39,9 @@ spring: druid: # 主库数据源 master: - url: jdbc:mysql://cd-cynosdbmysql-grp-9rqrhxsm.sql.tencentcdb.com:27981/yanzhu_project?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8 + url: jdbc:mysql://62.234.3.186:3306/yanzhu_project?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8 username: root - password: Sxyanzhu@cf + password: Sxyanzhu@cf123 # 从库数据源 slave: # 从数据源开关/默认关闭 diff --git a/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysDeptServiceImpl.java b/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysDeptServiceImpl.java index 947e9b0..334075d 100644 --- a/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysDeptServiceImpl.java +++ b/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysDeptServiceImpl.java @@ -233,7 +233,7 @@ public class SysDeptServiceImpl implements ISysDeptService dept.setLevel(2); dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); int id=deptMapper.insertDept(dept); - String[] subDepts="成本部,行政部,工程部".split(","); + String[] subDepts="物设部,工程部,商务部,财务部,安质部,领导班子".split(","); for(String it:subDepts){ SysDept dpt=new SysDept(); dpt.setParentId(dept.getDeptId()); @@ -263,7 +263,7 @@ public class SysDeptServiceImpl implements ISysDeptService dept.setLevel(300); dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); int id=deptMapper.insertDept(dept); - String[] subDepts="科技部,采购部,商务部,工程部,财务部".split(","); + String[] subDepts="物设部,工程部,领导班子".split(","); for(String it:subDepts){ SysDept dpt=new SysDept(); dpt.setParentId(dept.getDeptId()); diff --git a/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysUserServiceImpl.java b/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysUserServiceImpl.java index a41ae64..2686fd7 100644 --- a/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysUserServiceImpl.java +++ b/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysUserServiceImpl.java @@ -425,12 +425,17 @@ public class SysUserServiceImpl implements ISysUserService List list = new ArrayList(roleIds.length); for (Long roleId : roleIds) { + if(roleId==null){ + continue; + } SysUserRole ur = new SysUserRole(); ur.setUserId(userId); ur.setRoleId(roleId); list.add(ur); } - userRoleMapper.batchUserRole(list); + if(list.size()>0){ + userRoleMapper.batchUserRole(list); + } } } diff --git a/yanzhu-ui/src/views/login.vue b/yanzhu-ui/src/views/login.vue index 6aa9cb5..5111d6c 100644 --- a/yanzhu-ui/src/views/login.vue +++ b/yanzhu-ui/src/views/login.vue @@ -56,7 +56,7 @@ diff --git a/yanzhu-ui/src/views/register.vue b/yanzhu-ui/src/views/register.vue index 3eb48d9..36581b6 100644 --- a/yanzhu-ui/src/views/register.vue +++ b/yanzhu-ui/src/views/register.vue @@ -61,7 +61,7 @@ diff --git a/yanzhu-ui/src/views/system/user/index.vue b/yanzhu-ui/src/views/system/user/index.vue index 831eb17..1e7336c 100644 --- a/yanzhu-ui/src/views/system/user/index.vue +++ b/yanzhu-ui/src/views/system/user/index.vue @@ -128,7 +128,7 @@ - + @@ -158,7 +158,7 @@ - + @@ -331,7 +331,8 @@ export default { this.$refs.tree.filter(val); } }, - created() { + created() { + window.x99=this this.getList(); this.getDeptTree(); this.getConfigKey("sys.user.initPassword").then(response => { @@ -473,10 +474,10 @@ export default { }); }, /** 修改按钮操作 */ - handleUpdate(row) { + handleUpdate(row) { this.reset(); const userId = row.userId || this.ids; - getUser(userId).then(response => { + getUser(userId).then(response => { this.form = response.data; this.postOptions = response.posts; this.roleOptions = response.roles; @@ -486,6 +487,18 @@ export default { this.open = true; this.title = "修改用户"; this.form.password = ""; + setTimeout(()=>{ + let node=this.$refs.treeSel.getNode(this.form.deptId); + this.$refs.treeSel.select(node); + this.doInputDept(node.raw); + const func=p=>{ + p.isExpanded=true; + if(p.parentNode){ + func(p.parentNode); + } + }; + func(node); + },400); }); }, /** 重置密码按钮操作 */