【更新】代码生成主键更新为非写死状态 https://gitee.com/xiaonuobase/snowy/issues/I64DLI

pull/70/head
小诺 2 years ago committed by 俞宝山
parent 52a61577b8
commit 405bf92794

@ -81,7 +81,11 @@ public class ${className}ServiceImpl extends ServiceImpl<${className}Mapper, ${c
@Override @Override
public void edit(${className}EditParam ${classNameFirstLower}EditParam) { 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}); BeanUtil.copyProperties(${classNameFirstLower}EditParam, ${classNameFirstLower});
this.updateById(${classNameFirstLower}); this.updateById(${classNameFirstLower});
} }
@ -90,12 +94,20 @@ public class ${className}ServiceImpl extends ServiceImpl<${className}Mapper, ${c
@Override @Override
public void delete(List<${className}IdParam> ${classNameFirstLower}IdParamList) { 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 @Override
public ${className} detail(${className}IdParam ${classNameFirstLower}IdParam) { 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 @Override

@ -1,6 +1,10 @@
<template> <template>
<a-drawer <a-drawer
:title="formData.id ? '编辑${functionName}' : '增加${functionName}'" <% for(var i = 0; i < configList.~size; i++) { %>
<% if(configList[i].needTableId) { %>
:title="formData.${configList[i].fieldNameCamelCase} ? '编辑${functionName}' : '增加${functionName}'"
<% } %>
<% } %>
:width="600" :width="600"
:visible="visible" :visible="visible"
:destroy-on-close="true" :destroy-on-close="true"

@ -226,7 +226,11 @@
const delete${className} = (record) => { const delete${className} = (record) => {
let params = [ let params = [
{ {
id: record.id <% for(var i = 0; i < configList.~size; i++) { %>
<% if(configList[i].needTableId) { %>
${configList[i].fieldNameCamelCase}: record.${configList[i].fieldNameCamelCase}
<% } %>
<% } %>
} }
] ]
${classNameFirstLower}Api.${classNameFirstLower}Delete(params).then(() => { ${classNameFirstLower}Api.${classNameFirstLower}Delete(params).then(() => {
@ -241,7 +245,11 @@
} }
const params = selectedRowKeys.value.map((m) => { const params = selectedRowKeys.value.map((m) => {
return { return {
id: m <% for(var i = 0; i < configList.~size; i++) { %>
<% if(configList[i].needTableId) { %>
${configList[i].fieldNameCamelCase}: m
<% } %>
<% } %>
} }
}) })
${classNameFirstLower}Api.${classNameFirstLower}Delete(params).then(() => { ${classNameFirstLower}Api.${classNameFirstLower}Delete(params).then(() => {

Loading…
Cancel
Save