diff --git a/orion-ops-launch/src/main/java/com/orion/ops/launch/generator/CodeGenerator.java b/orion-ops-launch/src/main/java/com/orion/ops/launch/generator/CodeGenerator.java index 3f692aaf..43d22da4 100644 --- a/orion-ops-launch/src/main/java/com/orion/ops/launch/generator/CodeGenerator.java +++ b/orion-ops-launch/src/main/java/com/orion/ops/launch/generator/CodeGenerator.java @@ -13,6 +13,7 @@ import com.orion.lang.utils.ext.yml.YmlExt; import com.orion.ops.framework.mybatis.core.domain.BaseDO; import com.orion.ops.framework.mybatis.core.mapper.IMapper; import com.orion.ops.module.infra.enums.RoleStatusEnum; +import com.orion.ops.module.infra.enums.TestTableStatusEnum; import com.orion.ops.module.infra.enums.UserStatusEnum; import org.apache.ibatis.annotations.Mapper; @@ -40,13 +41,16 @@ public class CodeGenerator { String module = "infra"; // 生成的表 GenTable[] tables = { - new GenTable("system_user", "用户", "user") - .vue("user", "user") - .enums(UserStatusEnum.class), - new GenTable("system_role", "角色", "role") - .vue("user", "role") - .enums(RoleStatusEnum.class), - new GenTable("system_menu", "菜单", "menu"), + new GenTable("test_table", "表", "test") + .vue("test", "table") + .enums(TestTableStatusEnum.class), + // new GenTable("system_user", "用户", "user") + // .vue("user", "user") + // .enums(UserStatusEnum.class), + // new GenTable("system_role", "角色", "role") + // .vue("user", "role") + // .enums(RoleStatusEnum.class), + // new GenTable("system_menu", "菜单", "menu"), }; // jdbc 配置 - 使用配置文件 File yamlFile = new File("orion-ops-launch/src/main/resources/application-dev.yaml"); @@ -129,7 +133,6 @@ public class CodeGenerator { private static GlobalConfig getGlobalConfig(String outputDir, String author) { // 全局配置 GlobalConfig gbConfig = new GlobalConfig.Builder() - .disableOpenDir() // 设置作者 .author(author) // 生成路径 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 2afd5b69..0d6c6820 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 @@ -256,6 +256,8 @@ public class VelocityTemplateEngine extends AbstractTemplateEngine { 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())); // 功能名称全大写 diff --git a/orion-ops-launch/src/main/resources/templates/orion-vue-router.ts.vm b/orion-ops-launch/src/main/resources/templates/orion-vue-router.ts.vm index bb18691b..24ecd000 100644 --- a/orion-ops-launch/src/main/resources/templates/orion-vue-router.ts.vm +++ b/orion-ops-launch/src/main/resources/templates/orion-vue-router.ts.vm @@ -8,7 +8,7 @@ const $vue.featureAllUpper: AppRouteRecordRaw = { children: [ { name: '$vue.module$vue.featureFirstUpper', - path: '/$vue.module/$vue.featureFirstUpper', + path: '/$vue.module/$vue.feature', component: () => import('@/views/$vue.module/$vue.feature/index.vue'), }, ], 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 cc285770..43a34286 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 @@ -1 +1,141 @@ -form \ No newline at end of file + + + + + + + diff --git a/orion-ops-launch/src/main/resources/templates/orion-vue-views-index.vue.vm b/orion-ops-launch/src/main/resources/templates/orion-vue-views-index.vue.vm index b2d525b2..eff5c8aa 100644 --- a/orion-ops-launch/src/main/resources/templates/orion-vue-views-index.vue.vm +++ b/orion-ops-launch/src/main/resources/templates/orion-vue-views-index.vue.vm @@ -1 +1,32 @@ -index \ No newline at end of file + + + + + + + diff --git a/orion-ops-launch/src/main/resources/templates/orion-vue-views-types-enum.types.ts.vm b/orion-ops-launch/src/main/resources/templates/orion-vue-views-types-enum.types.ts.vm index 63c6a1d7..ec68b4b1 100644 --- a/orion-ops-launch/src/main/resources/templates/orion-vue-views-types-enum.types.ts.vm +++ b/orion-ops-launch/src/main/resources/templates/orion-vue-views-types-enum.types.ts.vm @@ -11,7 +11,7 @@ export const $enumEntity.key = { #foreach($enumEntityItemFields in $enumEntityItem.value.entrySet()) $enumEntityItemFields.key: '$enumEntityItemFields.value', #end - } + }, #end } diff --git a/orion-ops-launch/src/main/resources/templates/orion-vue-views-types-form.rules.ts.vm b/orion-ops-launch/src/main/resources/templates/orion-vue-views-types-form.rules.ts.vm index 38ecafb8..2e163a8c 100644 --- a/orion-ops-launch/src/main/resources/templates/orion-vue-views-types-form.rules.ts.vm +++ b/orion-ops-launch/src/main/resources/templates/orion-vue-views-types-form.rules.ts.vm @@ -1,6 +1,6 @@ import { FieldRule } from '@arco-design/web-vue'; - #foreach($field in ${table.fields}) +#if("$!field.propertyName" != "id") #if(${field.propertyType} == 'String') export const ${field.propertyName} = [{ required: true, @@ -15,10 +15,13 @@ export const ${field.propertyName} = [{ message: '请输入${field.comment}' }] as FieldRule[]; #end +#end #end export default { #foreach($field in ${table.fields}) +#if("$!field.propertyName" != "id") ${field.propertyName}, #end +#end } as Record; 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 3452ad48..1a3e7e40 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 @@ -1,4 +1,5 @@ import { TableColumnData } from '@arco-design/web-vue/es/table/interface'; +import { formatMilliSecond, YMD_HMS } from '@/utils'; const columns = [ { @@ -6,8 +7,9 @@ const columns = [ dataIndex: 'id', slotName: 'id', width: 70, + align: 'left', fixed: 'left', - }, #foreach($field in ${table.fields}){ + }, #foreach($field in ${table.fields})#if("$!field.propertyName" != "id"){ title: '${field.comment}', dataIndex: '${field.propertyName}', slotName: '${field.propertyName}', @@ -17,14 +19,20 @@ const columns = [ ellipsis: true, tooltip: true, #end - }, #end{ + }, #end#end{ title: '创建时间', dataIndex: 'createTime', slotName: 'createTime', + render: ({ record }) => { + return formatMilliSecond(record.createTime, YMD_HMS); + }, }, { title: '修改时间', dataIndex: 'updateTime', slotName: 'updateTime', + render: ({ record }) => { + return formatMilliSecond(record.createTime, YMD_HMS); + }, }, { title: '创建人', dataIndex: 'creator', @@ -35,10 +43,11 @@ const columns = [ slotName: 'updater', }, { title: '操作', - slotName: 'option', - width: 158, + slotName: 'handle', + width: 130, + align: 'center', fixed: 'right', - } + }, ] as TableColumnData[]; export default columns;