From ad568f9b86109349d7cbc877d7e0ca9ec636217f Mon Sep 17 00:00:00 2001 From: wangbing Date: Tue, 24 Nov 2020 14:58:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=88=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/module/wsys/ent/Profiles.java | 12 ++-- .../module/wsys/mgr/ProfilesManagerImpl.java | 4 +- .../wsys/req/ProfilesCreateRequest.java | 16 ++--- .../module/wsys/req/ProfilesFindRequest.java | 4 +- .../wsys/req/ProfilesUpdateRequest.java | 16 ++--- .../SpringBoot/resources/dbtool/wadmin.xml | 6 +- .../dbtool/wsys_table/MySQL_ALL_TABLE.sql | 6 +- .../dbtool/wsys_table/MySQL_PROFILES.sql | 6 +- .../dbtool/wsys_table/Oracle_ALL_TABLE.sql | 6 +- .../dbtool/wsys_table/Oracle_PROFILES.sql | 6 +- .../templates/screen/module/wsys/dept.ftl | 64 +++++++++++++++---- .../templates/screen/module/wsys/profiles.ftl | 36 +++++------ .../templates/screen/module/wsys/res.ftl | 64 +++++++++++++++---- .../SpringBoot/test/wsys/ProfilesTest.java | 18 +++--- 14 files changed, 172 insertions(+), 92 deletions(-) diff --git a/src/main/resources/modules/SpringBoot/java/module/wsys/ent/Profiles.java b/src/main/resources/modules/SpringBoot/java/module/wsys/ent/Profiles.java index 5f71f3fe..0fada77a 100644 --- a/src/main/resources/modules/SpringBoot/java/module/wsys/ent/Profiles.java +++ b/src/main/resources/modules/SpringBoot/java/module/wsys/ent/Profiles.java @@ -16,21 +16,21 @@ import ${domain}.frame.excel.annotation.ExcelSheet; public class Profiles extends BaseEntity { /** - * ACTIVE - 环境 + * ACTIVE - 配置环境 */ - @ExcelProperty("环境") + @ExcelProperty("配置环境") @ExcelNote("") private String active; /** - * KEY - 配置键 + * KEY - 配置项名 */ - @ExcelProperty("配置键") + @ExcelProperty("配置项名") @ExcelNote("") private String key; /** - * VALUE - 配置值 + * VALUE - 配置项值 */ - @ExcelProperty("配置值") + @ExcelProperty("配置项值") @ExcelNote("") private String value; diff --git a/src/main/resources/modules/SpringBoot/java/module/wsys/mgr/ProfilesManagerImpl.java b/src/main/resources/modules/SpringBoot/java/module/wsys/mgr/ProfilesManagerImpl.java index be6369b9..89e00efd 100644 --- a/src/main/resources/modules/SpringBoot/java/module/wsys/mgr/ProfilesManagerImpl.java +++ b/src/main/resources/modules/SpringBoot/java/module/wsys/mgr/ProfilesManagerImpl.java @@ -53,7 +53,7 @@ public class ProfilesManagerImpl implements ${domain}.module.wsys.mgr.ProfilesMa return response; } - {// 配置键唯一检查 + {// 配置项名唯一检查 ProfilesFindRequest profilesFindRequest = new ProfilesFindRequest(); profilesFindRequest.setKey(request.getKey()); ProfilesFindResponse profilesFindResponse = this.find(profilesFindRequest, token); @@ -61,7 +61,7 @@ public class ProfilesManagerImpl implements ${domain}.module.wsys.mgr.ProfilesMa response.addErrors(profilesFindResponse.getErrors()); return response; } else if (profilesFindResponse.getTotalCount() > 0) { - response.addError(ErrorType.UNIQUENESS_ERROR, "[key]配置键已存在,请检查!"); + response.addError(ErrorType.UNIQUENESS_ERROR, "[key]配置项名已存在,请检查!"); return response; } } diff --git a/src/main/resources/modules/SpringBoot/java/module/wsys/req/ProfilesCreateRequest.java b/src/main/resources/modules/SpringBoot/java/module/wsys/req/ProfilesCreateRequest.java index 5c0d54c2..569ecabb 100644 --- a/src/main/resources/modules/SpringBoot/java/module/wsys/req/ProfilesCreateRequest.java +++ b/src/main/resources/modules/SpringBoot/java/module/wsys/req/ProfilesCreateRequest.java @@ -17,24 +17,24 @@ import javax.validation.constraints.NotNull; public class ProfilesCreateRequest extends BaseRequest { /** - * 环境. + * 配置环境. */ - @NotNull(message = "[active]环境不能为NULL") + @NotNull(message = "[active]配置环境不能为NULL") @Select({"dev", "prod"}) private String active; /** - * 配置键. + * 配置项名. */ - @NotBlank(message = "[key]配置键不能为空") - @Length(min = 0, max = 50, message = "[key]配置键长度不合法(0-50)") + @NotBlank(message = "[key]配置项名不能为空") + @Length(min = 0, max = 50, message = "[key]配置项名长度不合法(0-50)") private String key; /** - * 配置值. + * 配置项值. */ - @NotBlank(message = "[value]配置值不能为空") - @Length(min = 0, max = 50, message = "[value]配置值长度不合法(0-50)") + @NotBlank(message = "[value]配置项值不能为空") + @Length(min = 0, max = 50, message = "[value]配置项值长度不合法(0-50)") private String value; public String getActive() { diff --git a/src/main/resources/modules/SpringBoot/java/module/wsys/req/ProfilesFindRequest.java b/src/main/resources/modules/SpringBoot/java/module/wsys/req/ProfilesFindRequest.java index 135b4816..2bfde667 100644 --- a/src/main/resources/modules/SpringBoot/java/module/wsys/req/ProfilesFindRequest.java +++ b/src/main/resources/modules/SpringBoot/java/module/wsys/req/ProfilesFindRequest.java @@ -15,13 +15,13 @@ import java.util.Date; public class ProfilesFindRequest extends BaseFindRequest { /** - * 环境. + * 配置环境. */ @Select({"dev", "prod"}) private String active; /** - * 配置键. + * 配置项名. */ private String key; diff --git a/src/main/resources/modules/SpringBoot/java/module/wsys/req/ProfilesUpdateRequest.java b/src/main/resources/modules/SpringBoot/java/module/wsys/req/ProfilesUpdateRequest.java index d5446c81..18018405 100644 --- a/src/main/resources/modules/SpringBoot/java/module/wsys/req/ProfilesUpdateRequest.java +++ b/src/main/resources/modules/SpringBoot/java/module/wsys/req/ProfilesUpdateRequest.java @@ -23,24 +23,24 @@ public class ProfilesUpdateRequest extends BaseUpdateRequest { private Long id; /** - * 环境. + * 配置环境. */ - @NotNull(message = "[active]环境不能为NULL") + @NotNull(message = "[active]配置环境不能为NULL") @Select({"dev", "prod"}) private String active; /** - * 配置键. + * 配置项名. */ - @NotBlank(message = "[key]配置键不能为空") - @Length(min = 0, max = 50, message = "[key]配置键长度不合法(0-50)") + @NotBlank(message = "[key]配置项名不能为空") + @Length(min = 0, max = 50, message = "[key]配置项名长度不合法(0-50)") private String key; /** - * 配置值. + * 配置项值. */ - @NotBlank(message = "[value]配置值不能为空") - @Length(min = 0, max = 50, message = "[value]配置值长度不合法(0-50)") + @NotBlank(message = "[value]配置项值不能为空") + @Length(min = 0, max = 50, message = "[value]配置项值长度不合法(0-50)") private String value; public Long getId() { diff --git a/src/main/resources/modules/SpringBoot/resources/dbtool/wadmin.xml b/src/main/resources/modules/SpringBoot/resources/dbtool/wadmin.xml index f09d06d7..0d03b50e 100644 --- a/src/main/resources/modules/SpringBoot/resources/dbtool/wadmin.xml +++ b/src/main/resources/modules/SpringBoot/resources/dbtool/wadmin.xml @@ -51,12 +51,12 @@ - + - - + + diff --git a/src/main/resources/modules/SpringBoot/resources/dbtool/wsys_table/MySQL_ALL_TABLE.sql b/src/main/resources/modules/SpringBoot/resources/dbtool/wsys_table/MySQL_ALL_TABLE.sql index cf0270cd..5a88a57f 100644 --- a/src/main/resources/modules/SpringBoot/resources/dbtool/wsys_table/MySQL_ALL_TABLE.sql +++ b/src/main/resources/modules/SpringBoot/resources/dbtool/wsys_table/MySQL_ALL_TABLE.sql @@ -346,9 +346,9 @@ PRIMARY KEY (`ID`) -- ---------------------------- CREATE TABLE `SYS_PROFILES` ( `ID` BIGINT(20) NOT NULL COMMENT '主键', - `ACTIVE` VARCHAR(20) NOT NULL COMMENT '环境', - `KEY` VARCHAR(50) NOT NULL COMMENT '配置键', - `VALUE` VARCHAR(50) NOT NULL COMMENT '配置值', + `ACTIVE` VARCHAR(20) NOT NULL COMMENT '配置环境', + `KEY` VARCHAR(50) NOT NULL COMMENT '配置项名', + `VALUE` VARCHAR(50) NOT NULL COMMENT '配置项值', `ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本', `IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除', `CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户', diff --git a/src/main/resources/modules/SpringBoot/resources/dbtool/wsys_table/MySQL_PROFILES.sql b/src/main/resources/modules/SpringBoot/resources/dbtool/wsys_table/MySQL_PROFILES.sql index 137c299f..88160b5c 100644 --- a/src/main/resources/modules/SpringBoot/resources/dbtool/wsys_table/MySQL_PROFILES.sql +++ b/src/main/resources/modules/SpringBoot/resources/dbtool/wsys_table/MySQL_PROFILES.sql @@ -6,9 +6,9 @@ -- ---------------------------- CREATE TABLE `SYS_PROFILES` ( `ID` BIGINT(20) NOT NULL COMMENT '主键', - `ACTIVE` VARCHAR(20) NOT NULL COMMENT '环境', - `KEY` VARCHAR(50) NOT NULL COMMENT '配置键', - `VALUE` VARCHAR(50) NOT NULL COMMENT '配置值', + `ACTIVE` VARCHAR(20) NOT NULL COMMENT '配置环境', + `KEY` VARCHAR(50) NOT NULL COMMENT '配置项名', + `VALUE` VARCHAR(50) NOT NULL COMMENT '配置项值', `ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本', `IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除', `CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户', diff --git a/src/main/resources/modules/SpringBoot/resources/dbtool/wsys_table/Oracle_ALL_TABLE.sql b/src/main/resources/modules/SpringBoot/resources/dbtool/wsys_table/Oracle_ALL_TABLE.sql index 05a7b445..f544faf4 100644 --- a/src/main/resources/modules/SpringBoot/resources/dbtool/wsys_table/Oracle_ALL_TABLE.sql +++ b/src/main/resources/modules/SpringBoot/resources/dbtool/wsys_table/Oracle_ALL_TABLE.sql @@ -550,9 +550,9 @@ CREATE TABLE "SYS_PROFILES" ( ); COMMENT ON TABLE "SYS_PROFILES" is '系统配置'; COMMENT ON COLUMN "SYS_PROFILES"."ID" is '主键'; -COMMENT ON COLUMN "SYS_PROFILES"."ACTIVE" is '环境'; -COMMENT ON COLUMN "SYS_PROFILES"."KEY" is '配置键'; -COMMENT ON COLUMN "SYS_PROFILES"."VALUE" is '配置值'; +COMMENT ON COLUMN "SYS_PROFILES"."ACTIVE" is '配置环境'; +COMMENT ON COLUMN "SYS_PROFILES"."KEY" is '配置项名'; +COMMENT ON COLUMN "SYS_PROFILES"."VALUE" is '配置项值'; COMMENT ON COLUMN "SYS_PROFILES"."ROW_VERSION" is '行版本'; COMMENT ON COLUMN "SYS_PROFILES"."IS_DELETED" is '是否已删除'; COMMENT ON COLUMN "SYS_PROFILES"."CREATE_BY" is '创建用户'; diff --git a/src/main/resources/modules/SpringBoot/resources/dbtool/wsys_table/Oracle_PROFILES.sql b/src/main/resources/modules/SpringBoot/resources/dbtool/wsys_table/Oracle_PROFILES.sql index f38dd873..c9990be6 100644 --- a/src/main/resources/modules/SpringBoot/resources/dbtool/wsys_table/Oracle_PROFILES.sql +++ b/src/main/resources/modules/SpringBoot/resources/dbtool/wsys_table/Oracle_PROFILES.sql @@ -19,9 +19,9 @@ CREATE TABLE "SYS_PROFILES" ( COMMENT ON TABLE "SYS_PROFILES" is '系统配置'; COMMENT ON COLUMN "SYS_PROFILES"."ID" is '主键'; -COMMENT ON COLUMN "SYS_PROFILES"."ACTIVE" is '环境'; -COMMENT ON COLUMN "SYS_PROFILES"."KEY" is '配置键'; -COMMENT ON COLUMN "SYS_PROFILES"."VALUE" is '配置值'; +COMMENT ON COLUMN "SYS_PROFILES"."ACTIVE" is '配置环境'; +COMMENT ON COLUMN "SYS_PROFILES"."KEY" is '配置项名'; +COMMENT ON COLUMN "SYS_PROFILES"."VALUE" is '配置项值'; COMMENT ON COLUMN "SYS_PROFILES"."ROW_VERSION" is '行版本'; COMMENT ON COLUMN "SYS_PROFILES"."IS_DELETED" is '是否已删除'; COMMENT ON COLUMN "SYS_PROFILES"."CREATE_BY" is '创建用户'; diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/wsys/dept.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/wsys/dept.ftl index f5e8cd35..7ea1684d 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/wsys/dept.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/wsys/dept.ftl @@ -218,16 +218,33 @@ @opened="onTreeOpened" size="600px"> - + - - + + + + + + + + 过滤 + + + 删除 + + + 刷新 + + + + @@ -237,6 +254,8 @@ ref="tree" accordion show-checkbox + check-strictly="true" + default-expand-all="true" :filter-node-method="onTreeFilter" :expand-on-click-node="false">
@@ -363,6 +382,32 @@ this.form.deptAlias = ""; this.form.valid = true; }, + onTreeDelete: function () { + var select = this.$refs.tree.getCheckedNodes(); + this.$confirm('将删除已选择的项, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(function () { + nav.tipShow("删除中..."); + select.forAsync(function (item, next) { + new Ajax("wsys", "dept").delete({id: item.id}, function (response) { + if (response.errors.length > 0) { + nav.e(response.errors[0].message); + } else { + this.result.remove(item) + } + next(); + }.bind(this)) + }.bind(this), function () { + nav.tipClose(); + nav.i("批量删除结束.") + this.onTreeLoad(); + }.bind(this)) + }.bind(this)).catch(function (action) { + + }); + }, onTreeEdit: function (item) { this.form.formTitle = "部门编辑"; this.form.formShow = true; @@ -390,11 +435,6 @@ this.onTreeLoad(); } }, - watch: { - treeFilter: function (val) { - this.$refs.tree.filter(val); - } - }, mounted: function () { this.onFind(); } diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/wsys/profiles.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/wsys/profiles.ftl index 5cfa04c9..a01b7fcd 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/wsys/profiles.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/wsys/profiles.ftl @@ -1,14 +1,14 @@
- - + + - - + + @@ -84,19 +84,19 @@ align="center" min-width="100" prop="active" - label="环境"> + label="配置环境"> + label="配置项名"> + label="配置项值"> - - + + - - + + - - + + @@ -195,15 +195,15 @@ }, formRules: { active: [ - {required: true, message: '环境不能为空', trigger: 'blur'}, + {required: true, message: '配置环境不能为空', trigger: 'blur'}, ], key: [ - {required: true, message: '配置键不能为空', trigger: 'blur'}, - {min: 1, max: 50, message: '配置键长度在 1 到 50 个字符', trigger: 'blur'} + {required: true, message: '配置项名不能为空', trigger: 'blur'}, + {min: 1, max: 50, message: '配置项名长度在 1 到 50 个字符', trigger: 'blur'} ], value: [ - {required: true, message: '配置值不能为空', trigger: 'blur'}, - {min: 1, max: 50, message: '配置值长度在 1 到 50 个字符', trigger: 'blur'} + {required: true, message: '配置项值不能为空', trigger: 'blur'}, + {min: 1, max: 50, message: '配置项值长度在 1 到 50 个字符', trigger: 'blur'} ], } }, diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/wsys/res.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/wsys/res.ftl index cbe94536..c93b7ac6 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/wsys/res.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/wsys/res.ftl @@ -236,16 +236,33 @@ @opened="onTreeOpened" size="600px"> - + - - + + + + + + + + 过滤 + + + 删除 + + + 刷新 + + + + @@ -255,6 +272,8 @@ ref="tree" accordion show-checkbox + check-strictly="true" + default-expand-all="true" :filter-node-method="onTreeFilter" :expand-on-click-node="false">
@@ -396,6 +415,32 @@ this.form.free = false; this.form.valid = true; }, + onTreeDelete: function () { + var select = this.$refs.tree.getCheckedNodes(); + this.$confirm('将删除已选择的项, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(function () { + nav.tipShow("删除中..."); + select.forAsync(function (item, next) { + new Ajax("wsys", "res").delete({id: item.id}, function (response) { + if (response.errors.length > 0) { + nav.e(response.errors[0].message); + } else { + this.result.remove(item) + } + next(); + }.bind(this)) + }.bind(this), function () { + nav.tipClose(); + nav.i("批量删除结束.") + this.onTreeLoad(); + }.bind(this)) + }.bind(this)).catch(function (action) { + + }); + }, onTreeEdit: function (pItem) { this.form.formTitle = "资源编辑"; this.form.formShow = true; @@ -429,11 +474,6 @@ this.onTreeLoad(); } }, - watch: { - treeFilter: function (val) { - this.$refs.tree.filter(val); - } - }, mounted: function () { this.onFind(); } diff --git a/src/main/resources/modules/SpringBoot/test/wsys/ProfilesTest.java b/src/main/resources/modules/SpringBoot/test/wsys/ProfilesTest.java index e9922c6b..4ff53e18 100644 --- a/src/main/resources/modules/SpringBoot/test/wsys/ProfilesTest.java +++ b/src/main/resources/modules/SpringBoot/test/wsys/ProfilesTest.java @@ -41,8 +41,8 @@ public class ProfilesTest { public void testCreate() { ProfilesCreateRequest request = new ProfilesCreateRequest(); request.setActive("value"); - request.setKey("配置键"); - request.setValue("配置值"); + request.setKey("配置项名"); + request.setValue("配置项值"); ProfilesCreateResponse response = profilesManager.create(request,token); @@ -55,8 +55,8 @@ public class ProfilesTest { //创建数据 ProfilesCreateRequest createRequest = new ProfilesCreateRequest(); createRequest.setActive("value"); - createRequest.setKey("配置键"); - createRequest.setValue("配置值"); + createRequest.setKey("配置项名"); + createRequest.setValue("配置项值"); ProfilesCreateResponse createResponse = profilesManager.create(createRequest,token); @@ -75,8 +75,8 @@ public class ProfilesTest { //创建数据 ProfilesCreateRequest createRequest = new ProfilesCreateRequest(); createRequest.setActive("value"); - createRequest.setKey("配置键"); - createRequest.setValue("配置值"); + createRequest.setKey("配置项名"); + createRequest.setValue("配置项值"); ProfilesCreateResponse createResponse = profilesManager.create(createRequest, token); @@ -86,8 +86,8 @@ public class ProfilesTest { ProfilesUpdateRequest request = new ProfilesUpdateRequest(); request.setId(createResponse.getId()); request.setActive("value"); - request.setKey("配置键"); - request.setValue("配置值"); + request.setKey("配置项名"); + request.setValue("配置项值"); ProfilesUpdateResponse response = profilesManager.update(request,token); @@ -98,7 +98,7 @@ public class ProfilesTest { public void testFind() { ProfilesFindRequest request = new ProfilesFindRequest(); request.setActive("value"); - request.setKey("配置键"); + request.setKey("配置项名"); ProfilesFindResponse response = profilesManager.find(request,token);