mirror of https://gitee.com/xiaonuobase/snowy
【更新】代码生成主键更新为非写死状态 https://gitee.com/xiaonuobase/snowy/issues/I64DLI
parent
52a61577b8
commit
405bf92794
|
@ -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
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
<template>
|
||||
<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"
|
||||
:visible="visible"
|
||||
:destroy-on-close="true"
|
||||
|
|
|
@ -226,7 +226,11 @@
|
|||
const delete${className} = (record) => {
|
||||
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(() => {
|
||||
|
@ -241,7 +245,11 @@
|
|||
}
|
||||
const params = selectedRowKeys.value.map((m) => {
|
||||
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(() => {
|
||||
|
|
Loading…
Reference in New Issue