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 @@