132 lines
4.2 KiB
Go
132 lines
4.2 KiB
Go
// ==========================================================================
|
||
// GFast自动生成dao internal操作代码。
|
||
// 生成日期:2025-08-11 09:34:44
|
||
// 生成路径: internal/app/businesses/dao/internal/host_botany.go
|
||
// 生成人:gfast
|
||
// desc:寄主生物
|
||
// company:云南奇讯科技有限公司
|
||
// ==========================================================================
|
||
|
||
package internal
|
||
|
||
import (
|
||
"context"
|
||
|
||
"github.com/gogf/gf/v2/database/gdb"
|
||
"github.com/gogf/gf/v2/frame/g"
|
||
)
|
||
|
||
// HostBotanyDao is the manager for logic model data accessing and custom defined data operations functions management.
|
||
type HostBotanyDao struct {
|
||
table string // Table is the underlying table name of the DAO.
|
||
group string // Group is the database configuration group name of current DAO.
|
||
columns HostBotanyColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
|
||
}
|
||
|
||
// HostBotanyColumns defines and stores column names for table host_botany.
|
||
type HostBotanyColumns struct {
|
||
Id string //
|
||
SpeciesCode string // 物种编码
|
||
ZhName string // 中文学名
|
||
ZhSynonym string // 中文异名
|
||
EnName string // 英文学名
|
||
LatinName string // 拉丁学名
|
||
LatinSynonym string // 拉丁异名
|
||
Mu string // 目
|
||
OrderTitle string // Order
|
||
Ke string // 科
|
||
Family string // Family
|
||
Shu string // 属
|
||
Genus string // Genus
|
||
Zhong string // 种
|
||
Species string // Species
|
||
HostType string // 寄主类型
|
||
SourcesData string // 数据来源
|
||
CreateUser string // 数据采集人
|
||
CreateDate string // 数据采集日期
|
||
AuditUser string // 数据核查人
|
||
AuditDate string // 数据核查日期
|
||
AuditStatus string // 核查
|
||
AuditView string // 核查意见
|
||
Remark string // 备注
|
||
Version string // 版本
|
||
CreatedAt string //
|
||
UpdatedAt string //
|
||
DeletedAt string //
|
||
}
|
||
|
||
var hostBotanyColumns = HostBotanyColumns{
|
||
Id: "id",
|
||
SpeciesCode: "species_code",
|
||
ZhName: "zh_name",
|
||
ZhSynonym: "zh_synonym",
|
||
EnName: "en_name",
|
||
LatinName: "latin_name",
|
||
LatinSynonym: "latin_synonym",
|
||
Mu: "mu",
|
||
OrderTitle: "order_title",
|
||
Ke: "ke",
|
||
Family: "family",
|
||
Shu: "shu",
|
||
Genus: "genus",
|
||
Zhong: "zhong",
|
||
Species: "species",
|
||
HostType: "host_type",
|
||
SourcesData: "sources_data",
|
||
CreateUser: "create_user",
|
||
CreateDate: "create_date",
|
||
AuditUser: "audit_user",
|
||
AuditDate: "audit_date",
|
||
AuditStatus: "audit_status",
|
||
AuditView: "audit_view",
|
||
Remark: "remark",
|
||
Version: "version",
|
||
CreatedAt: "created_at",
|
||
UpdatedAt: "updated_at",
|
||
DeletedAt: "deleted_at",
|
||
}
|
||
|
||
// NewHostBotanyDao creates and returns a new DAO object for table data access.
|
||
func NewHostBotanyDao() *HostBotanyDao {
|
||
return &HostBotanyDao{
|
||
group: "default",
|
||
table: "host_botany",
|
||
columns: hostBotanyColumns,
|
||
}
|
||
}
|
||
|
||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||
func (dao *HostBotanyDao) DB() gdb.DB {
|
||
return g.DB(dao.group)
|
||
}
|
||
|
||
// Table returns the table name of current dao.
|
||
func (dao *HostBotanyDao) Table() string {
|
||
return dao.table
|
||
}
|
||
|
||
// Columns returns all column names of current dao.
|
||
func (dao *HostBotanyDao) Columns() HostBotanyColumns {
|
||
return dao.columns
|
||
}
|
||
|
||
// Group returns the configuration group name of database of current dao.
|
||
func (dao *HostBotanyDao) Group() string {
|
||
return dao.group
|
||
}
|
||
|
||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||
func (dao *HostBotanyDao) Ctx(ctx context.Context) *gdb.Model {
|
||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||
}
|
||
|
||
// Transaction wraps the transaction logic using function f.
|
||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||
// It commits the transaction and returns nil if function f returns nil.
|
||
//
|
||
// Note that, you should not Commit or Rollback the transaction in function f
|
||
// as it is automatically handled by this function.
|
||
func (dao *HostBotanyDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||
}
|