api 模板的修改

This commit is contained in:
eson
2023-06-05 17:56:55 +08:00
parent 6c717ce30e
commit ef46164dc3
86 changed files with 1329 additions and 108 deletions

View File

@@ -1,5 +1,3 @@
// Code generated by goctl. DO NOT EDIT.
package model
import (
@@ -15,8 +13,8 @@ import (
)
var (
fsCanteenTypeFieldNames = builder.RawFieldNames(&FsCanteenType{})
fsCanteenTypeRows = strings.Join(fsCanteenTypeFieldNames, ",")
fsCanteenTypeFieldNames = builder.RawFieldNames(&FsCanteenType{})
fsCanteenTypeRows = strings.Join(fsCanteenTypeFieldNames, ",")
// fsCanteenTypeGetTypeRows = strings.Join(stringx.Remove(fsCanteenTypeFieldNames, "`id`", "`name`", "`sort`", "`created_at`", "`status`"), ",")
// fsCanteenTypeGetTypeRows = builder.RawFieldNames(&FsGetTypeCanteenType{})
fsCanteenTypeRowsExpectAutoSet = strings.Join(stringx.Remove(fsCanteenTypeFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
@@ -29,7 +27,7 @@ type (
FindOne(ctx context.Context, id int64) (*FsCanteenType, error)
Update(ctx context.Context, data *FsCanteenType) error
Delete(ctx context.Context, id int64) error
FindGetType(ctx context.Context) ([]*FsGetTypeCanteenType, error)
}
@@ -47,8 +45,8 @@ type (
}
FsGetTypeCanteenType struct {
Id int64 `db:"id" json:"key"` // ID
Name string `db:"name" json:"name"` // 餐厅名字
Id int64 `db:"id" json:"key"` // ID
Name string `db:"name" json:"name"` // 餐厅名字
}
)
@@ -80,7 +78,7 @@ func (m *defaultFsCanteenTypeModel) FindOne(ctx context.Context, id int64) (*FsC
}
func (m *defaultFsCanteenTypeModel) FindGetType(ctx context.Context) ([]*FsGetTypeCanteenType, error) {
query := fmt.Sprintf("select X.id,X.name from (select %s from %s where status = 1 order by sort desc) X", fsCanteenTypeRows, m.table)
var resp []*FsGetTypeCanteenType
err := m.conn.QueryRows(&resp, query)

View File

@@ -72,6 +72,7 @@ func (m *defaultFsFontModel) FindOne(ctx context.Context, id int64) (*FsFont, er
}
func (m *defaultFsFontModel) FindAllOrderSortByDesc(ctx context.Context) ([]*FsFont, error) {
query := fmt.Sprintf("select %s from %s order by sort desc", fsFontRows, m.table)
var resp []*FsFont
err := m.conn.QueryRows(&resp, query)