feat:完善项目信息
This commit is contained in:
11
app/api/enterprise/model/bill_instance.go
Normal file
11
app/api/enterprise/model/bill_instance.go
Normal file
@ -0,0 +1,11 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
|
||||
type BillInstance struct {
|
||||
*model.BillInstance
|
||||
}
|
||||
|
||||
func NewBillInstance() *BillInstance {
|
||||
return &BillInstance{model.NewBillInstance()}
|
||||
}
|
45
app/api/enterprise/model/user_bill.go
Normal file
45
app/api/enterprise/model/user_bill.go
Normal file
@ -0,0 +1,45 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type UserBill struct {
|
||||
*model.UserBill
|
||||
}
|
||||
|
||||
// UserBillInfo 用户账单信息
|
||||
type UserBillInfo struct {
|
||||
model.Model
|
||||
model.BillInstanceBasic
|
||||
}
|
||||
|
||||
// Bill 账单信息
|
||||
func (m *UserBill) Bill(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*UserBillInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
Select("u.id", "b.order_no", "b.kind", "b.amount", "b.number", "b.status", "b.remark").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS b ON u.bill_id = b.id",
|
||||
model.NewBillInstance().TableName())).
|
||||
Where("u.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
if len(where) > 0 {
|
||||
for _, v := range where {
|
||||
db = db.Where(v.Condition, v.Value)
|
||||
}
|
||||
}
|
||||
out := make([]*UserBillInfo, 0)
|
||||
|
||||
if err := db.Count(count).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := db.Order("u.id " + model.OrderModeToDesc).Offset((page - 1) * pageSize).Limit(pageSize).Scan(&out).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func NewUserBill() *UserBill {
|
||||
return &UserBill{model.NewUserBill()}
|
||||
}
|
11
app/api/enterprise/model/user_bill_ticket.go
Normal file
11
app/api/enterprise/model/user_bill_ticket.go
Normal file
@ -0,0 +1,11 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
|
||||
type UserBillTicket struct {
|
||||
*model.UserBillTicket
|
||||
}
|
||||
|
||||
func NewUserBillTicket() *UserBillTicket {
|
||||
return &UserBillTicket{model.NewUserBillTicket()}
|
||||
}
|
Reference in New Issue
Block a user