fix generate HasView

This commit is contained in:
maxbad
2023-05-07 22:57:34 +08:00
parent 67a0a38fd4
commit 788a9d4d2d
7 changed files with 8 additions and 8 deletions

View File

@@ -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}指定信息"`

View File

@@ -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

View File

@@ -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}"`

View File

@@ -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)

View File

@@ -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}

View File

@@ -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({

View File

@@ -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();