mirror of https://gitee.com/xiaonuobase/snowy
【更新】代码生成增强,生成到插件与模块可配置,新增及编辑加入事务注解
parent
08e70171bc
commit
e11abd1f9a
|
@ -413,6 +413,7 @@ body,
|
|||
.index-message-list,
|
||||
.ant-picker-time-panel-column,
|
||||
.timeline-div,
|
||||
.gen-preview-content,
|
||||
|
||||
.adminui-main{
|
||||
&::-webkit-scrollbar {
|
||||
|
|
|
@ -27,11 +27,14 @@
|
|||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="表前缀移除:" name="tablePrefix">
|
||||
<a-radio-group v-model:value="formData.tablePrefix" :options="tablePrefixOptions" @change="tablePrefixChange"> </a-radio-group>
|
||||
<a-radio-group
|
||||
v-model:value="formData.tablePrefix"
|
||||
:options="tablePrefixOptions"
|
||||
@change="tablePrefixChange"
|
||||
>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="8">
|
||||
<a-form-item label="生成方式:" name="generateType">
|
||||
<a-radio-group v-model:value="formData.generateType" :options="generateTypeOptions"> </a-radio-group>
|
||||
|
@ -69,15 +72,51 @@
|
|||
></a-tree-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="8">
|
||||
<a-form-item name="pluginName">
|
||||
<template #label>
|
||||
<a-tooltip>
|
||||
<template #title>
|
||||
不想吧代码生成到本框架指定插件名称下,可以新建一个plugin模块,并这里改为新的名字。
|
||||
</template>
|
||||
<question-circle-outlined />
|
||||
</a-tooltip>
|
||||
  插件名:
|
||||
</template>
|
||||
<a-input v-model:value="formData.pluginName" placeholder="请输入插件名" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="包名:" name="packageName">
|
||||
<a-input v-model:value="formData.packageName" placeholder="请输入包名" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item name="moduleName">
|
||||
<template #label>
|
||||
<a-tooltip>
|
||||
<template #title> 代码模块名就是包名后面的代码包,例如:vip.xiaonuo.*,*代表此模块名。 </template>
|
||||
<question-circle-outlined />
|
||||
</a-tooltip>
|
||||
  模块名:
|
||||
</template>
|
||||
<a-input v-model:value="formData.moduleName" placeholder="请输入模块名" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="功能名:" name="functionName">
|
||||
<a-input v-model:value="formData.functionName" placeholder="请输入功能名" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="业务名:" name="busName">
|
||||
<a-form-item name="busName">
|
||||
<template #label>
|
||||
<a-tooltip>
|
||||
<template #title> 业务名是代码生成后,存放controller、service等代码的文件夹名称。 </template>
|
||||
<question-circle-outlined />
|
||||
</a-tooltip>
|
||||
  业务名:
|
||||
</template>
|
||||
<a-input v-model:value="formData.busName" placeholder="请输入业务名" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
@ -86,33 +125,38 @@
|
|||
<a-input v-model:value="formData.className" placeholder="请输入类名" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="8">
|
||||
<a-form-item label="表单布局:" name="formLayout">
|
||||
<a-radio-group v-model:value="formData.formLayout" :options="formLayoutOptions" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="使用栅格:" name="gridWhether">
|
||||
<a-radio-group v-model:value="formData.gridWhether" :options="gridWhetherOptions" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="排序:" name="sortCode">
|
||||
<a-slider v-model:value="formData.sortCode" :max="100" style="width: 100%"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="8">
|
||||
<a-form-item label="作者:" name="authorName">
|
||||
<a-input v-model:value="formData.authorName" placeholder="请输入作者名" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8" v-if="formData.generateType === 'ZIP'">
|
||||
<a-form-item label="包名:" name="packageName">
|
||||
<a-input v-model:value="formData.packageName" placeholder="请输入包名" allow-clear />
|
||||
<a-col :span="8">
|
||||
<a-form-item name="formLayout">
|
||||
<template #label>
|
||||
<a-tooltip>
|
||||
<template #title> 垂直选项生成出来的前端表单代码为名称跟输入框是上下两行,反之水平则是一行。 </template>
|
||||
<question-circle-outlined />
|
||||
</a-tooltip>
|
||||
  表单布局:
|
||||
</template>
|
||||
<a-radio-group v-model:value="formData.formLayout" :options="formLayoutOptions" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item name="gridWhether">
|
||||
<template #label>
|
||||
<a-tooltip>
|
||||
<template #title> 如果使用了栅格配置,即生成出来的前端代码,表单是一排两列,并非一排一列。 </template>
|
||||
<question-circle-outlined />
|
||||
</a-tooltip>
|
||||
  使用栅格:
|
||||
</template>
|
||||
<a-radio-group v-model:value="formData.gridWhether" :options="gridWhetherOptions" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="排序:" name="sortCode">
|
||||
<a-slider v-model:value="formData.sortCode" :max="100" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
@ -171,7 +215,7 @@
|
|||
{
|
||||
label: '不使用',
|
||||
value: 'N'
|
||||
},
|
||||
}
|
||||
])
|
||||
// 打开抽屉
|
||||
const onOpen = (record) => {
|
||||
|
@ -197,21 +241,26 @@
|
|||
id: record.id
|
||||
}
|
||||
submitLoading.value = true
|
||||
genBasicApi.basicDetail(params).then((data) => {
|
||||
formData.value = data
|
||||
// 让主键选中
|
||||
selectTableColumnsData(data.dbTable, true)
|
||||
// 让模块旁边的上级菜单选中
|
||||
moduleChange(data.module, true)
|
||||
}).finally(() => {
|
||||
submitLoading.value = false
|
||||
})
|
||||
genBasicApi
|
||||
.basicDetail(params)
|
||||
.then((data) => {
|
||||
formData.value = data
|
||||
// 让主键选中
|
||||
selectTableColumnsData(data.dbTable, true)
|
||||
// 让模块旁边的上级菜单选中
|
||||
moduleChange(data.module, true)
|
||||
})
|
||||
.finally(() => {
|
||||
submitLoading.value = false
|
||||
})
|
||||
} else {
|
||||
formData.value = {
|
||||
pluginName: 'snowy-plugin-biz',
|
||||
packageName: 'vip.xiaonuo',
|
||||
moduleName: 'biz',
|
||||
sortCode: 99,
|
||||
tablePrefix: 'Y',
|
||||
generateType: 'ZIP',
|
||||
packageName: 'vip.xiaonuo',
|
||||
formLayout: 'vertical',
|
||||
gridWhether: 'N'
|
||||
}
|
||||
|
@ -220,6 +269,8 @@
|
|||
}
|
||||
// 默认要校验的
|
||||
const formRules = {
|
||||
pluginName: [required('请输入插件名')],
|
||||
moduleName: [required('请输入模块名')],
|
||||
tablePrefix: [required('请选择是否移除表前缀')],
|
||||
dbTable: [required('请选择主表')],
|
||||
dbTableKey: [required('请选择主表主键')],
|
||||
|
@ -340,19 +391,23 @@
|
|||
}
|
||||
// 验证并提交数据
|
||||
const onSubmit = () => {
|
||||
return new Promise((resolve,reject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
submitLoading.value = true
|
||||
genBasicApi.submitForm(formData.value, !formData.value.id).then((data) => {
|
||||
resolve(data)
|
||||
}).finally(() => {
|
||||
submitLoading.value = false
|
||||
})
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
genBasicApi
|
||||
.submitForm(formData.value, !formData.value.id)
|
||||
.then((data) => {
|
||||
resolve(data)
|
||||
})
|
||||
.finally(() => {
|
||||
submitLoading.value = false
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
// 调用这个函数将子组件的一些数据和方法暴露出去
|
||||
|
|
|
@ -33,10 +33,7 @@
|
|||
</template>
|
||||
<template v-if="column.dataIndex === 'dictTypeCode'">
|
||||
<a-select
|
||||
v-if="
|
||||
record.effectType === 'radio' ||
|
||||
record.effectType === 'select' ||
|
||||
record.effectType === 'checkbox'"
|
||||
v-if="record.effectType === 'radio' || record.effectType === 'select' || record.effectType === 'checkbox'"
|
||||
style="width: 100%"
|
||||
v-model:value="record.dictTypeCode"
|
||||
:options="dictTypeCodeOptions"
|
||||
|
@ -54,7 +51,10 @@
|
|||
<a-checkbox v-model:checked="record.whetherAddUpdate" :disabled="toFieldEstimate(record)" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'whetherRequired'">
|
||||
<a-checkbox v-model:checked="record.whetherRequired" :disabled="toFieldEstimate(record) || !record.whetherAddUpdate" />
|
||||
<a-checkbox
|
||||
v-model:checked="record.whetherRequired"
|
||||
:disabled="toFieldEstimate(record) || !record.whetherAddUpdate"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'queryWhether'">
|
||||
<a-switch v-model:checked="record.queryWhether" :disabled="!record.whetherTable" />
|
||||
|
@ -77,7 +77,7 @@
|
|||
|
||||
<script setup name="genConfig">
|
||||
import tool from '@/utils/tool'
|
||||
import genConfigApi from "@/api/gen/genConfigApi";
|
||||
import genConfigApi from '@/api/gen/genConfigApi'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
|
||||
const table = ref()
|
||||
|
@ -169,7 +169,7 @@
|
|||
parameter.basicId = recordData.value.id
|
||||
return genConfigApi.configList(parameter).then((data) => {
|
||||
tableData.value = JSON.parse(JSON.stringify(data))
|
||||
let deleteIndex = [];
|
||||
let deleteIndex = []
|
||||
tableData.value.forEach((item, index) => {
|
||||
for (const key in item) {
|
||||
if (item[key] === 'Y') {
|
||||
|
@ -239,7 +239,7 @@
|
|||
{
|
||||
label: 'BigDecimal',
|
||||
value: 'BigDecimal'
|
||||
},
|
||||
}
|
||||
])
|
||||
// 类型
|
||||
const effectTypeOptions = ref([
|
||||
|
@ -324,27 +324,31 @@
|
|||
])
|
||||
const emit = defineEmits({ successful: null }, { close: null })
|
||||
const toFieldEstimate = (data) => {
|
||||
if (data.fieldName.toLowerCase().indexOf('create_user') > -1 ||
|
||||
if (
|
||||
data.fieldName.toLowerCase().indexOf('create_user') > -1 ||
|
||||
data.fieldName.toLowerCase().indexOf('create_time') > -1 ||
|
||||
data.fieldName.toLowerCase().indexOf('update_user') > -1 ||
|
||||
data.fieldName.toLowerCase().indexOf('update_time') > -1 ||
|
||||
data.fieldName.toLowerCase().indexOf('delete_flag') > -1 ||
|
||||
data.isTableKey === true) {
|
||||
data.isTableKey === true
|
||||
) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
// 通用字段是否可选
|
||||
const toCommonFieldEstimate = (record) => {
|
||||
if (record.fieldName.toLowerCase().indexOf('create_user') > -1 ||
|
||||
record.fieldName.toLowerCase().indexOf('update_user') > -1 ) {
|
||||
if (
|
||||
record.fieldName.toLowerCase().indexOf('create_user') > -1 ||
|
||||
record.fieldName.toLowerCase().indexOf('update_user') > -1
|
||||
) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
// 设置该下拉框是否能选
|
||||
const toFieldSelectEstimate = (record) => {
|
||||
if ( record.fieldJavaType === 'Date' && record.effectType === 'datepicker' ) {
|
||||
if (record.fieldJavaType === 'Date' && record.effectType === 'datepicker') {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
@ -358,8 +362,8 @@
|
|||
// 提交
|
||||
const onSubmit = (recordData) => {
|
||||
let submitParam = cloneDeep(tableData.value)
|
||||
let errStatus = 100;
|
||||
submitParam.forEach(item => {
|
||||
let errStatus = 100
|
||||
submitParam.forEach((item) => {
|
||||
// 必填那一项转换
|
||||
for (const key in item) {
|
||||
if (item[key] === true) {
|
||||
|
@ -372,25 +376,29 @@
|
|||
if (item.queryWhether === 'Y' && !item.queryType) {
|
||||
// 排除掉时间选择
|
||||
if (item.fieldJavaType !== 'Date' && item.effectType !== 'checkbox') {
|
||||
errStatus ++
|
||||
errStatus++
|
||||
}
|
||||
}
|
||||
if ((item.effectType === 'select' ||
|
||||
item.effectType === 'radio' ||
|
||||
item.effectType === 'checkbox') && !item.dictTypeCode) {
|
||||
errStatus ++
|
||||
if (
|
||||
(item.effectType === 'select' || item.effectType === 'radio' || item.effectType === 'checkbox') &&
|
||||
!item.dictTypeCode
|
||||
) {
|
||||
errStatus++
|
||||
}
|
||||
})
|
||||
return new Promise((resolve,reject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (errStatus > 100) {
|
||||
reject('校验失败,请选择对应的下拉框选项')
|
||||
return
|
||||
}
|
||||
genConfigApi.configEditBatch(submitParam).then((data) => {
|
||||
resolve(data)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
genConfigApi
|
||||
.configEditBatch(submitParam)
|
||||
.then((data) => {
|
||||
resolve(data)
|
||||
})
|
||||
.catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
// 抛出钩子
|
||||
|
|
|
@ -14,17 +14,29 @@
|
|||
<template #operator class="table-operator">
|
||||
<a-space>
|
||||
<a-button type="primary" @click="openConfig()">
|
||||
<template #icon><plus-outlined /></template>
|
||||
新建
|
||||
</a-button>
|
||||
<a-button danger @click="deleteBatchCodeGen()">删除</a-button>
|
||||
|
||||
<a-popconfirm
|
||||
title="删除此信息?"
|
||||
:visible="deleteVisible"
|
||||
@visibleChange="deleteVisibleChange"
|
||||
@confirm="deleteBatchCodeGen"
|
||||
>
|
||||
<a-button type="danger">
|
||||
<template #icon><delete-outlined /></template>
|
||||
删除
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'tablePrefix'">
|
||||
{{tablePrefixFilter(record.tablePrefix)}}
|
||||
{{ tablePrefixFilter(record.tablePrefix) }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'generateType'">
|
||||
{{generateTypeFilter(record.generateType)}}
|
||||
{{ generateTypeFilter(record.generateType) }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<a @click="genPreviewRef.onOpen(record)">预览</a>
|
||||
|
@ -35,14 +47,14 @@
|
|||
<a-divider type="vertical" />
|
||||
<a @click="openConfig(record)">配置</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm title="删除此信息?" @confirm="deleteCodeGen(record)">
|
||||
<a-popconfirm title="删除此信息?" placement="topRight" @confirm="deleteCodeGen(record)">
|
||||
<a-button type="link" danger size="small">删除</a-button>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
</template>
|
||||
</s-table>
|
||||
</a-card>
|
||||
<steps v-else ref="stepsRef" @successful="table.refresh(true)" @closed="closeConfig()"/>
|
||||
<steps v-else ref="stepsRef" @successful="table.refresh(true)" @closed="closeConfig()" />
|
||||
<genPreview ref="genPreviewRef" />
|
||||
</template>
|
||||
|
||||
|
@ -56,6 +68,7 @@
|
|||
const indexShow = ref(true)
|
||||
const stepsRef = ref()
|
||||
const genPreviewRef = ref()
|
||||
const deleteVisible = ref(false)
|
||||
|
||||
const columns = [
|
||||
{
|
||||
|
@ -160,16 +173,16 @@
|
|||
} else {
|
||||
// 下载压缩包
|
||||
genBasicApi.basicExecGenBiz(param).then((res) => {
|
||||
const blob = new Blob([res.data],{type: 'application/octet-stream;charset=UTF-8'});
|
||||
const blob = new Blob([res.data], { type: 'application/octet-stream;charset=UTF-8' })
|
||||
const contentDisposition = res.headers['content-disposition']
|
||||
const patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
|
||||
const $link = document.createElement("a");
|
||||
$link.href = URL.createObjectURL(blob);
|
||||
const $link = document.createElement('a')
|
||||
$link.href = URL.createObjectURL(blob)
|
||||
$link.download = decodeURIComponent(patt.exec(contentDisposition)[1])
|
||||
$link.click();
|
||||
document.body.appendChild($link);
|
||||
document.body.removeChild($link); // 下载完成移除元素
|
||||
window.URL.revokeObjectURL($link.href); // 释放掉blob对象
|
||||
$link.click()
|
||||
document.body.appendChild($link)
|
||||
document.body.removeChild($link) // 下载完成移除元素
|
||||
window.URL.revokeObjectURL($link.href) // 释放掉blob对象
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -184,12 +197,22 @@
|
|||
table.value.refresh()
|
||||
})
|
||||
}
|
||||
// 批量删除
|
||||
const deleteBatchCodeGen = () => {
|
||||
if (selectedRowKeys.value.length < 1) {
|
||||
message.warning('请选择一条或多条数据')
|
||||
// 批量删除校验
|
||||
const deleteVisibleChange = () => {
|
||||
if (deleteVisible.value) {
|
||||
deleteVisible.value = false
|
||||
return false
|
||||
}
|
||||
if (selectedRowKeys.value.length < 1) {
|
||||
message.warning('请选择一条或多条数据')
|
||||
deleteVisible.value = false
|
||||
return false
|
||||
} else {
|
||||
deleteVisible.value = true
|
||||
}
|
||||
}
|
||||
// 批量删除
|
||||
const deleteBatchCodeGen = () => {
|
||||
const params = selectedRowKeys.value.map((m) => {
|
||||
return {
|
||||
id: m
|
||||
|
|
|
@ -9,11 +9,16 @@
|
|||
>
|
||||
<a-spin :spinning="loadingSpinning">
|
||||
<a-tabs v-model:activeKey="codeTypeActiveKey" @change="codeTypeChange">
|
||||
<a-tab-pane v-for="codeType in codeTypeArray" :key="codeType.codeTypeKey" :tab="codeType.codeTypeTitle" force-render>
|
||||
<a-tab-pane
|
||||
v-for="codeType in codeTypeArray"
|
||||
:key="codeType.codeTypeKey"
|
||||
:tab="codeType.codeTypeTitle"
|
||||
force-render
|
||||
>
|
||||
<a-tabs v-model:activeKey="typeListActiveKey" tab-position="left" hide-add type="card">
|
||||
<a-tab-pane v-for="pan in codeType.codeTypeList" :key="pan.codeFileName" :tab="pan.codeFileName">
|
||||
<div style="height: calc(100vh - 160px); overflow: auto">
|
||||
<a-textarea ref="textareaRef" v-model:value="pan.codeFileContent" :autoSize="true" />
|
||||
<div class="gen-preview-content">
|
||||
<XnHighlightjs :code="pan.codeFileContent" />
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
|
@ -39,31 +44,34 @@
|
|||
const param = {
|
||||
id: record.id
|
||||
}
|
||||
genBasicApi.basicPreviewGen(param).then((data) => {
|
||||
if (data) {
|
||||
codeTypeArray.value = [
|
||||
{
|
||||
codeTypeKey: 'frontend',
|
||||
codeTypeTitle: '前端代码',
|
||||
codeTypeList: data.genBasicCodeFrontendResultList
|
||||
},
|
||||
{
|
||||
codeTypeKey: 'backend',
|
||||
codeTypeTitle: '后端代码',
|
||||
codeTypeList: data.genBasicCodeBackendResultList
|
||||
},
|
||||
{
|
||||
codeTypeKey: 'sqlend',
|
||||
codeTypeTitle: 'SQL文件',
|
||||
codeTypeList: data.genBasicCodeSqlResultList
|
||||
}
|
||||
]
|
||||
} else {
|
||||
message.warning('预览失败:请检查问题或反馈小诺官方')
|
||||
}
|
||||
}).finally(() => {
|
||||
loadingSpinning.value = false
|
||||
})
|
||||
genBasicApi
|
||||
.basicPreviewGen(param)
|
||||
.then((data) => {
|
||||
if (data) {
|
||||
codeTypeArray.value = [
|
||||
{
|
||||
codeTypeKey: 'frontend',
|
||||
codeTypeTitle: '前端代码',
|
||||
codeTypeList: data.genBasicCodeFrontendResultList
|
||||
},
|
||||
{
|
||||
codeTypeKey: 'backend',
|
||||
codeTypeTitle: '后端代码',
|
||||
codeTypeList: data.genBasicCodeBackendResultList
|
||||
},
|
||||
{
|
||||
codeTypeKey: 'sqlend',
|
||||
codeTypeTitle: 'SQL文件',
|
||||
codeTypeList: data.genBasicCodeSqlResultList
|
||||
}
|
||||
]
|
||||
} else {
|
||||
message.warning('预览失败:请检查问题或反馈小诺官方')
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
loadingSpinning.value = false
|
||||
})
|
||||
}
|
||||
// 关闭抽屉
|
||||
const onClose = () => {
|
||||
|
@ -77,3 +85,9 @@
|
|||
onOpen
|
||||
})
|
||||
</script>
|
||||
<style type="less" scoped>
|
||||
.gen-preview-content {
|
||||
height: calc(100vh - 160px);
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -12,9 +12,7 @@
|
|||
<div style="float: right">
|
||||
<a-button :disabled="current === 0" style="margin-left: 8px" @click="prev"> 上一步 </a-button>
|
||||
<a-button :disabled="current === 2" type="primary" style="margin-left: 8px" @click="next"> 继续 </a-button>
|
||||
<a-button type="primary" danger ghost style="margin-left: 8px" @click="emit('closed')">
|
||||
关闭
|
||||
</a-button>
|
||||
<a-button type="primary" danger ghost style="margin-left: 8px" @click="emit('closed')"> 关闭 </a-button>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
@ -24,14 +22,16 @@
|
|||
<basic ref="basicRef" />
|
||||
</div>
|
||||
<div v-if="current === 1">
|
||||
<config ref="configRef"/>
|
||||
<config ref="configRef" />
|
||||
</div>
|
||||
<div v-if="current === 2">
|
||||
<a-card>
|
||||
<a-result status="success" title="操作成功" sub-title="此刻可预览代码,同时您可以一键生成代码啦">
|
||||
<template #extra>
|
||||
<a-space size="middle">
|
||||
<a-button v-if="current > 0" style="margin-left: 8px" @click="genPreviewRef.onOpen(recordData)">预览</a-button>
|
||||
<a-button v-if="current > 0" style="margin-left: 8px" @click="genPreviewRef.onOpen(recordData)"
|
||||
>预览</a-button
|
||||
>
|
||||
<a-button
|
||||
v-if="current === steps.length - 1"
|
||||
type="primary"
|
||||
|
@ -52,7 +52,7 @@
|
|||
import basic from './basic.vue'
|
||||
import config from './config.vue'
|
||||
import genPreview from './preview.vue'
|
||||
import genBasicApi from "@/api/gen/genBasicApi";
|
||||
import genBasicApi from '@/api/gen/genBasicApi'
|
||||
|
||||
const emit = defineEmits({ closed: null })
|
||||
const current = ref(0)
|
||||
|
@ -80,11 +80,14 @@
|
|||
current.value--
|
||||
}
|
||||
if (current.value === 2) {
|
||||
configRef.value.onSubmit(recordData.value).then((data) => {
|
||||
current.value++
|
||||
}).catch((err) => {
|
||||
message.warning(err)
|
||||
})
|
||||
configRef.value
|
||||
.onSubmit(recordData.value)
|
||||
.then((data) => {
|
||||
current.value++
|
||||
})
|
||||
.catch((err) => {
|
||||
message.warning(err)
|
||||
})
|
||||
current.value--
|
||||
}
|
||||
}
|
||||
|
@ -130,16 +133,16 @@
|
|||
} else {
|
||||
// 下载压缩包
|
||||
genBasicApi.basicExecGenBiz(param).then((res) => {
|
||||
const blob = new Blob([res.data],{type: 'application/octet-stream;charset=UTF-8'});
|
||||
const blob = new Blob([res.data], { type: 'application/octet-stream;charset=UTF-8' })
|
||||
const contentDisposition = res.headers['content-disposition']
|
||||
const patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
|
||||
const $link = document.createElement("a");
|
||||
$link.href = URL.createObjectURL(blob);
|
||||
const $link = document.createElement('a')
|
||||
$link.href = URL.createObjectURL(blob)
|
||||
$link.download = decodeURIComponent(patt.exec(contentDisposition)[1])
|
||||
$link.click();
|
||||
document.body.appendChild($link);
|
||||
document.body.removeChild($link); // 下载完成移除元素
|
||||
window.URL.revokeObjectURL($link.href); // 释放掉blob对象
|
||||
$link.click()
|
||||
document.body.appendChild($link)
|
||||
document.body.removeChild($link) // 下载完成移除元素
|
||||
window.URL.revokeObjectURL($link.href) // 释放掉blob对象
|
||||
emit('closed')
|
||||
})
|
||||
}
|
||||
|
|
|
@ -41,51 +41,59 @@ public class GenBasic extends CommonEntity {
|
|||
@ApiModelProperty(value = "主表主键", position = 3)
|
||||
private String dbTableKey;
|
||||
|
||||
/** 插件名 */
|
||||
@ApiModelProperty(value = "插件名", position = 4)
|
||||
private String pluginName;
|
||||
|
||||
/** 模块名 */
|
||||
@ApiModelProperty(value = "模块名", position = 5)
|
||||
private String moduleName;
|
||||
|
||||
/** 表前缀移除 */
|
||||
@ApiModelProperty(value = "表前缀移除", position = 4)
|
||||
@ApiModelProperty(value = "表前缀移除", position = 6)
|
||||
private String tablePrefix;
|
||||
|
||||
/** 生成方式 */
|
||||
@ApiModelProperty(value = "生成方式", position = 5)
|
||||
@ApiModelProperty(value = "生成方式", position = 7)
|
||||
private String generateType;
|
||||
|
||||
/** 所属模块 */
|
||||
@ApiModelProperty(value = "所属模块", position = 6)
|
||||
@ApiModelProperty(value = "所属模块", position = 8)
|
||||
private String module;
|
||||
|
||||
/** 上级目录 */
|
||||
@ApiModelProperty(value = "上级目录", position = 7)
|
||||
@ApiModelProperty(value = "上级目录", position = 9)
|
||||
private String menuPid;
|
||||
|
||||
/** 功能名 */
|
||||
@ApiModelProperty(value = "功能名", position = 8)
|
||||
@ApiModelProperty(value = "功能名", position = 10)
|
||||
private String functionName;
|
||||
|
||||
/** 业务名 */
|
||||
@ApiModelProperty(value = "业务名", position = 9)
|
||||
@ApiModelProperty(value = "业务名", position = 11)
|
||||
private String busName;
|
||||
|
||||
/** 类名 */
|
||||
@ApiModelProperty(value = "类名", position = 10)
|
||||
@ApiModelProperty(value = "类名", position = 12)
|
||||
private String className;
|
||||
|
||||
/** 表单布局 */
|
||||
@ApiModelProperty(value = "表单布局", position = 11)
|
||||
@ApiModelProperty(value = "表单布局", position = 13)
|
||||
private String formLayout;
|
||||
|
||||
/** 使用栅格 */
|
||||
@ApiModelProperty(value = "使用栅格", position = 12)
|
||||
@ApiModelProperty(value = "使用栅格", position = 14)
|
||||
private String gridWhether;
|
||||
|
||||
/** 排序 */
|
||||
@ApiModelProperty(value = "排序", position = 13)
|
||||
@ApiModelProperty(value = "排序", position = 15)
|
||||
private Integer sortCode;
|
||||
|
||||
/** 包名 */
|
||||
@ApiModelProperty(value = "包名", position = 14)
|
||||
@ApiModelProperty(value = "包名", position = 16)
|
||||
private String packageName;
|
||||
|
||||
/** 作者 */
|
||||
@ApiModelProperty(value = "作者", position = 15)
|
||||
@ApiModelProperty(value = "作者", position = 17)
|
||||
private String authorName;
|
||||
}
|
||||
|
|
|
@ -38,61 +38,71 @@ public class GenBasicAddParam {
|
|||
@NotNull(message = "dbTableKey不能为空")
|
||||
private String dbTableKey;
|
||||
|
||||
/** 插件名 */
|
||||
@ApiModelProperty(value = "插件名", required = true, position = 3)
|
||||
@NotNull(message = "pluginName不能为空")
|
||||
private String pluginName;
|
||||
|
||||
/** 模块名 */
|
||||
@ApiModelProperty(value = "模块名", required = true, position = 4)
|
||||
@NotNull(message = "moduleName不能为空")
|
||||
private String moduleName;
|
||||
|
||||
/** 表前缀移除 */
|
||||
@ApiModelProperty(value = "表前缀移除", required = true, position = 3)
|
||||
@ApiModelProperty(value = "表前缀移除", required = true, position = 5)
|
||||
@NotNull(message = "tablePrefix不能为空")
|
||||
private String tablePrefix;
|
||||
|
||||
/** 生成方式 */
|
||||
@ApiModelProperty(value = "生成方式", required = true, position = 4)
|
||||
@ApiModelProperty(value = "生成方式", required = true, position = 6)
|
||||
@NotNull(message = "generateType不能为空")
|
||||
private String generateType;
|
||||
|
||||
/** 所属模块 */
|
||||
@ApiModelProperty(value = "所属模块", required = true, position = 5)
|
||||
@ApiModelProperty(value = "所属模块", required = true, position = 7)
|
||||
@NotNull(message = "module不能为空")
|
||||
private String module;
|
||||
|
||||
/** 上级目录 */
|
||||
@ApiModelProperty(value = "上级目录", required = true, position = 6)
|
||||
@ApiModelProperty(value = "上级目录", required = true, position = 8)
|
||||
@NotNull(message = "menuPid不能为空")
|
||||
private String menuPid;
|
||||
|
||||
/** 功能名 */
|
||||
@ApiModelProperty(value = "功能名", required = true, position = 7)
|
||||
@ApiModelProperty(value = "功能名", required = true, position = 8)
|
||||
@NotNull(message = "functionName不能为空")
|
||||
private String functionName;
|
||||
|
||||
/** 业务名 */
|
||||
@ApiModelProperty(value = "业务名", required = true, position = 8)
|
||||
@ApiModelProperty(value = "业务名", required = true, position = 10)
|
||||
@NotNull(message = "busName不能为空")
|
||||
private String busName;
|
||||
|
||||
/** 类名 */
|
||||
@ApiModelProperty(value = "类名", required = true, position = 9)
|
||||
@ApiModelProperty(value = "类名", required = true, position = 11)
|
||||
@NotNull(message = "className不能为空")
|
||||
private String className;
|
||||
|
||||
/** 表单布局 */
|
||||
@ApiModelProperty(value = "表单布局", required = true, position = 10)
|
||||
@ApiModelProperty(value = "表单布局", required = true, position = 12)
|
||||
@NotNull(message = "formLayout不能为空")
|
||||
private String formLayout;
|
||||
|
||||
/** 使用栅格 */
|
||||
@ApiModelProperty(value = "使用栅格", required = true, position = 11)
|
||||
@ApiModelProperty(value = "使用栅格", required = true, position = 13)
|
||||
@NotNull(message = "gridWhether不能为空")
|
||||
private String gridWhether;
|
||||
|
||||
/** 排序 */
|
||||
@ApiModelProperty(value = "排序", required = true, position = 12)
|
||||
@ApiModelProperty(value = "排序", required = true, position = 14)
|
||||
@NotNull(message = "sortCode不能为空")
|
||||
private Integer sortCode;
|
||||
|
||||
/** 作者名 */
|
||||
@ApiModelProperty(value = "作者名", required = true, position = 13)
|
||||
@ApiModelProperty(value = "作者名", required = true, position = 15)
|
||||
private String authorName;
|
||||
|
||||
/** 包名 */
|
||||
@ApiModelProperty(value = "包名", required = true, position = 14)
|
||||
@ApiModelProperty(value = "包名", required = true, position = 16)
|
||||
private String packageName;
|
||||
}
|
||||
|
|
|
@ -43,62 +43,72 @@ public class GenBasicEditParam {
|
|||
@NotNull(message = "dbTableKey不能为空")
|
||||
private String dbTableKey;
|
||||
|
||||
/** 插件名 */
|
||||
@ApiModelProperty(value = "插件名", required = true, position = 4)
|
||||
@NotNull(message = "pluginName不能为空")
|
||||
private String pluginName;
|
||||
|
||||
/** 模块名 */
|
||||
@ApiModelProperty(value = "模块名", required = true, position = 5)
|
||||
@NotNull(message = "moduleName不能为空")
|
||||
private String moduleName;
|
||||
|
||||
/** 表前缀移除 */
|
||||
@ApiModelProperty(value = "表前缀移除", position = 4)
|
||||
@ApiModelProperty(value = "表前缀移除", position = 6)
|
||||
@NotNull(message = "tablePrefix不能为空")
|
||||
private String tablePrefix;
|
||||
|
||||
/** 生成方式 */
|
||||
@ApiModelProperty(value = "生成方式", position = 5)
|
||||
@ApiModelProperty(value = "生成方式", position = 7)
|
||||
@NotNull(message = "generateType不能为空")
|
||||
private String generateType;
|
||||
|
||||
/** 所属模块 */
|
||||
@ApiModelProperty(value = "所属模块", position = 6)
|
||||
@ApiModelProperty(value = "所属模块", position = 8)
|
||||
@NotNull(message = "module不能为空")
|
||||
private String module;
|
||||
|
||||
/** 上级目录 */
|
||||
@ApiModelProperty(value = "上级目录", position = 7)
|
||||
@ApiModelProperty(value = "上级目录", position = 9)
|
||||
@NotNull(message = "menuPid不能为空")
|
||||
private String menuPid;
|
||||
|
||||
/** 功能名 */
|
||||
@ApiModelProperty(value = "功能名", position = 8)
|
||||
@ApiModelProperty(value = "功能名", position = 10)
|
||||
@NotNull(message = "functionName不能为空")
|
||||
private String functionName;
|
||||
|
||||
/** 业务名 */
|
||||
@ApiModelProperty(value = "业务名", position = 9)
|
||||
@ApiModelProperty(value = "业务名", position = 11)
|
||||
@NotNull(message = "busName不能为空")
|
||||
private String busName;
|
||||
|
||||
/** 类名 */
|
||||
@ApiModelProperty(value = "类名", position = 10)
|
||||
@ApiModelProperty(value = "类名", position = 12)
|
||||
@NotNull(message = "className不能为空")
|
||||
private String className;
|
||||
|
||||
/** 表单布局 */
|
||||
@ApiModelProperty(value = "表单布局", position = 11)
|
||||
@ApiModelProperty(value = "表单布局", position = 13)
|
||||
@NotNull(message = "formLayout不能为空")
|
||||
private String formLayout;
|
||||
|
||||
/** 使用栅格 */
|
||||
@ApiModelProperty(value = "使用栅格", position = 12)
|
||||
@ApiModelProperty(value = "使用栅格", position = 14)
|
||||
@NotNull(message = "gridWhether不能为空")
|
||||
private String gridWhether;
|
||||
|
||||
/** 排序 */
|
||||
@ApiModelProperty(value = "排序", position = 13)
|
||||
@ApiModelProperty(value = "排序", position = 15)
|
||||
@NotNull(message = "sortCode不能为空")
|
||||
private Integer sortCode;
|
||||
|
||||
/** 作者名 */
|
||||
@ApiModelProperty(value = "作者名", required = true, position = 14)
|
||||
@ApiModelProperty(value = "作者名", required = true, position = 16)
|
||||
@NotNull(message = "authorName不能为空")
|
||||
private String authorName;
|
||||
|
||||
/** 包名 */
|
||||
@ApiModelProperty(value = "包名 */", position = 15)
|
||||
@ApiModelProperty(value = "包名 */", position = 17)
|
||||
private String packageName;
|
||||
}
|
||||
|
|
|
@ -85,22 +85,18 @@ public class GenBasicServiceImpl extends ServiceImpl<GenBasicMapper, GenBasic> i
|
|||
|
||||
private static final String DB_PASSWORD_KEY = "spring.datasource.dynamic.datasource.master.password";
|
||||
|
||||
private static final String MODULE_KEY = "biz";
|
||||
|
||||
private static final String GEN_PROJECT_FRONT_PLUGIN_KEY = "snowy-admin-web";
|
||||
|
||||
private static final String GEN_PROJECT_PLUGIN_KEY = "snowy-plugin";
|
||||
|
||||
private static final String GEN_PROJECT_PLUGIN_BIZ_KEY = GEN_PROJECT_PLUGIN_KEY + File.separator + "snowy-plugin-biz";
|
||||
|
||||
private static final List<JSONObject> GEN_SQL_FILE_LIST = CollectionUtil.newArrayList(
|
||||
JSONUtil.createObj().set("name", "Mysql.sql.btl"),
|
||||
JSONUtil.createObj().set("name", "Oracle.sql.btl"));
|
||||
|
||||
private static final List<JSONObject> GEN_FRONT_FILE_LIST = CollectionUtil.newArrayList(
|
||||
JSONUtil.createObj().set("name", "Api.js.btl").set("path", "api" + File.separator + MODULE_KEY),
|
||||
JSONUtil.createObj().set("name", "form.vue.btl").set("path", "views" + File.separator + MODULE_KEY),
|
||||
JSONUtil.createObj().set("name", "index.vue.btl").set("path", "views" + File.separator + MODULE_KEY));
|
||||
JSONUtil.createObj().set("name", "Api.js.btl").set("path", "api"),
|
||||
JSONUtil.createObj().set("name", "form.vue.btl").set("path", "views"),
|
||||
JSONUtil.createObj().set("name", "index.vue.btl").set("path", "views"));
|
||||
|
||||
private static final List<JSONObject> GEN_BACKEND_FILE_LIST = CollectionUtil.newArrayList(
|
||||
JSONUtil.createObj().set("name", "Controller.java.btl").set("path", "controller"),
|
||||
|
@ -162,6 +158,34 @@ public class GenBasicServiceImpl extends ServiceImpl<GenBasicMapper, GenBasic> i
|
|||
public GenBasic add(GenBasicAddParam genBasicAddParam) {
|
||||
GenBasic genBasic = BeanUtil.toBean(genBasicAddParam, GenBasic.class);
|
||||
this.save(genBasic);
|
||||
addGenConfig(genBasic);
|
||||
return genBasic;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public GenBasic edit(GenBasicEditParam genBasicEditParam) {
|
||||
GenBasic genBasic = this.queryEntity(genBasicEditParam.getId());
|
||||
if (!genBasic.getDbTable().equals(genBasicEditParam.getDbTable())) {
|
||||
// 删除配置表内该表的字段
|
||||
QueryWrapper<GenConfig> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(GenConfig::getBasicId, genBasic.getId());
|
||||
genConfigService.remove(queryWrapper);
|
||||
// 新增新表的数据字段
|
||||
addGenConfig(genBasic);
|
||||
}
|
||||
BeanUtil.copyProperties(genBasicEditParam, genBasic);
|
||||
this.updateById(genBasic);
|
||||
return genBasic;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增表字段至配置内
|
||||
*
|
||||
* @author yubaoshan
|
||||
* @date 2023/02/22 00:54
|
||||
*/
|
||||
private void addGenConfig (GenBasic genBasic) {
|
||||
GenBasicTableColumnParam tableColumnParam = new GenBasicTableColumnParam();
|
||||
tableColumnParam.setTableName(genBasic.getDbTable());
|
||||
List<GenBasicTableColumnResult> resultList = this.tableColumns(tableColumnParam);
|
||||
|
@ -203,16 +227,6 @@ public class GenBasicServiceImpl extends ServiceImpl<GenBasicMapper, GenBasic> i
|
|||
GenConfig genConfig = BeanUtil.toBean(addParam, GenConfig.class);
|
||||
genConfigService.save(genConfig);
|
||||
}
|
||||
return genBasic;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public GenBasic edit(GenBasicEditParam genBasicEditParam) {
|
||||
GenBasic genBasic = this.queryEntity(genBasicEditParam.getId());
|
||||
BeanUtil.copyProperties(genBasicEditParam, genBasic);
|
||||
this.updateById(genBasic);
|
||||
return genBasic;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
@ -352,6 +366,11 @@ public class GenBasicServiceImpl extends ServiceImpl<GenBasicMapper, GenBasic> i
|
|||
throw new CommonException("前端代码生成位置:{}不存在,请检查位置", genProjectFrontendPath);
|
||||
}
|
||||
|
||||
GenBasic genBasic = this.queryEntity(genBasicIdParam.getId());
|
||||
String genModuleName = genBasic.getModuleName();
|
||||
String genPluginName = genBasic.getPluginName();
|
||||
String GEN_PROJECT_PLUGIN_BIZ_KEY = GEN_PROJECT_PLUGIN_KEY + File.separator + genPluginName;
|
||||
|
||||
// 定义后端生成的目录
|
||||
String genProjectBackendPath = System.getProperty("user.dir") + File.separator + GEN_PROJECT_PLUGIN_BIZ_KEY + File.separator + "src" +
|
||||
File.separator + "main" + File.separator + "java";
|
||||
|
@ -360,11 +379,9 @@ public class GenBasicServiceImpl extends ServiceImpl<GenBasicMapper, GenBasic> i
|
|||
throw new CommonException("后端代码生成位置:{}不存在,请检查位置", genProjectBackendPath);
|
||||
}
|
||||
try {
|
||||
GenBasic genBasic = this.queryEntity(genBasicIdParam.getId());
|
||||
|
||||
// 生成菜单
|
||||
String menuId = sysMenuApi.addForGenMenu(genBasic.getMenuPid(), genBasic.getBusName(), genBasic.getModule(), genBasic.getFunctionName(),
|
||||
StrUtil.SLASH + MODULE_KEY + StrUtil.SLASH + genBasic.getBusName());
|
||||
StrUtil.SLASH + genModuleName + StrUtil.SLASH + genBasic.getBusName());
|
||||
|
||||
// 生成按钮
|
||||
sysButtonApi.addForGenButton(menuId, genBasic.getClassName(), genBasic.getFunctionName());
|
||||
|
@ -456,7 +473,7 @@ public class GenBasicServiceImpl extends ServiceImpl<GenBasicMapper, GenBasic> i
|
|||
List<GenBasicPreviewResult.GenBasicCodeResult> genBasicCodeFrontendResultList = CollectionUtil.newArrayList();
|
||||
GEN_FRONT_FILE_LIST.forEach(fileJsonObject -> {
|
||||
String fileTemplateName = fileJsonObject.getStr("name");
|
||||
String fileTemplatePath = fileJsonObject.getStr("path");
|
||||
String fileTemplatePath = fileJsonObject.getStr("path") + File.separator + genBasic.getModuleName();
|
||||
GenBasicPreviewResult.GenBasicCodeResult genBasicCodeFrontResult = new GenBasicPreviewResult.GenBasicCodeResult();
|
||||
Template templateFront = groupTemplateFront.getTemplate(fileTemplateName);
|
||||
templateFront.binding(bindingJsonObject);
|
||||
|
@ -476,7 +493,7 @@ public class GenBasicServiceImpl extends ServiceImpl<GenBasicMapper, GenBasic> i
|
|||
|
||||
// 后端基础路径
|
||||
String genBackendBasicPath = StrUtil.replace(genBasic.getPackageName(), StrUtil.DOT, File.separator) +
|
||||
File.separator + MODULE_KEY + File.separator + "modular" + File.separator + genBasic.getBusName() + File.separator;
|
||||
File.separator + genBasic.getModuleName() + File.separator + "modular" + File.separator + genBasic.getBusName() + File.separator;
|
||||
// 后端
|
||||
GroupTemplate groupTemplateBackEnd = new GroupTemplate(new ClasspathResourceLoader("backend"),
|
||||
Configuration.defaultConfiguration());
|
||||
|
@ -513,7 +530,7 @@ public class GenBasicServiceImpl extends ServiceImpl<GenBasicMapper, GenBasic> i
|
|||
public JSONObject getBindingJsonObject(GenBasic genBasic) {
|
||||
JSONObject bindingJsonObject = JSONUtil.createObj();
|
||||
// 代码模块名
|
||||
bindingJsonObject.set("moduleName", MODULE_KEY);
|
||||
bindingJsonObject.set("moduleName", genBasic.getModuleName());
|
||||
// 功能名
|
||||
bindingJsonObject.set("functionName", genBasic.getFunctionName());
|
||||
// 业务名
|
||||
|
@ -547,9 +564,9 @@ public class GenBasicServiceImpl extends ServiceImpl<GenBasicMapper, GenBasic> i
|
|||
// 菜单编码
|
||||
bindingJsonObject.set("menuCode", RandomUtil.randomString(10));
|
||||
// 菜单路径
|
||||
bindingJsonObject.set("menuPath", StrUtil.SLASH + MODULE_KEY + StrUtil.SLASH + genBasic.getBusName());
|
||||
bindingJsonObject.set("menuPath", StrUtil.SLASH + genBasic.getModuleName() + StrUtil.SLASH + genBasic.getBusName());
|
||||
// 菜单组件
|
||||
bindingJsonObject.set("menuComponent", MODULE_KEY + StrUtil.SLASH + genBasic.getBusName() + StrUtil.SLASH + "index");
|
||||
bindingJsonObject.set("menuComponent", genBasic.getModuleName() + StrUtil.SLASH + genBasic.getBusName() + StrUtil.SLASH + "index");
|
||||
// 模块ID
|
||||
bindingJsonObject.set("moduleId", genBasic.getModule());
|
||||
// 添加按钮ID
|
||||
|
|
|
@ -73,12 +73,14 @@ public class ${className}ServiceImpl extends ServiceImpl<${className}Mapper, ${c
|
|||
return this.page(CommonPageRequest.defaultPage(), queryWrapper);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void add(${className}AddParam ${classNameFirstLower}AddParam) {
|
||||
${className} ${classNameFirstLower} = BeanUtil.toBean(${classNameFirstLower}AddParam, ${className}.class);
|
||||
this.save(${classNameFirstLower});
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void edit(${className}EditParam ${classNameFirstLower}EditParam) {
|
||||
<% for(var i = 0; i < configList.~size; i++) { %>
|
||||
|
|
|
@ -519,6 +519,8 @@ CREATE TABLE `GEN_BASIC` (
|
|||
`ID` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
|
||||
`DB_TABLE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主表',
|
||||
`DB_TABLE_KEY` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主表主键',
|
||||
`PLUGIN_NAME` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '插件名',
|
||||
`MODULE_NAME` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '模块名',
|
||||
`TABLE_PREFIX` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '移除表前缀',
|
||||
`GENERATE_TYPE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '生成方式',
|
||||
`MODULE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属模块',
|
||||
|
|
|
@ -847,6 +847,8 @@ CREATE TABLE "SNOWY"."GEN_BASIC" (
|
|||
"ID" NVARCHAR2(20) NOT NULL,
|
||||
"DB_TABLE" NVARCHAR2(255),
|
||||
"DB_TABLE_KEY" NVARCHAR2(255),
|
||||
"PLUGIN_NAME" NVARCHAR2(255),
|
||||
"MODULE_NAME" NVARCHAR2(255),
|
||||
"TABLE_PREFIX" NVARCHAR2(255),
|
||||
"GENERATE_TYPE" NVARCHAR2(255),
|
||||
"MODULE" NVARCHAR2(255),
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue