From 405bf92794099350fd7a2b6c1fe68dd96607656a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=AF=BA?= <1253070437@qq.com> Date: Sun, 4 Dec 2022 01:24:54 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=9B=B4=E6=96=B0=E3=80=91=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90=E4=B8=BB=E9=94=AE=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=B8=BA=E9=9D=9E=E5=86=99=E6=AD=BB=E7=8A=B6=E6=80=81=20https:?= =?UTF-8?q?//gitee.com/xiaonuobase/snowy/issues/I64DLI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/backend/ServiceImpl.java.btl | 18 +++++++++++++++--- .../src/main/resources/frontend/form.vue.btl | 6 +++++- .../src/main/resources/frontend/index.vue.btl | 12 ++++++++++-- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/snowy-plugin/snowy-plugin-gen/src/main/resources/backend/ServiceImpl.java.btl b/snowy-plugin/snowy-plugin-gen/src/main/resources/backend/ServiceImpl.java.btl index a60f75ad..82f6d092 100644 --- a/snowy-plugin/snowy-plugin-gen/src/main/resources/backend/ServiceImpl.java.btl +++ b/snowy-plugin/snowy-plugin-gen/src/main/resources/backend/ServiceImpl.java.btl @@ -81,7 +81,11 @@ public class ${className}ServiceImpl extends ServiceImpl<${className}Mapper, ${c @Override public void edit(${className}EditParam ${classNameFirstLower}EditParam) { - ${className} ${classNameFirstLower} = this.queryEntity(${classNameFirstLower}EditParam.getId()); + <% for(var i = 0; i < configList.~size; i++) { %> + <% if(configList[i].needTableId) { %> + ${className} ${classNameFirstLower} = this.queryEntity(${classNameFirstLower}EditParam.get${configList[i].fieldNameCamelCaseFirstUpper}()); + <% } %> + <% } %> BeanUtil.copyProperties(${classNameFirstLower}EditParam, ${classNameFirstLower}); this.updateById(${classNameFirstLower}); } @@ -90,12 +94,20 @@ public class ${className}ServiceImpl extends ServiceImpl<${className}Mapper, ${c @Override public void delete(List<${className}IdParam> ${classNameFirstLower}IdParamList) { // 执行删除 - this.removeBatchByIds(CollStreamUtil.toList(${classNameFirstLower}IdParamList, ${className}IdParam::getId)); + <% for(var i = 0; i < configList.~size; i++) { %> + <% if(configList[i].needTableId) { %> + this.removeBatchByIds(CollStreamUtil.toList(${classNameFirstLower}IdParamList, ${className}IdParam::get${configList[i].fieldNameCamelCaseFirstUpper}())); + <% } %> + <% } %> } @Override public ${className} detail(${className}IdParam ${classNameFirstLower}IdParam) { - return this.queryEntity(${classNameFirstLower}IdParam.getId()); + <% for(var i = 0; i < configList.~size; i++) { %> + <% if(configList[i].needTableId) { %> + return this.queryEntity(${classNameFirstLower}IdParam.get${configList[i].fieldNameCamelCaseFirstUpper}()); + <% } %> + <% } %> } @Override diff --git a/snowy-plugin/snowy-plugin-gen/src/main/resources/frontend/form.vue.btl b/snowy-plugin/snowy-plugin-gen/src/main/resources/frontend/form.vue.btl index 49a0d1a0..30f9071e 100644 --- a/snowy-plugin/snowy-plugin-gen/src/main/resources/frontend/form.vue.btl +++ b/snowy-plugin/snowy-plugin-gen/src/main/resources/frontend/form.vue.btl @@ -1,6 +1,10 @@