mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-08-27 16:24:20 +08:00
fix generate HasView
This commit is contained in:
@@ -33,7 +33,7 @@ type ExportReq struct {
|
|||||||
|
|
||||||
type ExportRes struct{}
|
type ExportRes struct{}
|
||||||
@{end}
|
@{end}
|
||||||
@{ if eq .options.Step.HasView true }
|
@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) }
|
||||||
// ViewReq 获取@{.tableComment}指定信息
|
// ViewReq 获取@{.tableComment}指定信息
|
||||||
type ViewReq struct {
|
type ViewReq struct {
|
||||||
g.Meta `path:"/@{.varName | LcFirst}/view" method:"get" tags:"@{.tableComment}" summary:"获取@{.tableComment}指定信息"`
|
g.Meta `path:"/@{.varName | LcFirst}/view" method:"get" tags:"@{.tableComment}" summary:"获取@{.tableComment}指定信息"`
|
||||||
|
@@ -92,7 +92,7 @@ func (c *c@{.varName}) MaxSort(ctx context.Context, req *@{.varName | ToLower}.M
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
@{end}
|
@{end}
|
||||||
@{ if eq .options.Step.HasView true }
|
@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) }
|
||||||
// View 获取指定@{.tableComment}信息
|
// View 获取指定@{.tableComment}信息
|
||||||
func (c *c@{.varName}) View(ctx context.Context, req *@{.varName | ToLower}.ViewReq) (res *@{.varName | ToLower}.ViewRes, err error) {
|
func (c *c@{.varName}) View(ctx context.Context, req *@{.varName | ToLower}.ViewReq) (res *@{.varName | ToLower}.ViewRes, err error) {
|
||||||
var in @{.templateGroup}in.@{.varName}ViewInp
|
var in @{.templateGroup}in.@{.varName}ViewInp
|
||||||
|
@@ -44,7 +44,7 @@ func (in *@{.varName}DeleteInp) Filter(ctx context.Context) (err error) {
|
|||||||
|
|
||||||
type @{.varName}DeleteModel struct{}
|
type @{.varName}DeleteModel struct{}
|
||||||
@{end}
|
@{end}
|
||||||
@{ if eq .options.Step.HasView true }
|
@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) }
|
||||||
// @{.varName}ViewInp 获取指定@{.tableComment}信息
|
// @{.varName}ViewInp 获取指定@{.tableComment}信息
|
||||||
type @{.varName}ViewInp struct {
|
type @{.varName}ViewInp struct {
|
||||||
@{.pk.GoName} @{.pk.GoType} `json:"@{.pk.TsName}" v:"required#@{.pk.Dc}不能为空" dc:"@{.pk.Dc}"`
|
@{.pk.GoName} @{.pk.GoType} `json:"@{.pk.TsName}" v:"required#@{.pk.Dc}不能为空" dc:"@{.pk.Dc}"`
|
||||||
|
@@ -125,7 +125,7 @@ func (s *s@{.servFunName}) MaxSort(ctx context.Context, in @{.templateGroup}in.@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
@{end}
|
@{end}
|
||||||
@{ if eq .options.Step.HasView true }
|
@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) }
|
||||||
// View 获取@{.tableComment}指定信息
|
// View 获取@{.tableComment}指定信息
|
||||||
func (s *s@{.servFunName}) View(ctx context.Context, in @{.templateGroup}in.@{.varName}ViewInp) (res *@{.templateGroup}in.@{.varName}ViewModel, err error) {
|
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)
|
err = s.Model(ctx).Where(dao.@{.daoName}.Columns().@{.pk.GoName}, in.@{.pk.GoName}).Scan(&res)
|
||||||
|
@@ -35,7 +35,7 @@ INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type
|
|||||||
|
|
||||||
|
|
||||||
SET @listId = LAST_INSERT_ID();
|
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);
|
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}
|
@{end}
|
||||||
|
@@ -48,7 +48,7 @@ export function Switch(params) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
@{end}
|
@{end}
|
||||||
@{ if eq .options.Step.HasView true }
|
@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) }
|
||||||
// 获取@{.tableComment}指定详情
|
// 获取@{.tableComment}指定详情
|
||||||
export function View(params) {
|
export function View(params) {
|
||||||
return http.request({
|
return http.request({
|
||||||
|
@@ -92,11 +92,11 @@
|
|||||||
@{.apiImport}
|
@{.apiImport}
|
||||||
import { State, columns, schemas, options, newState } from './model';
|
import { State, columns, schemas, options, newState } from './model';
|
||||||
@{.iconsImport}
|
@{.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';
|
import { getOptionLabel } from '@/utils/hotgo';
|
||||||
@{ if eq .options.Step.HasEdit true } import Edit from './edit.vue';@{end}
|
@{ if eq .options.Step.HasEdit true } import Edit from './edit.vue';@{end}
|
||||||
const { hasPermission } = usePermission();
|
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 actionRef = ref();
|
||||||
const dialog = useDialog();
|
const dialog = useDialog();
|
||||||
const message = useMessage();
|
const message = useMessage();
|
||||||
|
Reference in New Issue
Block a user