zky_mandate/internal/app/businesses/dao/internal/domestiDistribuion.go

112 lines
3.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// ==========================================================================
// GFast自动生成dao internal操作代码。
// 生成日期2025-08-08 15:02:58
// 生成路径: internal/app/businesses/dao/internal/domesti_distribuion.go
// 生成人gfast
// desc:国内分布
// company:云南奇讯科技有限公司
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// DomestiDistribuionDao is the manager for logic model data accessing and custom defined data operations functions management.
type DomestiDistribuionDao 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 DomestiDistribuionColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
}
// DomestiDistribuionColumns defines and stores column names for table domesti_distribuion.
type DomestiDistribuionColumns struct {
Id string //
SpeciesCode string // 物种编码
Province string // 所属省区
City string // 所属地级州市
County string // 所属区县
Year 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 domestiDistribuionColumns = DomestiDistribuionColumns{
Id: "id",
SpeciesCode: "species_code",
Province: "province",
City: "city",
County: "county",
Year: "year",
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",
}
// NewDomestiDistribuionDao creates and returns a new DAO object for table data access.
func NewDomestiDistribuionDao() *DomestiDistribuionDao {
return &DomestiDistribuionDao{
group: "default",
table: "domesti_distribuion",
columns: domestiDistribuionColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *DomestiDistribuionDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *DomestiDistribuionDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *DomestiDistribuionDao) Columns() DomestiDistribuionColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *DomestiDistribuionDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *DomestiDistribuionDao) 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 *DomestiDistribuionDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}