From 9c510050169ff4d21f4c782972333116b2810eee Mon Sep 17 00:00:00 2001 From: Fxz <2235602974@qq.com> Date: Thu, 28 Apr 2022 23:39:48 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E9=A2=84=E6=96=87=E4=BB=B6=20=E9=A1=BA=E5=BA=8F?= =?UTF-8?q?=E6=8C=89=E7=85=A7=20=20=E5=89=8D=E7=AB=AF=20=20=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=20=20=E4=BE=9D=E6=AC=A1=E6=98=BE=E7=A4=BA=20=E3=80=81?= =?UTF-8?q?up=20mysql=208.0.29=E3=80=81=20up=20spring=20cloud=202021.0.2?= =?UTF-8?q?=E3=80=81=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pigx-common/pigx-common-bom/pom.xml | 2 +- .../pig4cloud/pigx/codegen/util/GenUtils.java | 26 ++++++++++--------- .../main/resources/template/uview/form.vue.vm | 15 ++++++----- .../resources/template/uview/index.vue.vm | 2 +- .../resources/template/uview/page.json.vm | 4 +-- pom.xml | 2 +- 6 files changed, 28 insertions(+), 23 deletions(-) diff --git a/pigx-common/pigx-common-bom/pom.xml b/pigx-common/pigx-common-bom/pom.xml index de8f331c1..1479ff668 100644 --- a/pigx-common/pigx-common-bom/pom.xml +++ b/pigx-common/pigx-common-bom/pom.xml @@ -22,7 +22,7 @@ 3.4.1 1.2.9 5.7.22 - 8.0.27 + 8.0.29 21.3.0.0 8.4.1.jre8 8.1.2.79 diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java index 646430727..c0f191b79 100644 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java +++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java @@ -104,13 +104,6 @@ public class GenUtils { */ private List getTemplates(GenConfig config) { List templates = new ArrayList<>(); - templates.add("template/Entity.java.vm"); - templates.add("template/Mapper.java.vm"); - templates.add("template/Mapper.xml.vm"); - templates.add("template/Service.java.vm"); - templates.add("template/ServiceImpl.java.vm"); - templates.add("template/Controller.java.vm"); - templates.add("template/menu.sql.vm"); if (StyleTypeEnum.AVUE.getStyle().equals(config.getStyle())) { templates.add("template/avue/index.vue.vm"); @@ -123,12 +116,20 @@ public class GenUtils { templates.add("template/avue/api.js.vm"); } else { - templates.add("template/uview/api.js.vm"); - templates.add("template/uview/form.vue.vm"); templates.add("template/uview/index.vue.vm"); + templates.add("template/uview/form.vue.vm"); + templates.add("template/uview/api.js.vm"); templates.add("template/uview/page.json.vm"); } + templates.add("template/Entity.java.vm"); + templates.add("template/Mapper.java.vm"); + templates.add("template/Mapper.xml.vm"); + templates.add("template/Service.java.vm"); + templates.add("template/ServiceImpl.java.vm"); + templates.add("template/Controller.java.vm"); + templates.add("template/menu.sql.vm"); + return templates; } @@ -289,7 +290,7 @@ public class GenUtils { // 获取模板列表 List templates = getTemplates(genConfig); - Map resultMap = new HashMap<>(8); + Map resultMap = new LinkedHashMap<>(8); for (String template : templates) { // 如果是crud @@ -433,11 +434,12 @@ public class GenUtils { } if (template.contains(UVIEW_API_JS_VM)) { - return CommonConstants.UNI_END_PROJECT + File.separator + "common" + File.separator + "http.api.js"; + return CommonConstants.UNI_END_PROJECT + File.separator + "common" + File.separator + + className.toLowerCase() + ".api.js"; } if (template.contains(UVIEW_PAGE_JSON_VM)) { - return "page.json"; + return className.toLowerCase() + ".page.json"; } return null; diff --git a/pigx-visual/pigx-codegen/src/main/resources/template/uview/form.vue.vm b/pigx-visual/pigx-codegen/src/main/resources/template/uview/form.vue.vm index 29eaada5e..b7ccaa5db 100644 --- a/pigx-visual/pigx-codegen/src/main/resources/template/uview/form.vue.vm +++ b/pigx-visual/pigx-codegen/src/main/resources/template/uview/form.vue.vm @@ -43,18 +43,19 @@ } }, onLoad(params) { - if(params&¶ms.id){ + if(params&¶ms.id!= "undefined"){ this.type = 'edit' - #[[this.$u.api]]#.pigx${className}.getObj(params}).then(res => { - Object.assign(this.model, res.data); + #[[this.$u.api]]#.pigx${className}.getObj(params).then(res => { + this.model = res.data; }); }else{ this.type = 'add' + this.model = {} } }, methods: { submit() { - #[[this.$refs.uForm.validate(valid => {]]# + #[[this.$refs.uForm.validate(async valid => {]]# if (valid) { if(this.type==='edit'){ await #[[this.$u.api]]#.pigx${className}.putObj(this.model) @@ -64,11 +65,13 @@ setTimeout(() => { uni.showModal({ title: '提示', - content: '修改成功', + ccontent: this.type === 'edit' ? '修改成功' : '添加成功', showCancel: false, success: function() { uni.setStorageSync('refreshList', true); - uni.navigateBack(); + uni.navigateTo({ + url: '/pages/${moduleName}/${pathName}/${pathName}-index' + }) } }) }, 200) diff --git a/pigx-visual/pigx-codegen/src/main/resources/template/uview/index.vue.vm b/pigx-visual/pigx-codegen/src/main/resources/template/uview/index.vue.vm index c05d20156..7b1b32cb2 100644 --- a/pigx-visual/pigx-codegen/src/main/resources/template/uview/index.vue.vm +++ b/pigx-visual/pigx-codegen/src/main/resources/template/uview/index.vue.vm @@ -21,7 +21,7 @@ - + diff --git a/pigx-visual/pigx-codegen/src/main/resources/template/uview/page.json.vm b/pigx-visual/pigx-codegen/src/main/resources/template/uview/page.json.vm index 47a65c7f9..f496b639a 100644 --- a/pigx-visual/pigx-codegen/src/main/resources/template/uview/page.json.vm +++ b/pigx-visual/pigx-codegen/src/main/resources/template/uview/page.json.vm @@ -3,13 +3,13 @@ /**${comments}**/ { - "path": "pages/${moduleName}/${pathName}/${pathName}-index.vue", + "path": "pages/${moduleName}/${pathName}/${pathName}-index", "style": { "navigationBarTitleText": "${comments}" } }, { - "path": "pages/${moduleName}/${pathName}/${pathName}-form.vue", + "path": "pages/${moduleName}/${pathName}/${pathName}-form", "style": { "navigationBarTitleText": "${comments}详情" } diff --git a/pom.xml b/pom.xml index 0c0e1ffa9..12cce6547 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ 2.6.7 - 2021.0.1 + 2021.0.2 2021.0.1.0 UTF-8 1.8