Browse Source

update

add_mode
DengBiao 1 year ago
parent
commit
975052622b
3 changed files with 52 additions and 9 deletions
  1. +21
    -5
      app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go
  2. +9
    -0
      app/db/db_central_kitchen_for_school_user_refund_day.go
  3. +22
    -4
      app/db/db_central_kitchen_for_school_user_with_day.go

+ 21
- 5
app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go View File

@@ -1015,17 +1015,33 @@ func CentralKitchenForSchoolReserveDetail(c *gin.Context) {
e.OutErr(c, e.ERR_NO_DATA, "未查询到相应记录")
return
}
var m []model.CentralKitchenForSchoolUserWithDay
err = db.Db.Where("ord_no =?", centralKitchenForSchoolPackageOrdForReserve.OutTradeNo).
And("date >=? and date <=?", centralKitchenForSchoolPackageOrdForReserve.MealTimeStart, centralKitchenForSchoolPackageOrdForReserve.MealTimeEnd).

var m []*db.CentralKitchenForSchoolUserRefundDayWithCentralKitchenForSchoolUserWithDay
err = db.Db.Where("central_kitchen_for_school_user_with_day.ord_no =?", centralKitchenForSchoolPackageOrdForReserve.OutTradeNo).
Where("central_kitchen_for_school_user_with_day.date >=? and central_kitchen_for_school_user_with_day.date <=?", centralKitchenForSchoolPackageOrdForReserve.MealTimeStart, centralKitchenForSchoolPackageOrdForReserve.MealTimeEnd).
Join("LEFT", "central_kitchen_for_school_user_refund_day", "central_kitchen_for_school_user_refund_day.records_id = central_kitchen_for_school_user_with_day.id").
Find(&m)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

var resp []map[string]interface{}
for _, v := range m {
resp = append(resp, map[string]interface{}{
"id": v.CentralKitchenForSchoolUserWithDay.Id,
"ord_no": v.CentralKitchenForSchoolUserWithDay.OrdNo,
"uid": v.CentralKitchenForSchoolUserWithDay.Uid,
"enterprise_id": v.CentralKitchenForSchoolUserWithDay.EnterpriseId,
"identity_id": v.CentralKitchenForSchoolUserWithDay.IdentityId,
"kind": v.CentralKitchenForSchoolUserWithDay.Kind,
"amount": v.CentralKitchenForSchoolUserWithDay.Amount,
"date": v.CentralKitchenForSchoolUserWithDay.Date,
"state": v.CentralKitchenForSchoolUserWithDay.State,
"refund_date": v.CentralKitchenForSchoolUserRefundDay.RefundDate,
})
}
e.OutSuc(c, map[string]interface{}{
"list": m,
"list": resp,
"kind_list": []map[string]interface{}{
{
"name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForBreakfast),


+ 9
- 0
app/db/db_central_kitchen_for_school_user_refund_day.go View File

@@ -109,3 +109,12 @@ type CentralKitchenForSchoolUserRefundDayWithData struct {
func (CentralKitchenForSchoolUserRefundDayWithData) TableName() string {
return "central_kitchen_for_school_user_refund_day"
}

type CentralKitchenForSchoolUserWithDayWithCentralKitchenForSchoolUserRefundDay struct {
model.CentralKitchenForSchoolUserRefundDay `xorm:"extends"`
model.CentralKitchenForSchoolUserWithDay `xorm:"extends"`
}

func (CentralKitchenForSchoolUserWithDayWithCentralKitchenForSchoolUserRefundDay) TableName() string {
return "central_kitchen_for_school_user_with_day"
}

+ 22
- 4
app/db/db_central_kitchen_for_school_user_with_day.go View File

@@ -38,12 +38,30 @@ func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb
return &m, nil
}

func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) FindCentralKitchenForSchoolUserWithDayByOrdNo(ordNo string) (*[]model.CentralKitchenForSchoolUserWithDay, error) {
var m []model.CentralKitchenForSchoolUserWithDay
if err := centralKitchenForSchoolUserWithDayDb.Db.Where("ord_no =?", ordNo).Desc("id").Find(&m); err != nil {
func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) FindCentralKitchenForSchoolUserWithDayByOrdNo(ordNo string) ([]map[string]interface{}, error) {
var m []*CentralKitchenForSchoolUserRefundDayWithCentralKitchenForSchoolUserWithDay
if err := centralKitchenForSchoolUserWithDayDb.Db.Where("central_kitchen_for_school_user_with_day.ord_no =?", ordNo).
Join("LEFT", "central_kitchen_for_school_user_refund_day", "central_kitchen_for_school_user_refund_day.records_id = central_kitchen_for_school_user_with_day.id").
Desc("central_kitchen_for_school_user_refund_day.id").
Find(&m); err != nil {
return nil, logx.Error(err)
}
return &m, nil
var resp []map[string]interface{}
for _, v := range m {
resp = append(resp, map[string]interface{}{
"id": v.CentralKitchenForSchoolUserWithDay.Id,
"ord_no": v.CentralKitchenForSchoolUserWithDay.OrdNo,
"uid": v.CentralKitchenForSchoolUserWithDay.Uid,
"enterprise_id": v.CentralKitchenForSchoolUserWithDay.EnterpriseId,
"identity_id": v.CentralKitchenForSchoolUserWithDay.IdentityId,
"kind": v.CentralKitchenForSchoolUserWithDay.Kind,
"amount": v.CentralKitchenForSchoolUserWithDay.Amount,
"date": v.CentralKitchenForSchoolUserWithDay.Date,
"state": v.CentralKitchenForSchoolUserWithDay.State,
"refund_date": v.CentralKitchenForSchoolUserRefundDay.RefundDate,
})
}
return resp, nil
}

func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CountCentralKitchenForSchoolUserWithDayByOrdNo(ordNo string, state int) (count int64, err error) {


Loading…
Cancel
Save