108 lines
3.5 KiB
Go
108 lines
3.5 KiB
Go
// ==========================================================================
|
||
// GFast自动生成dao internal操作代码。
|
||
// 生成日期:2025-08-07 10:19:19
|
||
// 生成路径: internal/app/businesses/dao/internal/species_name.go
|
||
// 生成人:gfast
|
||
// desc:
|
||
// company:云南奇讯科技有限公司
|
||
// ==========================================================================
|
||
|
||
package internal
|
||
|
||
import (
|
||
"context"
|
||
|
||
"github.com/gogf/gf/v2/database/gdb"
|
||
"github.com/gogf/gf/v2/frame/g"
|
||
)
|
||
|
||
// SpeciesNameDao is the manager for logic model data accessing and custom defined data operations functions management.
|
||
type SpeciesNameDao 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 SpeciesNameColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
|
||
}
|
||
|
||
// SpeciesNameColumns defines and stores column names for table species_name.
|
||
type SpeciesNameColumns struct {
|
||
Id string // 主键
|
||
SpeciesCode string // 物种编号
|
||
Name string // 物种名称
|
||
Content string // 物种名称内容
|
||
SourcesData string // 数据来源
|
||
CreateUser string // 数据采集人
|
||
CreateDate string // 数据采集信息
|
||
AuditUser string // 数据核查人
|
||
AuditDate string // 数据核查日期
|
||
Remark string // 备注
|
||
AuditStatus string //
|
||
AuditView string //
|
||
Version string //
|
||
CreatedAt string //
|
||
UpdatedAt string //
|
||
DeletedAt string //
|
||
}
|
||
|
||
var speciesNameColumns = SpeciesNameColumns{
|
||
Id: "id",
|
||
SpeciesCode: "species_code",
|
||
Name: "name",
|
||
Content: "content",
|
||
SourcesData: "sources_data",
|
||
CreateUser: "create_user",
|
||
CreateDate: "create_date",
|
||
AuditUser: "audit_user",
|
||
AuditDate: "audit_date",
|
||
Remark: "remark",
|
||
AuditStatus: "audit_status",
|
||
AuditView: "audit_view",
|
||
Version: "version",
|
||
CreatedAt: "created_at",
|
||
UpdatedAt: "updated_at",
|
||
DeletedAt: "deleted_at",
|
||
}
|
||
|
||
// NewSpeciesNameDao creates and returns a new DAO object for table data access.
|
||
func NewSpeciesNameDao() *SpeciesNameDao {
|
||
return &SpeciesNameDao{
|
||
group: "default",
|
||
table: "species_name",
|
||
columns: speciesNameColumns,
|
||
}
|
||
}
|
||
|
||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||
func (dao *SpeciesNameDao) DB() gdb.DB {
|
||
return g.DB(dao.group)
|
||
}
|
||
|
||
// Table returns the table name of current dao.
|
||
func (dao *SpeciesNameDao) Table() string {
|
||
return dao.table
|
||
}
|
||
|
||
// Columns returns all column names of current dao.
|
||
func (dao *SpeciesNameDao) Columns() SpeciesNameColumns {
|
||
return dao.columns
|
||
}
|
||
|
||
// Group returns the configuration group name of database of current dao.
|
||
func (dao *SpeciesNameDao) Group() string {
|
||
return dao.group
|
||
}
|
||
|
||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||
func (dao *SpeciesNameDao) 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 *SpeciesNameDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||
}
|