提交 6fa2587b authored 作者: 赵雪如's avatar 赵雪如

demo

上级 cafe64b8
package api
import (
"github.com/gogf/gf/net/ghttp"
)
var Hello = helloApi{}
type helloApi struct {}
// Index is a demonstration route handler for output "Hello World!".
func (*helloApi) Index(r *ghttp.Request) {
r.Response.Writeln("Hello World!")
}
// ============================================================================
// This is auto-generated by gf cli tool only once. Fill this file as you wish.
// ============================================================================
package dao
import (
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/shopapi/dao/internal"
)
// freightDao is the manager for logic model data accessing
// and custom defined data operations functions management. You can define
// methods on it to extend its functionality as you wish.
type freightDao struct {
internal.FreightDao
}
var (
// Freight is globally public accessible object for table wn_freight operations.
Freight = freightDao{
internal.Freight,
}
)
// Fill with you ideas below.
\ No newline at end of file
// ==========================================================================
// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
// ==========================================================================
package internal
import (
"context"
"database/sql"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/frame/gmvc"
"time"
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/shopapi/model"
)
// FreightDao is the manager for logic model data accessing
// and custom defined data operations functions management.
type FreightDao struct {
gmvc.M
DB gdb.DB
Table string
Columns freightColumns
}
// FreightColumns defines and stores column names for table wn_freight.
type freightColumns struct {
Id string //
SellerId string //
Name string // 模板名称
Sort string //
IsDefault string // 是否是默认模板
ChargeType string // 1 按重量 2 按个数
Dispatching string // 配送规则
Disdispatching string // 不配送区域
Publish string //
Created string //
Modified string //
}
var (
// Freight is globally public accessible object for table wn_freight operations.
Freight = FreightDao{
M: g.DB("default").Model("wn_freight").Safe(),
DB: g.DB("default"),
Table: "wn_freight",
Columns: freightColumns{
Id: "id",
SellerId: "seller_id",
Name: "name",
Sort: "sort",
IsDefault: "is_default",
ChargeType: "charge_type",
Dispatching: "dispatching",
Disdispatching: "disdispatching",
Publish: "publish",
Created: "created",
Modified: "modified",
},
}
)
// Ctx is a chaining function, which creates and returns a new DB that is a shallow copy
// of current DB object and with given context in it.
// Note that this returned DB object can be used only once, so do not assign it to
// a global or package variable for long using.
func (d *FreightDao) Ctx(ctx context.Context) *FreightDao {
return &FreightDao{M: d.M.Ctx(ctx)}
}
// As sets an alias name for current table.
func (d *FreightDao) As(as string) *FreightDao {
return &FreightDao{M: d.M.As(as)}
}
// TX sets the transaction for current operation.
func (d *FreightDao) TX(tx *gdb.TX) *FreightDao {
return &FreightDao{M: d.M.TX(tx)}
}
// Master marks the following operation on master node.
func (d *FreightDao) Master() *FreightDao {
return &FreightDao{M: d.M.Master()}
}
// Slave marks the following operation on slave node.
// Note that it makes sense only if there's any slave node configured.
func (d *FreightDao) Slave() *FreightDao {
return &FreightDao{M: d.M.Slave()}
}
// Args sets custom arguments for model operation.
func (d *FreightDao) Args(args ...interface{}) *FreightDao {
return &FreightDao{M: d.M.Args(args...)}
}
// LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
// The parameter <table> can be joined table and its joined condition,
// and also with its alias name, like:
// Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
// Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
func (d *FreightDao) LeftJoin(table ...string) *FreightDao {
return &FreightDao{M: d.M.LeftJoin(table...)}
}
// RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
// The parameter <table> can be joined table and its joined condition,
// and also with its alias name, like:
// Table("user").RightJoin("user_detail", "user_detail.uid=user.uid")
// Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
func (d *FreightDao) RightJoin(table ...string) *FreightDao {
return &FreightDao{M: d.M.RightJoin(table...)}
}
// InnerJoin does "INNER JOIN ... ON ..." statement on the model.
// The parameter <table> can be joined table and its joined condition,
// and also with its alias name, like:
// Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
// Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
func (d *FreightDao) InnerJoin(table ...string) *FreightDao {
return &FreightDao{M: d.M.InnerJoin(table...)}
}
// Fields sets the operation fields of the model, multiple fields joined using char ','.
// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
func (d *FreightDao) Fields(fieldNamesOrMapStruct ...interface{}) *FreightDao {
return &FreightDao{M: d.M.Fields(fieldNamesOrMapStruct...)}
}
// FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
func (d *FreightDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *FreightDao {
return &FreightDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)}
}
// Option sets the extra operation option for the model.
func (d *FreightDao) Option(option int) *FreightDao {
return &FreightDao{M: d.M.Option(option)}
}
// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
// the data and where attributes for empty values.
func (d *FreightDao) OmitEmpty() *FreightDao {
return &FreightDao{M: d.M.OmitEmpty()}
}
// Filter marks filtering the fields which does not exist in the fields of the operated table.
func (d *FreightDao) Filter() *FreightDao {
return &FreightDao{M: d.M.Filter()}
}
// Where sets the condition statement for the model. The parameter <where> can be type of
// string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
// multiple conditions will be joined into where statement using "AND".
// Eg:
// Where("uid=10000")
// Where("uid", 10000)
// Where("money>? AND name like ?", 99999, "vip_%")
// Where("uid", 1).Where("name", "john")
// Where("status IN (?)", g.Slice{1,2,3})
// Where("age IN(?,?)", 18, 50)
// Where(User{ Id : 1, UserName : "john"})
func (d *FreightDao) Where(where interface{}, args ...interface{}) *FreightDao {
return &FreightDao{M: d.M.Where(where, args...)}
}
// WherePri does the same logic as M.Where except that if the parameter <where>
// is a single condition like int/string/float/slice, it treats the condition as the primary
// key value. That is, if primary key is "id" and given <where> parameter as "123", the
// WherePri function treats the condition as "id=123", but M.Where treats the condition
// as string "123".
func (d *FreightDao) WherePri(where interface{}, args ...interface{}) *FreightDao {
return &FreightDao{M: d.M.WherePri(where, args...)}
}
// And adds "AND" condition to the where statement.
func (d *FreightDao) And(where interface{}, args ...interface{}) *FreightDao {
return &FreightDao{M: d.M.And(where, args...)}
}
// Or adds "OR" condition to the where statement.
func (d *FreightDao) Or(where interface{}, args ...interface{}) *FreightDao {
return &FreightDao{M: d.M.Or(where, args...)}
}
// Group sets the "GROUP BY" statement for the model.
func (d *FreightDao) Group(groupBy string) *FreightDao {
return &FreightDao{M: d.M.Group(groupBy)}
}
// Order sets the "ORDER BY" statement for the model.
func (d *FreightDao) Order(orderBy ...string) *FreightDao {
return &FreightDao{M: d.M.Order(orderBy...)}
}
// Limit sets the "LIMIT" statement for the model.
// The parameter <limit> can be either one or two number, if passed two number is passed,
// it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
// statement.
func (d *FreightDao) Limit(limit ...int) *FreightDao {
return &FreightDao{M: d.M.Limit(limit...)}
}
// Offset sets the "OFFSET" statement for the model.
// It only makes sense for some databases like SQLServer, PostgreSQL, etc.
func (d *FreightDao) Offset(offset int) *FreightDao {
return &FreightDao{M: d.M.Offset(offset)}
}
// Page sets the paging number for the model.
// The parameter <page> is started from 1 for paging.
// Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
func (d *FreightDao) Page(page, limit int) *FreightDao {
return &FreightDao{M: d.M.Page(page, limit)}
}
// Batch sets the batch operation number for the model.
func (d *FreightDao) Batch(batch int) *FreightDao {
return &FreightDao{M: d.M.Batch(batch)}
}
// Cache sets the cache feature for the model. It caches the result of the sql, which means
// if there's another same sql request, it just reads and returns the result from cache, it
// but not committed and executed into the database.
//
// If the parameter <duration> < 0, which means it clear the cache with given <name>.
// If the parameter <duration> = 0, which means it never expires.
// If the parameter <duration> > 0, which means it expires after <duration>.
//
// The optional parameter <name> is used to bind a name to the cache, which means you can later
// control the cache like changing the <duration> or clearing the cache with specified <name>.
//
// Note that, the cache feature is disabled if the model is operating on a transaction.
func (d *FreightDao) Cache(duration time.Duration, name ...string) *FreightDao {
return &FreightDao{M: d.M.Cache(duration, name...)}
}
// Data sets the operation data for the model.
// The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
// Eg:
// Data("uid=10000")
// Data("uid", 10000)
// Data(g.Map{"uid": 10000, "name":"john"})
// Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
func (d *FreightDao) Data(data ...interface{}) *FreightDao {
return &FreightDao{M: d.M.Data(data...)}
}
// All does "SELECT FROM ..." statement for the model.
// It retrieves the records from table and returns the result as []*model.Freight.
// It returns nil if there's no record retrieved with the given conditions from table.
//
// The optional parameter <where> is the same as the parameter of M.Where function,
// see M.Where.
func (d *FreightDao) All(where ...interface{}) ([]*model.Freight, error) {
all, err := d.M.All(where...)
if err != nil {
return nil, err
}
var entities []*model.Freight
if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
return nil, err
}
return entities, nil
}
// One retrieves one record from table and returns the result as *model.Freight.
// It returns nil if there's no record retrieved with the given conditions from table.
//
// The optional parameter <where> is the same as the parameter of M.Where function,
// see M.Where.
func (d *FreightDao) One(where ...interface{}) (*model.Freight, error) {
one, err := d.M.One(where...)
if err != nil {
return nil, err
}
var entity *model.Freight
if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
return nil, err
}
return entity, nil
}
// FindOne retrieves and returns a single Record by M.WherePri and M.One.
// Also see M.WherePri and M.One.
func (d *FreightDao) FindOne(where ...interface{}) (*model.Freight, error) {
one, err := d.M.FindOne(where...)
if err != nil {
return nil, err
}
var entity *model.Freight
if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
return nil, err
}
return entity, nil
}
// FindAll retrieves and returns Result by by M.WherePri and M.All.
// Also see M.WherePri and M.All.
func (d *FreightDao) FindAll(where ...interface{}) ([]*model.Freight, error) {
all, err := d.M.FindAll(where...)
if err != nil {
return nil, err
}
var entities []*model.Freight
if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
return nil, err
}
return entities, nil
}
// Struct retrieves one record from table and converts it into given struct.
// The parameter <pointer> should be type of *struct/**struct. If type **struct is given,
// it can create the struct internally during converting.
//
// The optional parameter <where> is the same as the parameter of Model.Where function,
// see Model.Where.
//
// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
// from table and <pointer> is not nil.
//
// Eg:
// user := new(User)
// err := dao.User.Where("id", 1).Struct(user)
//
// user := (*User)(nil)
// err := dao.User.Where("id", 1).Struct(&user)
func (d *FreightDao) Struct(pointer interface{}, where ...interface{}) error {
return d.M.Struct(pointer, where...)
}
// Structs retrieves records from table and converts them into given struct slice.
// The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct
// slice internally during converting.
//
// The optional parameter <where> is the same as the parameter of Model.Where function,
// see Model.Where.
//
// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
// from table and <pointer> is not empty.
//
// Eg:
// users := ([]User)(nil)
// err := dao.User.Structs(&users)
//
// users := ([]*User)(nil)
// err := dao.User.Structs(&users)
func (d *FreightDao) Structs(pointer interface{}, where ...interface{}) error {
return d.M.Structs(pointer, where...)
}
// Scan automatically calls Struct or Structs function according to the type of parameter <pointer>.
// It calls function Struct if <pointer> is type of *struct/**struct.
// It calls function Structs if <pointer> is type of *[]struct/*[]*struct.
//
// The optional parameter <where> is the same as the parameter of Model.Where function,
// see Model.Where.
//
// Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.
//
// Eg:
// user := new(User)
// err := dao.User.Where("id", 1).Scan(user)
//
// user := (*User)(nil)
// err := dao.User.Where("id", 1).Scan(&user)
//
// users := ([]User)(nil)
// err := dao.User.Scan(&users)
//
// users := ([]*User)(nil)
// err := dao.User.Scan(&users)
func (d *FreightDao) Scan(pointer interface{}, where ...interface{}) error {
return d.M.Scan(pointer, where...)
}
// Chunk iterates the table with given size and callback function.
func (d *FreightDao) Chunk(limit int, callback func(entities []*model.Freight, err error) bool) {
d.M.Chunk(limit, func(result gdb.Result, err error) bool {
var entities []*model.Freight
err = result.Structs(&entities)
if err == sql.ErrNoRows {
return false
}
return callback(entities, err)
})
}
// LockUpdate sets the lock for update for current operation.
func (d *FreightDao) LockUpdate() *FreightDao {
return &FreightDao{M: d.M.LockUpdate()}
}
// LockShared sets the lock in share mode for current operation.
func (d *FreightDao) LockShared() *FreightDao {
return &FreightDao{M: d.M.LockShared()}
}
// Unscoped enables/disables the soft deleting feature.
func (d *FreightDao) Unscoped() *FreightDao {
return &FreightDao{M: d.M.Unscoped()}
}
\ No newline at end of file
// ==========================================================================
// This is auto-generated by gf cli tool. Fill this file as you wish.
// ==========================================================================
package model
import (
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/shopapi/model/internal"
)
// Freight is the golang structure for table wn_freight.
type Freight internal.Freight
// Fill with you ideas below.
\ No newline at end of file
// ==========================================================================
// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
// ==========================================================================
package internal
// Freight is the golang structure for table wn_freight.
type Freight struct {
Id int `orm:"id,primary" json:"id"` //
SellerId int `orm:"seller_id" json:"sellerId"` //
Name string `orm:"name" json:"name"` // 模板名称
Sort int `orm:"sort" json:"sort"` //
IsDefault int `orm:"is_default" json:"isDefault"` // 是否是默认模板
ChargeType int `orm:"charge_type" json:"chargeType"` // 1 按重量 2 按个数
Dispatching string `orm:"dispatching" json:"dispatching"` // 配送规则
Disdispatching string `orm:"disdispatching" json:"disdispatching"` // 不配送区域
Publish int `orm:"publish" json:"publish"` //
Created int `orm:"created" json:"created"` //
Modified int `orm:"modified" json:"modified"` //
}
\ No newline at end of file
// ============================================================================
// This is auto-generated by gf cli tool only once. Fill this file as you wish.
// ============================================================================
package dao
import (
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/stbz_private/dao/internal"
)
// freightDao is the manager for logic model data accessing
// and custom defined data operations functions management. You can define
// methods on it to extend its functionality as you wish.
type freightDao struct {
internal.FreightDao
}
var (
// Freight is globally public accessible object for table stbz_cloud_freight operations.
Freight = freightDao{
internal.Freight,
}
)
// Fill with you ideas below.
\ No newline at end of file
// ==========================================================================
// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
// ==========================================================================
package internal
import (
"context"
"database/sql"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/frame/gmvc"
"time"
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/stbz_private/model"
)
// FreightDao is the manager for logic model data accessing
// and custom defined data operations functions management.
type FreightDao struct {
gmvc.M
DB gdb.DB
Table string
Columns freightColumns
}
// FreightColumns defines and stores column names for table stbz_cloud_freight.
type freightColumns struct {
Id string //
SellerId string //
Name string // 模板名称
Sort string //
IsDefault string // 是否是默认模板
ChargeType string // 1 按重量 2 按个数
Dispatching string // 配送规则
Disdispatching string // 不配送区域
Publish string //
Created string //
Modified string //
}
var (
// Freight is globally public accessible object for table stbz_cloud_freight operations.
Freight = FreightDao{
M: g.DB("default").Model("stbz_cloud_freight").Safe(),
DB: g.DB("default"),
Table: "stbz_cloud_freight",
Columns: freightColumns{
Id: "id",
SellerId: "seller_id",
Name: "name",
Sort: "sort",
IsDefault: "is_default",
ChargeType: "charge_type",
Dispatching: "dispatching",
Disdispatching: "disdispatching",
Publish: "publish",
Created: "created",
Modified: "modified",
},
}
)
// Ctx is a chaining function, which creates and returns a new DB that is a shallow copy
// of current DB object and with given context in it.
// Note that this returned DB object can be used only once, so do not assign it to
// a global or package variable for long using.
func (d *FreightDao) Ctx(ctx context.Context) *FreightDao {
return &FreightDao{M: d.M.Ctx(ctx)}
}
// As sets an alias name for current table.
func (d *FreightDao) As(as string) *FreightDao {
return &FreightDao{M: d.M.As(as)}
}
// TX sets the transaction for current operation.
func (d *FreightDao) TX(tx *gdb.TX) *FreightDao {
return &FreightDao{M: d.M.TX(tx)}
}
// Master marks the following operation on master node.
func (d *FreightDao) Master() *FreightDao {
return &FreightDao{M: d.M.Master()}
}
// Slave marks the following operation on slave node.
// Note that it makes sense only if there's any slave node configured.
func (d *FreightDao) Slave() *FreightDao {
return &FreightDao{M: d.M.Slave()}
}
// Args sets custom arguments for model operation.
func (d *FreightDao) Args(args ...interface{}) *FreightDao {
return &FreightDao{M: d.M.Args(args...)}
}
// LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
// The parameter <table> can be joined table and its joined condition,
// and also with its alias name, like:
// Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
// Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
func (d *FreightDao) LeftJoin(table ...string) *FreightDao {
return &FreightDao{M: d.M.LeftJoin(table...)}
}
// RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
// The parameter <table> can be joined table and its joined condition,
// and also with its alias name, like:
// Table("user").RightJoin("user_detail", "user_detail.uid=user.uid")
// Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
func (d *FreightDao) RightJoin(table ...string) *FreightDao {
return &FreightDao{M: d.M.RightJoin(table...)}
}
// InnerJoin does "INNER JOIN ... ON ..." statement on the model.
// The parameter <table> can be joined table and its joined condition,
// and also with its alias name, like:
// Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
// Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
func (d *FreightDao) InnerJoin(table ...string) *FreightDao {
return &FreightDao{M: d.M.InnerJoin(table...)}
}
// Fields sets the operation fields of the model, multiple fields joined using char ','.
// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
func (d *FreightDao) Fields(fieldNamesOrMapStruct ...interface{}) *FreightDao {
return &FreightDao{M: d.M.Fields(fieldNamesOrMapStruct...)}
}
// FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
func (d *FreightDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *FreightDao {
return &FreightDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)}
}
// Option sets the extra operation option for the model.
func (d *FreightDao) Option(option int) *FreightDao {
return &FreightDao{M: d.M.Option(option)}
}
// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
// the data and where attributes for empty values.
func (d *FreightDao) OmitEmpty() *FreightDao {
return &FreightDao{M: d.M.OmitEmpty()}
}
// Filter marks filtering the fields which does not exist in the fields of the operated table.
func (d *FreightDao) Filter() *FreightDao {
return &FreightDao{M: d.M.Filter()}
}
// Where sets the condition statement for the model. The parameter <where> can be type of
// string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
// multiple conditions will be joined into where statement using "AND".
// Eg:
// Where("uid=10000")
// Where("uid", 10000)
// Where("money>? AND name like ?", 99999, "vip_%")
// Where("uid", 1).Where("name", "john")
// Where("status IN (?)", g.Slice{1,2,3})
// Where("age IN(?,?)", 18, 50)
// Where(User{ Id : 1, UserName : "john"})
func (d *FreightDao) Where(where interface{}, args ...interface{}) *FreightDao {
return &FreightDao{M: d.M.Where(where, args...)}
}
// WherePri does the same logic as M.Where except that if the parameter <where>
// is a single condition like int/string/float/slice, it treats the condition as the primary
// key value. That is, if primary key is "id" and given <where> parameter as "123", the
// WherePri function treats the condition as "id=123", but M.Where treats the condition
// as string "123".
func (d *FreightDao) WherePri(where interface{}, args ...interface{}) *FreightDao {
return &FreightDao{M: d.M.WherePri(where, args...)}
}
// And adds "AND" condition to the where statement.
func (d *FreightDao) And(where interface{}, args ...interface{}) *FreightDao {
return &FreightDao{M: d.M.And(where, args...)}
}
// Or adds "OR" condition to the where statement.
func (d *FreightDao) Or(where interface{}, args ...interface{}) *FreightDao {
return &FreightDao{M: d.M.Or(where, args...)}
}
// Group sets the "GROUP BY" statement for the model.
func (d *FreightDao) Group(groupBy string) *FreightDao {
return &FreightDao{M: d.M.Group(groupBy)}
}
// Order sets the "ORDER BY" statement for the model.
func (d *FreightDao) Order(orderBy ...string) *FreightDao {
return &FreightDao{M: d.M.Order(orderBy...)}
}
// Limit sets the "LIMIT" statement for the model.
// The parameter <limit> can be either one or two number, if passed two number is passed,
// it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
// statement.
func (d *FreightDao) Limit(limit ...int) *FreightDao {
return &FreightDao{M: d.M.Limit(limit...)}
}
// Offset sets the "OFFSET" statement for the model.
// It only makes sense for some databases like SQLServer, PostgreSQL, etc.
func (d *FreightDao) Offset(offset int) *FreightDao {
return &FreightDao{M: d.M.Offset(offset)}
}
// Page sets the paging number for the model.
// The parameter <page> is started from 1 for paging.
// Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
func (d *FreightDao) Page(page, limit int) *FreightDao {
return &FreightDao{M: d.M.Page(page, limit)}
}
// Batch sets the batch operation number for the model.
func (d *FreightDao) Batch(batch int) *FreightDao {
return &FreightDao{M: d.M.Batch(batch)}
}
// Cache sets the cache feature for the model. It caches the result of the sql, which means
// if there's another same sql request, it just reads and returns the result from cache, it
// but not committed and executed into the database.
//
// If the parameter <duration> < 0, which means it clear the cache with given <name>.
// If the parameter <duration> = 0, which means it never expires.
// If the parameter <duration> > 0, which means it expires after <duration>.
//
// The optional parameter <name> is used to bind a name to the cache, which means you can later
// control the cache like changing the <duration> or clearing the cache with specified <name>.
//
// Note that, the cache feature is disabled if the model is operating on a transaction.
func (d *FreightDao) Cache(duration time.Duration, name ...string) *FreightDao {
return &FreightDao{M: d.M.Cache(duration, name...)}
}
// Data sets the operation data for the model.
// The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
// Eg:
// Data("uid=10000")
// Data("uid", 10000)
// Data(g.Map{"uid": 10000, "name":"john"})
// Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
func (d *FreightDao) Data(data ...interface{}) *FreightDao {
return &FreightDao{M: d.M.Data(data...)}
}
// All does "SELECT FROM ..." statement for the model.
// It retrieves the records from table and returns the result as []*model.Freight.
// It returns nil if there's no record retrieved with the given conditions from table.
//
// The optional parameter <where> is the same as the parameter of M.Where function,
// see M.Where.
func (d *FreightDao) All(where ...interface{}) ([]*model.Freight, error) {
all, err := d.M.All(where...)
if err != nil {
return nil, err
}
var entities []*model.Freight
if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
return nil, err
}
return entities, nil
}
// One retrieves one record from table and returns the result as *model.Freight.
// It returns nil if there's no record retrieved with the given conditions from table.
//
// The optional parameter <where> is the same as the parameter of M.Where function,
// see M.Where.
func (d *FreightDao) One(where ...interface{}) (*model.Freight, error) {
one, err := d.M.One(where...)
if err != nil {
return nil, err
}
var entity *model.Freight
if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
return nil, err
}
return entity, nil
}
// FindOne retrieves and returns a single Record by M.WherePri and M.One.
// Also see M.WherePri and M.One.
func (d *FreightDao) FindOne(where ...interface{}) (*model.Freight, error) {
one, err := d.M.FindOne(where...)
if err != nil {
return nil, err
}
var entity *model.Freight
if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
return nil, err
}
return entity, nil
}
// FindAll retrieves and returns Result by by M.WherePri and M.All.
// Also see M.WherePri and M.All.
func (d *FreightDao) FindAll(where ...interface{}) ([]*model.Freight, error) {
all, err := d.M.FindAll(where...)
if err != nil {
return nil, err
}
var entities []*model.Freight
if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
return nil, err
}
return entities, nil
}
// Struct retrieves one record from table and converts it into given struct.
// The parameter <pointer> should be type of *struct/**struct. If type **struct is given,
// it can create the struct internally during converting.
//
// The optional parameter <where> is the same as the parameter of Model.Where function,
// see Model.Where.
//
// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
// from table and <pointer> is not nil.
//
// Eg:
// user := new(User)
// err := dao.User.Where("id", 1).Struct(user)
//
// user := (*User)(nil)
// err := dao.User.Where("id", 1).Struct(&user)
func (d *FreightDao) Struct(pointer interface{}, where ...interface{}) error {
return d.M.Struct(pointer, where...)
}
// Structs retrieves records from table and converts them into given struct slice.
// The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct
// slice internally during converting.
//
// The optional parameter <where> is the same as the parameter of Model.Where function,
// see Model.Where.
//
// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
// from table and <pointer> is not empty.
//
// Eg:
// users := ([]User)(nil)
// err := dao.User.Structs(&users)
//
// users := ([]*User)(nil)
// err := dao.User.Structs(&users)
func (d *FreightDao) Structs(pointer interface{}, where ...interface{}) error {
return d.M.Structs(pointer, where...)
}
// Scan automatically calls Struct or Structs function according to the type of parameter <pointer>.
// It calls function Struct if <pointer> is type of *struct/**struct.
// It calls function Structs if <pointer> is type of *[]struct/*[]*struct.
//
// The optional parameter <where> is the same as the parameter of Model.Where function,
// see Model.Where.
//
// Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.
//
// Eg:
// user := new(User)
// err := dao.User.Where("id", 1).Scan(user)
//
// user := (*User)(nil)
// err := dao.User.Where("id", 1).Scan(&user)
//
// users := ([]User)(nil)
// err := dao.User.Scan(&users)
//
// users := ([]*User)(nil)
// err := dao.User.Scan(&users)
func (d *FreightDao) Scan(pointer interface{}, where ...interface{}) error {
return d.M.Scan(pointer, where...)
}
// Chunk iterates the table with given size and callback function.
func (d *FreightDao) Chunk(limit int, callback func(entities []*model.Freight, err error) bool) {
d.M.Chunk(limit, func(result gdb.Result, err error) bool {
var entities []*model.Freight
err = result.Structs(&entities)
if err == sql.ErrNoRows {
return false
}
return callback(entities, err)
})
}
// LockUpdate sets the lock for update for current operation.
func (d *FreightDao) LockUpdate() *FreightDao {
return &FreightDao{M: d.M.LockUpdate()}
}
// LockShared sets the lock in share mode for current operation.
func (d *FreightDao) LockShared() *FreightDao {
return &FreightDao{M: d.M.LockShared()}
}
// Unscoped enables/disables the soft deleting feature.
func (d *FreightDao) Unscoped() *FreightDao {
return &FreightDao{M: d.M.Unscoped()}
}
\ No newline at end of file
// ==========================================================================
// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
// ==========================================================================
package internal
import (
"context"
"database/sql"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/frame/gmvc"
"time"
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/stbz_private/model"
)
// OrderDao is the manager for logic model data accessing
// and custom defined data operations functions management.
type OrderDao struct {
gmvc.M
DB gdb.DB
Table string
Columns orderColumns
}
// OrderColumns defines and stores column names for table stbz_cloud_order.
type orderColumns struct {
Id string //
SellerId string // 商户Id
ParentOrderSn string // 父订单ID
OrderSn string // 订单号
ThirdOrderSn string // 三方单号
Status string // 订单状态-1订单取消0待付款1待发货2待收货3已完成
CreatedTime string // 创建时间
CancelTime string // 取消时间
FinishTime string // 完成时间
SendTime string // 发货时间
DispatchPrice string // 运费 单位为分
OrderTotalPrice string // 订单总金额 单位为分
RefundPrice string // 可退款金额 -1代表已退款完成 0代表未退款 其他数字代表可退金额
ShopName string // 店铺名称
Remark string // 用户备注
RealName string // 姓名
Mobile string // 手机号
Provice string // 省
City string // 市
District string // 区县
Street string // 街道
Address string // 详细地址
IsUpdateAddress string // 0没更新1更新过收货地址
SettlementStatus string // 结算状态 0未结算 1已结算
WithdrawStatus string // 提现操作状态 0未操作提现 1已操作提现
SellerRemark string // 商家备注
ChannelId string // 渠道id
ServiceFee string // 服务费(分)
IsAllRefund string // 子订单是否全部处于售后中 或者售后完成0否 1是
SiteId string // 站点id(paasid)
FloatAmount string // 浮动金额
}
var (
// Order is globally public accessible object for table stbz_cloud_order operations.
Order = OrderDao{
M: g.DB("default").Model("stbz_cloud_order").Safe(),
DB: g.DB("default"),
Table: "stbz_cloud_order",
Columns: orderColumns{
Id: "id",
SellerId: "seller_id",
ParentOrderSn: "parent_order_sn",
OrderSn: "order_sn",
ThirdOrderSn: "third_order_sn",
Status: "status",
CreatedTime: "created_time",
CancelTime: "cancel_time",
FinishTime: "finish_time",
SendTime: "send_time",
DispatchPrice: "dispatch_price",
OrderTotalPrice: "order_total_price",
RefundPrice: "refund_price",
ShopName: "shop_name",
Remark: "remark",
RealName: "real_name",
Mobile: "mobile",
Provice: "provice",
City: "city",
District: "district",
Street: "street",
Address: "address",
IsUpdateAddress: "is_update_address",
SettlementStatus: "settlement_status",
WithdrawStatus: "withdraw_status",
SellerRemark: "seller_remark",
ChannelId: "channel_id",
ServiceFee: "service_fee",
IsAllRefund: "is_all_refund",
SiteId: "site_id",
FloatAmount: "float_amount",
},
}
)
// Ctx is a chaining function, which creates and returns a new DB that is a shallow copy
// of current DB object and with given context in it.
// Note that this returned DB object can be used only once, so do not assign it to
// a global or package variable for long using.
func (d *OrderDao) Ctx(ctx context.Context) *OrderDao {
return &OrderDao{M: d.M.Ctx(ctx)}
}
// As sets an alias name for current table.
func (d *OrderDao) As(as string) *OrderDao {
return &OrderDao{M: d.M.As(as)}
}
// TX sets the transaction for current operation.
func (d *OrderDao) TX(tx *gdb.TX) *OrderDao {
return &OrderDao{M: d.M.TX(tx)}
}
// Master marks the following operation on master node.
func (d *OrderDao) Master() *OrderDao {
return &OrderDao{M: d.M.Master()}
}
// Slave marks the following operation on slave node.
// Note that it makes sense only if there's any slave node configured.
func (d *OrderDao) Slave() *OrderDao {
return &OrderDao{M: d.M.Slave()}
}
// Args sets custom arguments for model operation.
func (d *OrderDao) Args(args ...interface{}) *OrderDao {
return &OrderDao{M: d.M.Args(args...)}
}
// LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
// The parameter <table> can be joined table and its joined condition,
// and also with its alias name, like:
// Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
// Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
func (d *OrderDao) LeftJoin(table ...string) *OrderDao {
return &OrderDao{M: d.M.LeftJoin(table...)}
}
// RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
// The parameter <table> can be joined table and its joined condition,
// and also with its alias name, like:
// Table("user").RightJoin("user_detail", "user_detail.uid=user.uid")
// Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
func (d *OrderDao) RightJoin(table ...string) *OrderDao {
return &OrderDao{M: d.M.RightJoin(table...)}
}
// InnerJoin does "INNER JOIN ... ON ..." statement on the model.
// The parameter <table> can be joined table and its joined condition,
// and also with its alias name, like:
// Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
// Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
func (d *OrderDao) InnerJoin(table ...string) *OrderDao {
return &OrderDao{M: d.M.InnerJoin(table...)}
}
// Fields sets the operation fields of the model, multiple fields joined using char ','.
// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
func (d *OrderDao) Fields(fieldNamesOrMapStruct ...interface{}) *OrderDao {
return &OrderDao{M: d.M.Fields(fieldNamesOrMapStruct...)}
}
// FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
func (d *OrderDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *OrderDao {
return &OrderDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)}
}
// Option sets the extra operation option for the model.
func (d *OrderDao) Option(option int) *OrderDao {
return &OrderDao{M: d.M.Option(option)}
}
// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
// the data and where attributes for empty values.
func (d *OrderDao) OmitEmpty() *OrderDao {
return &OrderDao{M: d.M.OmitEmpty()}
}
// Filter marks filtering the fields which does not exist in the fields of the operated table.
func (d *OrderDao) Filter() *OrderDao {
return &OrderDao{M: d.M.Filter()}
}
// Where sets the condition statement for the model. The parameter <where> can be type of
// string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
// multiple conditions will be joined into where statement using "AND".
// Eg:
// Where("uid=10000")
// Where("uid", 10000)
// Where("money>? AND name like ?", 99999, "vip_%")
// Where("uid", 1).Where("name", "john")
// Where("status IN (?)", g.Slice{1,2,3})
// Where("age IN(?,?)", 18, 50)
// Where(User{ Id : 1, UserName : "john"})
func (d *OrderDao) Where(where interface{}, args ...interface{}) *OrderDao {
return &OrderDao{M: d.M.Where(where, args...)}
}
// WherePri does the same logic as M.Where except that if the parameter <where>
// is a single condition like int/string/float/slice, it treats the condition as the primary
// key value. That is, if primary key is "id" and given <where> parameter as "123", the
// WherePri function treats the condition as "id=123", but M.Where treats the condition
// as string "123".
func (d *OrderDao) WherePri(where interface{}, args ...interface{}) *OrderDao {
return &OrderDao{M: d.M.WherePri(where, args...)}
}
// And adds "AND" condition to the where statement.
func (d *OrderDao) And(where interface{}, args ...interface{}) *OrderDao {
return &OrderDao{M: d.M.And(where, args...)}
}
// Or adds "OR" condition to the where statement.
func (d *OrderDao) Or(where interface{}, args ...interface{}) *OrderDao {
return &OrderDao{M: d.M.Or(where, args...)}
}
// Group sets the "GROUP BY" statement for the model.
func (d *OrderDao) Group(groupBy string) *OrderDao {
return &OrderDao{M: d.M.Group(groupBy)}
}
// Order sets the "ORDER BY" statement for the model.
func (d *OrderDao) Order(orderBy ...string) *OrderDao {
return &OrderDao{M: d.M.Order(orderBy...)}
}
// Limit sets the "LIMIT" statement for the model.
// The parameter <limit> can be either one or two number, if passed two number is passed,
// it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
// statement.
func (d *OrderDao) Limit(limit ...int) *OrderDao {
return &OrderDao{M: d.M.Limit(limit...)}
}
// Offset sets the "OFFSET" statement for the model.
// It only makes sense for some databases like SQLServer, PostgreSQL, etc.
func (d *OrderDao) Offset(offset int) *OrderDao {
return &OrderDao{M: d.M.Offset(offset)}
}
// Page sets the paging number for the model.
// The parameter <page> is started from 1 for paging.
// Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
func (d *OrderDao) Page(page, limit int) *OrderDao {
return &OrderDao{M: d.M.Page(page, limit)}
}
// Batch sets the batch operation number for the model.
func (d *OrderDao) Batch(batch int) *OrderDao {
return &OrderDao{M: d.M.Batch(batch)}
}
// Cache sets the cache feature for the model. It caches the result of the sql, which means
// if there's another same sql request, it just reads and returns the result from cache, it
// but not committed and executed into the database.
//
// If the parameter <duration> < 0, which means it clear the cache with given <name>.
// If the parameter <duration> = 0, which means it never expires.
// If the parameter <duration> > 0, which means it expires after <duration>.
//
// The optional parameter <name> is used to bind a name to the cache, which means you can later
// control the cache like changing the <duration> or clearing the cache with specified <name>.
//
// Note that, the cache feature is disabled if the model is operating on a transaction.
func (d *OrderDao) Cache(duration time.Duration, name ...string) *OrderDao {
return &OrderDao{M: d.M.Cache(duration, name...)}
}
// Data sets the operation data for the model.
// The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
// Eg:
// Data("uid=10000")
// Data("uid", 10000)
// Data(g.Map{"uid": 10000, "name":"john"})
// Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
func (d *OrderDao) Data(data ...interface{}) *OrderDao {
return &OrderDao{M: d.M.Data(data...)}
}
// All does "SELECT FROM ..." statement for the model.
// It retrieves the records from table and returns the result as []*model.Order.
// It returns nil if there's no record retrieved with the given conditions from table.
//
// The optional parameter <where> is the same as the parameter of M.Where function,
// see M.Where.
func (d *OrderDao) All(where ...interface{}) ([]*model.Order, error) {
all, err := d.M.All(where...)
if err != nil {
return nil, err
}
var entities []*model.Order
if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
return nil, err
}
return entities, nil
}
// One retrieves one record from table and returns the result as *model.Order.
// It returns nil if there's no record retrieved with the given conditions from table.
//
// The optional parameter <where> is the same as the parameter of M.Where function,
// see M.Where.
func (d *OrderDao) One(where ...interface{}) (*model.Order, error) {
one, err := d.M.One(where...)
if err != nil {
return nil, err
}
var entity *model.Order
if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
return nil, err
}
return entity, nil
}
// FindOne retrieves and returns a single Record by M.WherePri and M.One.
// Also see M.WherePri and M.One.
func (d *OrderDao) FindOne(where ...interface{}) (*model.Order, error) {
one, err := d.M.FindOne(where...)
if err != nil {
return nil, err
}
var entity *model.Order
if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
return nil, err
}
return entity, nil
}
// FindAll retrieves and returns Result by by M.WherePri and M.All.
// Also see M.WherePri and M.All.
func (d *OrderDao) FindAll(where ...interface{}) ([]*model.Order, error) {
all, err := d.M.FindAll(where...)
if err != nil {
return nil, err
}
var entities []*model.Order
if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
return nil, err
}
return entities, nil
}
// Struct retrieves one record from table and converts it into given struct.
// The parameter <pointer> should be type of *struct/**struct. If type **struct is given,
// it can create the struct internally during converting.
//
// The optional parameter <where> is the same as the parameter of Model.Where function,
// see Model.Where.
//
// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
// from table and <pointer> is not nil.
//
// Eg:
// user := new(User)
// err := dao.User.Where("id", 1).Struct(user)
//
// user := (*User)(nil)
// err := dao.User.Where("id", 1).Struct(&user)
func (d *OrderDao) Struct(pointer interface{}, where ...interface{}) error {
return d.M.Struct(pointer, where...)
}
// Structs retrieves records from table and converts them into given struct slice.
// The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct
// slice internally during converting.
//
// The optional parameter <where> is the same as the parameter of Model.Where function,
// see Model.Where.
//
// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
// from table and <pointer> is not empty.
//
// Eg:
// users := ([]User)(nil)
// err := dao.User.Structs(&users)
//
// users := ([]*User)(nil)
// err := dao.User.Structs(&users)
func (d *OrderDao) Structs(pointer interface{}, where ...interface{}) error {
return d.M.Structs(pointer, where...)
}
// Scan automatically calls Struct or Structs function according to the type of parameter <pointer>.
// It calls function Struct if <pointer> is type of *struct/**struct.
// It calls function Structs if <pointer> is type of *[]struct/*[]*struct.
//
// The optional parameter <where> is the same as the parameter of Model.Where function,
// see Model.Where.
//
// Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.
//
// Eg:
// user := new(User)
// err := dao.User.Where("id", 1).Scan(user)
//
// user := (*User)(nil)
// err := dao.User.Where("id", 1).Scan(&user)
//
// users := ([]User)(nil)
// err := dao.User.Scan(&users)
//
// users := ([]*User)(nil)
// err := dao.User.Scan(&users)
func (d *OrderDao) Scan(pointer interface{}, where ...interface{}) error {
return d.M.Scan(pointer, where...)
}
// Chunk iterates the table with given size and callback function.
func (d *OrderDao) Chunk(limit int, callback func(entities []*model.Order, err error) bool) {
d.M.Chunk(limit, func(result gdb.Result, err error) bool {
var entities []*model.Order
err = result.Structs(&entities)
if err == sql.ErrNoRows {
return false
}
return callback(entities, err)
})
}
// LockUpdate sets the lock for update for current operation.
func (d *OrderDao) LockUpdate() *OrderDao {
return &OrderDao{M: d.M.LockUpdate()}
}
// LockShared sets the lock in share mode for current operation.
func (d *OrderDao) LockShared() *OrderDao {
return &OrderDao{M: d.M.LockShared()}
}
// Unscoped enables/disables the soft deleting feature.
func (d *OrderDao) Unscoped() *OrderDao {
return &OrderDao{M: d.M.Unscoped()}
}
\ No newline at end of file
// ============================================================================
// This is auto-generated by gf cli tool only once. Fill this file as you wish.
// ============================================================================
package dao
import (
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/stbz_private/dao/internal"
)
// orderDao is the manager for logic model data accessing
// and custom defined data operations functions management. You can define
// methods on it to extend its functionality as you wish.
type orderDao struct {
internal.OrderDao
}
var (
// Order is globally public accessible object for table stbz_cloud_order operations.
Order = orderDao{
internal.Order,
}
)
// Fill with you ideas below.
\ No newline at end of file
// ==========================================================================
// This is auto-generated by gf cli tool. Fill this file as you wish.
// ==========================================================================
package model
import (
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/stbz_private/model/internal"
)
// Freight is the golang structure for table stbz_cloud_freight.
type Freight internal.Freight
// Fill with you ideas below.
\ No newline at end of file
// ==========================================================================
// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
// ==========================================================================
package internal
// Freight is the golang structure for table stbz_cloud_freight.
type Freight struct {
Id int `orm:"id,primary" json:"id"` //
SellerId int `orm:"seller_id" json:"sellerId"` //
Name string `orm:"name" json:"name"` // 模板名称
Sort int `orm:"sort" json:"sort"` //
IsDefault int `orm:"is_default" json:"isDefault"` // 是否是默认模板
ChargeType int `orm:"charge_type" json:"chargeType"` // 1 按重量 2 按个数
Dispatching string `orm:"dispatching" json:"dispatching"` // 配送规则
Disdispatching string `orm:"disdispatching" json:"disdispatching"` // 不配送区域
Publish int `orm:"publish" json:"publish"` //
Created int `orm:"created" json:"created"` //
Modified int `orm:"modified" json:"modified"` //
}
\ No newline at end of file
// ==========================================================================
// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
// ==========================================================================
package internal
// Order is the golang structure for table stbz_cloud_order.
type Order struct {
Id int `orm:"id,primary" json:"id"` //
SellerId int `orm:"seller_id" json:"sellerId"` // 商户Id
ParentOrderSn string `orm:"parent_order_sn" json:"parentOrderSn"` // 父订单ID
OrderSn string `orm:"order_sn,unique" json:"orderSn"` // 订单号
ThirdOrderSn string `orm:"third_order_sn" json:"thirdOrderSn"` // 三方单号
Status int `orm:"status" json:"status"` // 订单状态-1订单取消0待付款1待发货2待收货3已完成
CreatedTime int `orm:"created_time" json:"createdTime"` // 创建时间
CancelTime int `orm:"cancel_time" json:"cancelTime"` // 取消时间
FinishTime int `orm:"finish_time" json:"finishTime"` // 完成时间
SendTime int `orm:"send_time" json:"sendTime"` // 发货时间
DispatchPrice int `orm:"dispatch_price" json:"dispatchPrice"` // 运费 单位为分
OrderTotalPrice int `orm:"order_total_price" json:"orderTotalPrice"` // 订单总金额 单位为分
RefundPrice int `orm:"refund_price" json:"refundPrice"` // 可退款金额 -1代表已退款完成 0代表未退款 其他数字代表可退金额
ShopName string `orm:"shop_name" json:"shopName"` // 店铺名称
Remark string `orm:"remark" json:"remark"` // 用户备注
RealName string `orm:"real_name" json:"realName"` // 姓名
Mobile string `orm:"mobile" json:"mobile"` // 手机号
Provice string `orm:"provice" json:"provice"` // 省
City string `orm:"city" json:"city"` // 市
District string `orm:"district" json:"district"` // 区县
Street string `orm:"street" json:"street"` // 街道
Address string `orm:"address" json:"address"` // 详细地址
IsUpdateAddress int `orm:"is_update_address" json:"isUpdateAddress"` // 0没更新1更新过收货地址
SettlementStatus int `orm:"settlement_status" json:"settlementStatus"` // 结算状态 0未结算 1已结算
WithdrawStatus int `orm:"withdraw_status" json:"withdrawStatus"` // 提现操作状态 0未操作提现 1已操作提现
SellerRemark string `orm:"seller_remark" json:"sellerRemark"` // 商家备注
ChannelId int `orm:"channel_id" json:"channelId"` // 渠道id
ServiceFee int `orm:"service_fee" json:"serviceFee"` // 服务费(分)
IsAllRefund int `orm:"is_all_refund" json:"isAllRefund"` // 子订单是否全部处于售后中 或者售后完成0否 1是
SiteId int `orm:"site_id" json:"siteId"` // 站点id(paasid)
FloatAmount int `orm:"float_amount" json:"floatAmount"` // 浮动金额
}
\ No newline at end of file
// ==========================================================================
// This is auto-generated by gf cli tool. Fill this file as you wish.
// ==========================================================================
package model
import (
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/stbz_private/model/internal"
)
// Order is the golang structure for table stbz_cloud_order.
type Order internal.Order
// Fill with you ideas below.
\ No newline at end of file
package v1
type FreightInfo struct {
Id int `json:"id,omitempty"` //运费模板id
SellerId int `json:"seller_id"` //商户id
IsDefault int `json:"is_default"` //是否默认 0否 1是
Name string `json:"name"` //模板名称
}
\ No newline at end of file
package v1
import "gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/system/demo/store"
type Service interface {
Users() UserSrv
}
type service struct {
store store.Factory
}
func NewService(store store.Factory) Service {
return &service{store: store}
}
func (s *service)Users()UserSrv {
return newUsers(s)
}
\ No newline at end of file
package v1
import (
"context"
v1 "gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/system/demo/define/v1"
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/system/demo/store"
)
type UserSrv interface {
Get(ctx context.Context) (res *v1.FreightInfo, err error)
}
type userService struct {
store store.Factory
}
func newUsers(srv *service)*userService {
return &userService{store: srv.store}
}
func (u *userService)Get(ctx context.Context) (res *v1.FreightInfo, err error) {
res, err = u.store.Users().Get(ctx)
//return errors.New(code.ErrValidation, "参数id必传", "")
return
}
\ No newline at end of file
package v1
import (
"context"
"fmt"
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/system/demo/store/mysql/stbz_private"
"testing"
)
func Test(t *testing.T) {
res1, err := NewService(stbz_private.StbzPrivate).Users().Get(context.TODO())
fmt.Printf("%+v", res1)
fmt.Println(err)
}
\ No newline at end of file
package mysql
import (
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/system/demo/store"
)
func GetMySQLFactoryOr(cli store.Factory) (store.Factory, error) {
return cli, nil
}
package shopapi
import (
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/system/demo/store"
)
var ShopApi = new(shopapi)
type shopapi struct {
}
func (ds *shopapi)Users() store.UserStore {
return newUser()
}
\ No newline at end of file
package shopapi
import (
"context"
"github.com/gogf/gf/frame/g"
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/shopapi/dao"
v1 "gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/system/demo/define/v1"
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/library/code"
"gitlab.jxhh.com/zhaoxueru/common-base.git/pkg/errors"
)
type user struct {
}
func newUser() *user {
return &user{}
}
func (u *user)Get(ctx context.Context) (res *v1.FreightInfo, err error) {
err = dao.Freight.Fields(
dao.Freight.Columns.Id,
dao.Freight.Columns.Name,
dao.Freight.Columns.IsDefault,
).Where(g.Map{
dao.Freight.Columns.Id : 1,
}).Scan(&res)
if err != nil {
return nil, errors.New(code.ErrDatabase, "", "")
}
return
}
\ No newline at end of file
package stbz_private
import "gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/system/demo/store"
var StbzPrivate = new(stbzPrivate)
type stbzPrivate struct {
}
func (ds *stbzPrivate)Users() store.UserStore {
return newUser()
}
\ No newline at end of file
package stbz_private
import (
"context"
"github.com/gogf/gf/frame/g"
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/stbz_private/dao"
v1 "gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/system/demo/define/v1"
"gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/library/code"
"gitlab.jxhh.com/zhaoxueru/common-base.git/pkg/errors"
)
type user struct {
}
func newUser() *user {
return &user{}
}
func (u *user)Get(ctx context.Context) (res *v1.FreightInfo, err error) {
err = dao.Freight.Fields(
dao.Freight.Columns.Id,
dao.Freight.Columns.Name,
dao.Freight.Columns.IsDefault,
).Where(g.Map{
dao.Freight.Columns.Id : 1,
}).Scan(&res)
if err != nil {
return nil, errors.New(code.ErrDatabase, "", "")
}
return
}
\ No newline at end of file
package store
type Factory interface {
Users() UserStore
}
package store
import (
"context"
v1 "gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git/app/system/demo/define/v1"
)
type UserStore interface {
Get(ctx context.Context) (*v1.FreightInfo, error)
}
# HTTP Server
[server]
Address = ":8199"
ServerRoot = "public"
ServerAgent = "gf-app"
LogPath = "./logs/server"
# Logger.
[logger]
Path = "./logs"
File = ""
Level = "all"
Stdout = true
# Template.
[viewer]
Path = "template"
DefaultFile = "index.html"
Delimiters = ["{{", "}}"]
# Database.
[database]
link = "mysql:root:zhaoheng@tcp(127.0.0.1:3306)/middleground"
#link = "mysql:root:zhaoheng@tcp(127.0.0.1:3306)/wnmall"
debug = true
# Database logger.
[database.logger]
Path = "./logs/sql"
Level = "all"
Stdout = true
[gfcli]
# [[gfcli.gen.dao]]
# link = "mysql:root:zhaoheng@tcp(127.0.0.1:3306)/middleground"
#
# removePrefix = "stbz_cloud_"
# path = "./app/stbz_private"
#
# tables = "wn_freight"
[[gfcli.gen.dao]]
link = "mysql:root:zhaoheng@tcp(127.0.0.1:3306)/wnmall"
removePrefix = "wn_"
path = "./app/shopapi"
tables = "wn_freight"
\ No newline at end of file
module gitlab.jxhh.com/zhaoxueru/cloud-warehouse.git
go 1.16
require (
github.com/gogf/gf v1.16.8
gitlab.jxhh.com/zhaoxueru/common-base.git v0.0.7
)
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/clbanning/mxj v1.8.5-0.20200714211355-ff02cfb8ea28 h1:LdXxtjzvZYhhUaonAaAKArG3pyC67kGL3YY+6hGG8G4=
github.com/clbanning/mxj v1.8.5-0.20200714211355-ff02cfb8ea28/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc=
github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/gogf/gf v1.16.7/go.mod h1:8Q/kw05nlVRp+4vv7XASBsMe9L1tsVKiGoeP2AHnlkk=
github.com/gogf/gf v1.16.8 h1:iVXUB+QPQIYDMMjMdDb6ZINF8xf5bWy54XxAo600zMs=
github.com/gogf/gf v1.16.8/go.mod h1:8Q/kw05nlVRp+4vv7XASBsMe9L1tsVKiGoeP2AHnlkk=
github.com/gomodule/redigo v1.8.5 h1:nRAxCa+SVsyjSBrtZmG/cqb6VbTmuRzpg/PoTFlpumc=
github.com/gomodule/redigo v1.8.5/go.mod h1:P9dn9mFrCBvWhGE1wpxx6fgq7BAeLBk+UUUzlpkBYO0=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grokify/html-strip-tags-go v0.0.1 h1:0fThFwLbW7P/kOiTBs03FsJSV9RM2M/Q/MOnCQxKMo0=
github.com/grokify/html-strip-tags-go v0.0.1/go.mod h1:2Su6romC5/1VXOQMaWL2yb618ARB8iVo6/DR99A6d78=
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gitlab.jxhh.com/zhaoxueru/api.git v0.0.4 h1:nN0c5Vub/9CytLpnSRL2rFwPRxSzDSnS1emrGqK9j1A=
gitlab.jxhh.com/zhaoxueru/api.git v0.0.4/go.mod h1:LCH+M2IsVLjXUhNJWxXGZfyFV/By4do7uKXmKk4gOWY=
gitlab.jxhh.com/zhaoxueru/common-base.git v0.0.7 h1:PpYDVKf8X3vMhV1etQewvg+EHjoKmOWZjZlxmPRL0rI=
gitlab.jxhh.com/zhaoxueru/common-base.git v0.0.7/go.mod h1:gxK/RL0Y4tSKScgXkyWyjqsPLLzvCHzVGN0SEjBFGNE=
go.opentelemetry.io/otel v1.0.0 h1:qTTn6x71GVBvoafHK/yaRUmFzI4LcONZD0/kXxl5PHI=
go.opentelemetry.io/otel v1.0.0/go.mod h1:AjRVh9A5/5DE7S+mZtTR6t8vpKKryam+0lREnfmS4cg=
go.opentelemetry.io/otel/trace v1.0.0 h1:TSBr8GTEtKevYMG/2d21M989r5WJYVimhTHBKVEZuh4=
go.opentelemetry.io/otel/trace v1.0.0/go.mod h1:PXTWqayeFUlJV1YDNhsJYB184+IvAH814St6o6ajzIs=
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 h1:ADo5wSpq2gqaCGQWzk7S5vd//0iyyLeAratkEoG5dLE=
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
package code
import "gitlab.jxhh.com/zhaoxueru/common-base.git/pkg/errors"
//12XXXX 收单易服务
//|12|00|收单易服务 - 通用错误|
// Code must start with 12XXXX.
// 基本错误码
const (
//ErrServer : 服务器异常
ErrServer int = iota + 120001
//ErrValidation : 校验错误
ErrValidation
//ErrDatabase : 数据库错误
ErrDatabase
)
func init() {
errors.MustRegister(ErrServer, "服务器异常")
errors.MustRegister(ErrValidation, "%%0")
errors.MustRegister(ErrDatabase, "Database error")
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论