From 0edba9b3ccbedc99e6ababde7ec70cb896175158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E9=87=91=E6=B3=BD?= <1098696801@qq.com> Date: Sat, 5 Feb 2022 17:20:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AA=8C=E8=AF=81=EF=BC=8C=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/magic-api/api/后台/数据字典/保存.ms | 6 +- .../api/后台/数据字典/字典项/保存.ms | 6 +- data/magic-api/api/后台/用户管理/保存.ms | 7 ++- data/magic-api/api/后台/组织机构/保存.ms | 6 +- data/magic-api/api/后台/菜单管理/保存.ms | 15 ++++- data/magic-api/api/后台/角色管理/保存.ms | 7 ++- .../src/components/MagicBoot/mb-search.vue | 14 +++-- magic-boot-ui/src/scripts/common.js | 1 + .../src/views/system/dict/dict-items.vue | 49 ++++++++++----- .../src/views/system/dict/dict-list.vue | 63 ++++++++++++------- .../src/views/system/menu/menu-form.vue | 4 +- .../src/views/system/menu/menu-list.vue | 4 +- .../src/views/system/office/office-list.vue | 16 ++--- .../src/views/system/role/role-list.vue | 8 +-- .../src/views/system/user/user-form.vue | 33 +++++----- .../src/views/system/user/user-list.vue | 13 ++-- 16 files changed, 167 insertions(+), 85 deletions(-) diff --git a/data/magic-api/api/后台/数据字典/保存.ms b/data/magic-api/api/后台/数据字典/保存.ms index f0fcbbf..082007d 100644 --- a/data/magic-api/api/后台/数据字典/保存.ms +++ b/data/magic-api/api/后台/数据字典/保存.ms @@ -5,7 +5,7 @@ "groupId" : "c7ce65f5b3cf4aaa913f6fec7d35d176", "name" : "保存", "createTime" : null, - "updateTime" : 1634734554311, + "updateTime" : 1644046408348, "lock" : "0", "method" : "POST", "path" : "/save", @@ -23,4 +23,8 @@ } } ================================ +var typeCount = db.selectInt("select count(1) from sys_dict where is_del = 0 and type = #{data.type} ?{id, and id != #{data.id}}") +if(typeCount > 0){ + exit 0,'类型已存在' +} return db.table("sys_dict").primary("id").saveOrUpdate(data) \ No newline at end of file diff --git a/data/magic-api/api/后台/数据字典/字典项/保存.ms b/data/magic-api/api/后台/数据字典/字典项/保存.ms index 095bc6a..9320579 100644 --- a/data/magic-api/api/后台/数据字典/字典项/保存.ms +++ b/data/magic-api/api/后台/数据字典/字典项/保存.ms @@ -5,7 +5,7 @@ "groupId" : "376f26eb43a44a3daeafd27020a96f48", "name" : "保存", "createTime" : null, - "updateTime" : 1634735495162, + "updateTime" : 1644046552214, "lock" : "0", "method" : "POST", "path" : "/save", @@ -23,4 +23,8 @@ } } ================================ +var valueCount = db.selectInt("select count(1) from sys_dict_items where is_del = 0 and dict_id = #{data.dictId} and value = #{data.value} ?{id, and id != #{data.id}}") +if(valueCount > 0){ + exit 0,'值已存在' +} return db.table("sys_dict_items").primary("id").saveOrUpdate(data) \ No newline at end of file diff --git a/data/magic-api/api/后台/用户管理/保存.ms b/data/magic-api/api/后台/用户管理/保存.ms index cfebd02..73246a7 100644 --- a/data/magic-api/api/后台/用户管理/保存.ms +++ b/data/magic-api/api/后台/用户管理/保存.ms @@ -5,7 +5,7 @@ "groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a", "name" : "保存", "createTime" : null, - "updateTime" : 1643710594405, + "updateTime" : 1644046192172, "lock" : "0", "method" : "POST", "path" : "/save", @@ -24,6 +24,11 @@ import cn.dev33.satoken.secure.SaSecureUtil; import org.ssssssss.magicapi.cache.SqlCache +var usernameCount = db.selectInt("select count(1) from sys_user where is_del = 0 and username = #{username} ?{id, and id != #{id}}") +if(usernameCount > 0){ + exit 0,'登录名称已存在' +} + password = password ? SaSecureUtil.sha256(password) : '' var user = { id, diff --git a/data/magic-api/api/后台/组织机构/保存.ms b/data/magic-api/api/后台/组织机构/保存.ms index 7416011..b429ae2 100644 --- a/data/magic-api/api/后台/组织机构/保存.ms +++ b/data/magic-api/api/后台/组织机构/保存.ms @@ -5,7 +5,7 @@ "groupId" : "8295fc13678d4144bf7363c465247a50", "name" : "保存", "createTime" : null, - "updateTime" : 1641732020139, + "updateTime" : 1644046432007, "lock" : "0", "method" : "POST", "path" : "/save", @@ -23,4 +23,8 @@ } } ================================ +var codeCount = db.selectInt("select count(1) from sys_office where is_del = 0 and code = #{code} ?{id, and id != #{id}}") +if(codeCount > 0){ + exit 0,'机构编码已存在' +} return db.table("sys_office").primary("id").saveOrUpdate(data); \ No newline at end of file diff --git a/data/magic-api/api/后台/菜单管理/保存.ms b/data/magic-api/api/后台/菜单管理/保存.ms index 8791149..4b18633 100644 --- a/data/magic-api/api/后台/菜单管理/保存.ms +++ b/data/magic-api/api/后台/菜单管理/保存.ms @@ -5,7 +5,7 @@ "groupId" : "67b2ce258e24491194b74992958c74aa", "name" : "保存", "createTime" : null, - "updateTime" : 1641219427227, + "updateTime" : 1644031443910, "lock" : "0", "method" : "POST", "path" : "/save", @@ -26,6 +26,19 @@ import org.ssssssss.magicapi.cache.SqlCache; import '@get:/menu/cache/delete' as cacheDelete; +if(data.url){ + var urlCount = db.selectInt("select count(1) from sys_menu where is_del = 0 and url = #{data.url} ?{data.id, and id != #{data.id}}") + if(urlCount > 0){ + exit 0,'菜单链接已存在' + } +} +if(data.permission){ + var permissionCount = db.selectInt("select count(1) from sys_menu where is_del = 0 and permission = #{data.permission} ?{data.id, and id != #{data.id}}") + if(permissionCount > 0){ + exit 0,'权限标识已存在' + } +} + SqlCache.delete('permissions:1') if(data.id){ var menuId = data.id diff --git a/data/magic-api/api/后台/角色管理/保存.ms b/data/magic-api/api/后台/角色管理/保存.ms index ac7608b..44939e9 100644 --- a/data/magic-api/api/后台/角色管理/保存.ms +++ b/data/magic-api/api/后台/角色管理/保存.ms @@ -5,7 +5,7 @@ "groupId" : "89130d496f6f467c88b22ae4a7f688eb", "name" : "保存", "createTime" : null, - "updateTime" : 1642326331841, + "updateTime" : 1644046445441, "lock" : "0", "method" : "POST", "path" : "/save", @@ -25,6 +25,11 @@ ================================ import '@get:/role/cache/delete' as cacheDelete +var codeCount = db.selectInt("select count(1) from sys_role where is_del = 0 and code = #{code} ?{id, and id != #{id}}") +if(codeCount > 0){ + exit 0,'角色编码已存在' +} + var role = { code, permission, diff --git a/magic-boot-ui/src/components/MagicBoot/mb-search.vue b/magic-boot-ui/src/components/MagicBoot/mb-search.vue index 144c530..195e3cf 100644 --- a/magic-boot-ui/src/components/MagicBoot/mb-search.vue +++ b/magic-boot-ui/src/components/MagicBoot/mb-search.vue @@ -36,6 +36,10 @@ export default { where: { type: Object, default: () => {} + }, + notReset: { + type: String, + default: '' } }, data() { @@ -69,10 +73,12 @@ export default { }, reset() { for(var key in this.where){ - if(this.where[key] instanceof Object){ - this.where[key].value = null - }else{ - this.where[key] = null + if(this.notReset.indexOf(key) == -1){ + if(this.where[key] instanceof Object){ + this.where[key].value = null + }else{ + this.where[key] = null + } } } this.$nextTick(() => this.$emit('search')) diff --git a/magic-boot-ui/src/scripts/common.js b/magic-boot-ui/src/scripts/common.js index c516a72..569e26a 100644 --- a/magic-boot-ui/src/scripts/common.js +++ b/magic-boot-ui/src/scripts/common.js @@ -125,6 +125,7 @@ common.uuid = () => { } common.objAssign = (obj1, obj2, exclude) => { + exclude = exclude || '' for (var o1 in obj1) { for (var o2 in obj2) { if (o1 === o2) { diff --git a/magic-boot-ui/src/views/system/dict/dict-items.vue b/magic-boot-ui/src/views/system/dict/dict-items.vue index 199e0af..a72ee19 100644 --- a/magic-boot-ui/src/views/system/dict/dict-items.vue +++ b/magic-boot-ui/src/views/system/dict/dict-items.vue @@ -1,7 +1,7 @@