diff --git a/server/resource/generate/default/curd/api.go.template b/server/resource/generate/default/curd/api.go.template index d6658e5..e92c8ff 100644 --- a/server/resource/generate/default/curd/api.go.template +++ b/server/resource/generate/default/curd/api.go.template @@ -33,7 +33,7 @@ type ExportReq struct { type ExportRes struct{} @{end} -@{ if eq .options.Step.HasView true } +@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } // ViewReq 获取@{.tableComment}指定信息 type ViewReq struct { g.Meta `path:"/@{.varName | LcFirst}/view" method:"get" tags:"@{.tableComment}" summary:"获取@{.tableComment}指定信息"` diff --git a/server/resource/generate/default/curd/controller.go.template b/server/resource/generate/default/curd/controller.go.template index 5d02213..37c8746 100644 --- a/server/resource/generate/default/curd/controller.go.template +++ b/server/resource/generate/default/curd/controller.go.template @@ -92,7 +92,7 @@ func (c *c@{.varName}) MaxSort(ctx context.Context, req *@{.varName | ToLower}.M return } @{end} -@{ if eq .options.Step.HasView true } +@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } // View 获取指定@{.tableComment}信息 func (c *c@{.varName}) View(ctx context.Context, req *@{.varName | ToLower}.ViewReq) (res *@{.varName | ToLower}.ViewRes, err error) { var in @{.templateGroup}in.@{.varName}ViewInp diff --git a/server/resource/generate/default/curd/input.go.template b/server/resource/generate/default/curd/input.go.template index b07f12e..7085715 100644 --- a/server/resource/generate/default/curd/input.go.template +++ b/server/resource/generate/default/curd/input.go.template @@ -44,7 +44,7 @@ func (in *@{.varName}DeleteInp) Filter(ctx context.Context) (err error) { type @{.varName}DeleteModel struct{} @{end} -@{ if eq .options.Step.HasView true } +@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } // @{.varName}ViewInp 获取指定@{.tableComment}信息 type @{.varName}ViewInp struct { @{.pk.GoName} @{.pk.GoType} `json:"@{.pk.TsName}" v:"required#@{.pk.Dc}不能为空" dc:"@{.pk.Dc}"` diff --git a/server/resource/generate/default/curd/logic.go.template b/server/resource/generate/default/curd/logic.go.template index 0af14ca..b0ad1f2 100644 --- a/server/resource/generate/default/curd/logic.go.template +++ b/server/resource/generate/default/curd/logic.go.template @@ -125,7 +125,7 @@ func (s *s@{.servFunName}) MaxSort(ctx context.Context, in @{.templateGroup}in.@ return } @{end} -@{ if eq .options.Step.HasView true } +@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } // View 获取@{.tableComment}指定信息 func (s *s@{.servFunName}) View(ctx context.Context, in @{.templateGroup}in.@{.varName}ViewInp) (res *@{.templateGroup}in.@{.varName}ViewModel, err error) { err = s.Model(ctx).Where(dao.@{.daoName}.Columns().@{.pk.GoName}, in.@{.pk.GoName}).Scan(&res) diff --git a/server/resource/generate/default/curd/source.sql.template b/server/resource/generate/default/curd/source.sql.template index 55e4265..c94b001 100644 --- a/server/resource/generate/default/curd/source.sql.template +++ b/server/resource/generate/default/curd/source.sql.template @@ -35,7 +35,7 @@ INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type SET @listId = LAST_INSERT_ID(); -@{ if eq .options.Step.HasView true } +@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } -- 详情 INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @dirId, '@{.tableComment}详情', '@{.varName | LcFirst}View', 'view/:id?', '', '2', '', '/@{.apiPrefix}/view', '', '/@{.componentPrefix}/view', '0', '@{.varName | LcFirst}Index', '0', '0', '', '0', '1', '0', '2', '', '20', '', '1', @now, @now); @{end} diff --git a/server/resource/generate/default/curd/web.api.ts.template b/server/resource/generate/default/curd/web.api.ts.template index 280a90d..b71cf7c 100644 --- a/server/resource/generate/default/curd/web.api.ts.template +++ b/server/resource/generate/default/curd/web.api.ts.template @@ -48,7 +48,7 @@ export function Switch(params) { }); } @{end} -@{ if eq .options.Step.HasView true } +@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } // 获取@{.tableComment}指定详情 export function View(params) { return http.request({ diff --git a/server/resource/generate/default/curd/web.index.vue.template b/server/resource/generate/default/curd/web.index.vue.template index e8782a1..3ad610c 100644 --- a/server/resource/generate/default/curd/web.index.vue.template +++ b/server/resource/generate/default/curd/web.index.vue.template @@ -92,11 +92,11 @@ @{.apiImport} import { State, columns, schemas, options, newState } from './model'; @{.iconsImport} -@{ if eq .options.Step.HasView true } import { useRouter } from 'vue-router';@{end} +@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } import { useRouter } from 'vue-router';@{end} import { getOptionLabel } from '@/utils/hotgo'; @{ if eq .options.Step.HasEdit true } import Edit from './edit.vue';@{end} const { hasPermission } = usePermission(); -@{ if eq .options.Step.HasView true } const router = useRouter();@{end} +@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } const router = useRouter();@{end} const actionRef = ref(); const dialog = useDialog(); const message = useMessage();