diff --git a/orion-ops-launch/src/main/java/com/orion/ops/launch/generator/VelocityTemplateEngine.java b/orion-ops-launch/src/main/java/com/orion/ops/launch/generator/VelocityTemplateEngine.java index 29135e9e..0c179f8f 100644 --- a/orion-ops-launch/src/main/java/com/orion/ops/launch/generator/VelocityTemplateEngine.java +++ b/orion-ops-launch/src/main/java/com/orion/ops/launch/generator/VelocityTemplateEngine.java @@ -25,7 +25,6 @@ import com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine; import com.orion.lang.define.collect.MultiLinkedHashMap; import com.orion.lang.utils.Enums; import com.orion.lang.utils.Strings; -import com.orion.lang.utils.VariableStyles; import com.orion.lang.utils.io.Files1; import com.orion.lang.utils.reflect.BeanMap; import com.orion.lang.utils.reflect.Fields; @@ -278,36 +277,6 @@ public class VelocityTemplateEngine extends AbstractTemplateEngine { }); } - /** - * 生成 sql 文件 - * - * @param customFiles customFiles - * @param tableInfo tableInfo - * @param objectMap objectMap - */ - private void generatorSqlFile(@NotNull List customFiles, @NotNull TableInfo tableInfo, @NotNull Map objectMap) { - String outPath = getConfigBuilder().getGlobalConfig().getOutputDir(); - GenTable table = tables.get(tableInfo.getName()); - BeanMap beanMap = BeanMap.create(table, "enums"); - // 模块名称首字母大写 - beanMap.put("moduleFirstUpper", Strings.firstUpper(table.getModule())); - // 功能名称首字母大写 - beanMap.put("featureFirstUpper", Strings.firstUpper(table.getFeature())); - // 功能名称全大写 - beanMap.put("featureAllUpper", table.getFeature().toUpperCase()); - objectMap.put("vue", beanMap); - - // 生成文件 - customFiles.forEach(file -> { - // 文件路径 - String filePath = outPath - + "/" + Strings.format(file.getPackageName(), beanMap) - + "/" + Strings.format(file.getFileName(), beanMap); - // 输出文件 - this.outputFile(Files1.newFile(filePath), objectMap, file.getTemplatePath(), file.isFileOverride()); - }); - } - /** * 是否为后端文件 * @@ -349,10 +318,8 @@ public class VelocityTemplateEngine extends AbstractTemplateEngine { List>> enums = table.getEnums(); Map> enumMap = new LinkedHashMap<>(); for (Class> e : enums) { - // 大驼峰文件名称转为蛇形大写 - String enumTypeName = VariableStyles.BIG_HUMP.toSerpentine(e.getSimpleName()).toUpperCase(); MultiLinkedHashMap fieldValueMap = Enums.getFieldValueMap(e); - enumMap.put(enumTypeName, fieldValueMap); + enumMap.put(e.getSimpleName(), fieldValueMap); } return enumMap; } diff --git a/orion-ops-launch/src/main/resources/templates/orion-sql-menu.sql.vm b/orion-ops-launch/src/main/resources/templates/orion-sql-menu.sql.vm index 3bcbdbae..9b42b229 100644 --- a/orion-ops-launch/src/main/resources/templates/orion-sql-menu.sql.vm +++ b/orion-ops-launch/src/main/resources/templates/orion-sql-menu.sql.vm @@ -1,25 +1,28 @@ -- 执行完成后 需要在菜单页面刷新缓存 --- 设置临时子菜单id +-- 父菜单 +INSERT INTO system_menu + (parent_id, name, type, sort, visible, status, cache) +VALUES + (0, '${vue.comment}管理', 1, 10, 1, 1, 1); + +-- 设置临时父菜单id SELECT @TMP_PARENT_ID:=LAST_INSERT_ID(); --- 父菜单 -INSERT INTO system_menu (parent_id, name, type, sort, visible, status, cache) -VALUES (0, '${vue.comment}管理', 1, 10, 1, 1, 1); - -- 子菜单 -INSERT INTO system_menu (parent_id, name, type, sort, visible, status, cache, component) -VALUES (@TMP_PARENT_ID, '$vue.comment', 2, 10, 1, 1, 1, '$vue.module$vue.featureFirstUpper'); +INSERT INTO system_menu + (parent_id, name, type, sort, visible, status, cache, component) +VALUES + (@TMP_PARENT_ID, '$vue.comment', 2, 10, 1, 1, 1, '$vue.module$vue.featureFirstUpper'); -- 设置临时子菜单id SELECT @TMP_SUB_ID:=LAST_INSERT_ID(); -- 功能 -INSERT INTO system_menu (parent_id, name, permission, type, sort) -VALUES (@TMP_SUB_ID, '创建$vue.comment', '${package.ModuleName}:${typeHyphen}:create', 3, 10); -INSERT INTO system_menu (parent_id, name, permission, type, sort) -VALUES (@TMP_SUB_ID, '修改$vue.comment', '${package.ModuleName}:${typeHyphen}:update', 3, 20); -INSERT INTO system_menu (parent_id, name, permission, type, sort) -VALUES (@TMP_SUB_ID, '查询$vue.comment', '${package.ModuleName}:${typeHyphen}:query', 3, 30); -INSERT INTO system_menu (parent_id, name, permission, type, sort) -VALUES (@TMP_SUB_ID, '删除$vue.comment', '${package.ModuleName}:${typeHyphen}:delete', 3, 40); +INSERT INTO system_menu + (parent_id, name, permission, type, sort) +VALUES + (@TMP_SUB_ID, '查询$vue.comment', '${package.ModuleName}:${typeHyphen}:query', 3, 10), + (@TMP_SUB_ID, '创建$vue.comment', '${package.ModuleName}:${typeHyphen}:create', 3, 20), + (@TMP_SUB_ID, '修改$vue.comment', '${package.ModuleName}:${typeHyphen}:update', 3, 30), + (@TMP_SUB_ID, '删除$vue.comment', '${package.ModuleName}:${typeHyphen}:delete', 3, 40); diff --git a/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-form-modal.vue.vm b/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-form-modal.vue.vm index 02191073..2ad94419 100644 --- a/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-form-modal.vue.vm +++ b/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-form-modal.vue.vm @@ -3,7 +3,7 @@ body-class="modal-form" title-align="start" :title="title" - :top="120" + :top="80" :align-center="false" :draggable="true" :mask-closable="false" @@ -55,6 +55,8 @@ import formRules from '../types/form.rules'; import { create${vue.featureFirstUpper}, update${vue.featureFirstUpper} } from '@/api/${vue.module}/${vue.feature}'; import { Message } from '@arco-design/web-vue'; + import { } from '../types/enum.types'; + import { toOptions } from '@/utils/enum'; const { visible, setVisible } = useVisible(); const { loading, setLoading } = useLoading(); diff --git a/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-table.vue.vm b/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-table.vue.vm index a2a087cf..87ba0e45 100644 --- a/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-table.vue.vm +++ b/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-table.vue.vm @@ -115,6 +115,8 @@ import useLoading from '@/hooks/loading'; import columns from '../types/table.columns'; import { defaultPagination, defaultRowSelection } from '@/types/table'; + import { } from '../types/enum.types'; + import { toOptions } from '@/utils/enum'; const tableRenderData = ref<${vue.featureFirstUpper}QueryResponse[]>(); const { loading, setLoading } = useLoading(); diff --git a/orion-ops-launch/src/main/resources/templates/orion-vue-views-types-table.columns.ts.vm b/orion-ops-launch/src/main/resources/templates/orion-vue-views-types-table.columns.ts.vm index abb98c1e..36997d3d 100644 --- a/orion-ops-launch/src/main/resources/templates/orion-vue-views-types-table.columns.ts.vm +++ b/orion-ops-launch/src/main/resources/templates/orion-vue-views-types-table.columns.ts.vm @@ -18,6 +18,7 @@ const columns = [ ellipsis: true, tooltip: true, #elseif(${field.propertyType} == 'Date') + width: 180, render: ({ record }) => { return record.${field.propertyName} && dateFormat(new Date(record.${field.propertyName})); }, @@ -27,6 +28,7 @@ const columns = [ dataIndex: 'createTime', slotName: 'createTime', align: 'center', + width: 180, render: ({ record }) => { return dateFormat(new Date(record.createTime)); }, @@ -35,6 +37,7 @@ const columns = [ dataIndex: 'updateTime', slotName: 'updateTime', align: 'center', + width: 180, render: ({ record }) => { return dateFormat(new Date(record.updateTime)); },