DengBiao 11 ay önce
ebeveyn
işleme
28b67c7a83
2 değiştirilmiş dosya ile 156 ekleme ve 34 silme
  1. +78
    -20
      app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go
  2. +78
    -14
      app/admin/svc/enterprise_manage/svc_self_support_for_school.go

+ 78
- 20
app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go Dosyayı Görüntüle

@@ -752,57 +752,114 @@ func CentralKitchenForSchoolOrdStatistics(req md.CentralKitchenForSchoolOrdListR
}
}

sess := db.Db.Desc("central_kitchen_for_school_package_ord.id")
sess1, sess2, sess3, sess4, sess5 := db.Db.Where("1=1"), db.Db.Where("1=1"), db.Db.Where("1=1"), db.Db.Where("1=1"), db.Db.Where("1=1")
if req.EnterpriseId != 0 {
sess.And("central_kitchen_for_school_package_ord.enterprise_id =?", req.EnterpriseId)
sess1.And("central_kitchen_for_school_package_ord.enterprise_id =?", req.EnterpriseId)
sess2.And("central_kitchen_for_school_package_ord.enterprise_id =?", req.EnterpriseId)
sess3.And("central_kitchen_for_school_package_ord.enterprise_id =?", req.EnterpriseId)
sess4.And("central_kitchen_for_school_package_ord.enterprise_id =?", req.EnterpriseId)
sess5.And("central_kitchen_for_school_package_ord.enterprise_id =?", req.EnterpriseId)
}
if req.IsTeacher != 0 {
if req.IsTeacher == 1 {
sess.And("user_identity.identity =?", enum2.UserIdentityForCentralKitchenForTeacher)
sess1.And("user_identity.identity =?", enum2.UserIdentityForCentralKitchenForTeacher)
sess2.And("user_identity.identity =?", enum2.UserIdentityForCentralKitchenForTeacher)
sess3.And("user_identity.identity =?", enum2.UserIdentityForCentralKitchenForTeacher)
sess4.And("user_identity.identity =?", enum2.UserIdentityForCentralKitchenForTeacher)
sess5.And("user_identity.identity =?", enum2.UserIdentityForCentralKitchenForTeacher)
}
if req.IsTeacher == 2 {
sess.And("user_identity.identity !=?", enum2.UserIdentityForCentralKitchenForTeacher)
sess1.And("user_identity.identity !=?", enum2.UserIdentityForCentralKitchenForTeacher)
sess2.And("user_identity.identity !=?", enum2.UserIdentityForCentralKitchenForTeacher)
sess3.And("user_identity.identity !=?", enum2.UserIdentityForCentralKitchenForTeacher)
sess4.And("user_identity.identity !=?", enum2.UserIdentityForCentralKitchenForTeacher)
sess5.And("user_identity.identity !=?", enum2.UserIdentityForCentralKitchenForTeacher)
}
}
if req.StartDate != "" {
sess.And("central_kitchen_for_school_package_ord.create_at >= ?", req.StartDate)
sess1.And("central_kitchen_for_school_package_ord.create_at >= ?", req.StartDate)
sess2.And("central_kitchen_for_school_package_ord.create_at >= ?", req.StartDate)
sess3.And("central_kitchen_for_school_package_ord.create_at >= ?", req.StartDate)
sess4.And("central_kitchen_for_school_package_ord.create_at >= ?", req.StartDate)
sess5.And("central_kitchen_for_school_package_ord.create_at >= ?", req.StartDate)
}
if req.EndDate != "" {
sess.And("central_kitchen_for_school_package_ord.create_at <= ?", req.EndDate)
sess1.And("central_kitchen_for_school_package_ord.create_at <= ?", req.EndDate)
sess2.And("central_kitchen_for_school_package_ord.create_at <= ?", req.EndDate)
sess3.And("central_kitchen_for_school_package_ord.create_at <= ?", req.EndDate)
sess4.And("central_kitchen_for_school_package_ord.create_at <= ?", req.EndDate)
sess5.And("central_kitchen_for_school_package_ord.create_at <= ?", req.EndDate)
}
if req.Kind != 0 {
sess.And("central_kitchen_for_school_package_ord.kind = ?", req.Kind)
sess1.And("central_kitchen_for_school_package_ord.kind = ?", req.Kind)
sess2.And("central_kitchen_for_school_package_ord.kind = ?", req.Kind)
sess3.And("central_kitchen_for_school_package_ord.kind = ?", req.Kind)
sess4.And("central_kitchen_for_school_package_ord.kind = ?", req.Kind)
sess5.And("central_kitchen_for_school_package_ord.kind = ?", req.Kind)
}
if req.Sate != -1 {
sess.And("central_kitchen_for_school_package_ord.state = ?", req.Sate)
sess1.And("central_kitchen_for_school_package_ord.state = ?", req.Sate)
sess2.And("central_kitchen_for_school_package_ord.state = ?", req.Sate)
sess3.And("central_kitchen_for_school_package_ord.state = ?", req.Sate)
sess4.And("central_kitchen_for_school_package_ord.state = ?", req.Sate)
sess5.And("central_kitchen_for_school_package_ord.state = ?", req.Sate)
}
if req.OrdSate != -1 {
sess.And("central_kitchen_for_school_package_ord.ord_state = ?", req.OrdSate)
sess1.And("central_kitchen_for_school_package_ord.ord_state = ?", req.OrdSate)
sess2.And("central_kitchen_for_school_package_ord.ord_state = ?", req.OrdSate)
sess3.And("central_kitchen_for_school_package_ord.ord_state = ?", req.OrdSate)
sess4.And("central_kitchen_for_school_package_ord.ord_state = ?", req.OrdSate)
sess5.And("central_kitchen_for_school_package_ord.ord_state = ?", req.OrdSate)
}
if req.OutTradeNo != "" {
sess.And("central_kitchen_for_school_package_ord.out_trade_no like ?", "%"+req.OutTradeNo+"%")
sess1.And("central_kitchen_for_school_package_ord.out_trade_no like ?", "%"+req.OutTradeNo+"%")
sess2.And("central_kitchen_for_school_package_ord.out_trade_no like ?", "%"+req.OutTradeNo+"%")
sess3.And("central_kitchen_for_school_package_ord.out_trade_no like ?", "%"+req.OutTradeNo+"%")
sess4.And("central_kitchen_for_school_package_ord.out_trade_no like ?", "%"+req.OutTradeNo+"%")
sess5.And("central_kitchen_for_school_package_ord.out_trade_no like ?", "%"+req.OutTradeNo+"%")
}

if req.Name != "" {
sess.And("user_identity.name like ?", "%"+req.Name+"%")
sess1.And("user_identity.name like ?", "%"+req.Name+"%")
sess2.And("user_identity.name like ?", "%"+req.Name+"%")
sess3.And("user_identity.name like ?", "%"+req.Name+"%")
sess4.And("user_identity.name like ?", "%"+req.Name+"%")
sess5.And("user_identity.name like ?", "%"+req.Name+"%")
}
if req.Phone != "" {
sess.And("user.phone like ?", "%"+req.Phone+"%")
sess1.And("user.phone like ?", "%"+req.Phone+"%")
sess2.And("user.phone like ?", "%"+req.Phone+"%")
sess3.And("user.phone like ?", "%"+req.Phone+"%")
sess4.And("user.phone like ?", "%"+req.Phone+"%")
sess5.And("user.phone like ?", "%"+req.Phone+"%")
}

if req.EnterPriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterPriseKind)
sess1.And("enterprise.kind = ?", req.EnterPriseKind)
sess2.And("enterprise.kind = ?", req.EnterPriseKind)
sess3.And("enterprise.kind = ?", req.EnterPriseKind)
sess4.And("enterprise.kind = ?", req.EnterPriseKind)
sess5.And("enterprise.kind = ?", req.EnterPriseKind)
}

if len(classWithUserIdentityIdsOne) > 0 {
sess.In("user_identity.id", classWithUserIdentityIdsOne)
sess1.In("user_identity.id", classWithUserIdentityIdsOne)
sess2.In("user_identity.id", classWithUserIdentityIdsOne)
sess3.In("user_identity.id", classWithUserIdentityIdsOne)
sess4.In("user_identity.id", classWithUserIdentityIdsOne)
sess5.In("user_identity.id", classWithUserIdentityIdsOne)
}
if len(classWithUserIdentityIdsTwo) > 0 {
sess.In("user_identity.id", classWithUserIdentityIdsTwo)
sess1.In("user_identity.id", classWithUserIdentityIdsTwo)
sess2.In("user_identity.id", classWithUserIdentityIdsTwo)
sess3.In("user_identity.id", classWithUserIdentityIdsTwo)
sess4.In("user_identity.id", classWithUserIdentityIdsTwo)
sess5.In("user_identity.id", classWithUserIdentityIdsTwo)
}

var m []*db.CentralKitchenForSchoolPackageOrdWithUserIdentity
personNum, err = sess.

personNum, err = sess1.
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id").
Join("LEFT", "user", "user.id = user_identity.uid").
@@ -815,7 +872,7 @@ func CentralKitchenForSchoolOrdStatistics(req md.CentralKitchenForSchoolOrdListR
return 0, 0, 0, 0, 0, err
}

orderCountByTerm, err = sess.And("central_kitchen_for_school_package_ord.kind = ?", 1).
orderCountByTerm, err = sess2.And("central_kitchen_for_school_package_ord.kind = ?", 1).
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id").
Join("LEFT", "user", "user.id = user_identity.uid").
@@ -826,7 +883,8 @@ func CentralKitchenForSchoolOrdStatistics(req md.CentralKitchenForSchoolOrdListR
if err != nil {
return 0, 0, 0, 0, 0, err
}
orderCountByMonth, err = sess.And("central_kitchen_for_school_package_ord.kind = ?", 2).

orderCountByMonth, err = sess3.And("central_kitchen_for_school_package_ord.kind = ?", 2).
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id").
Join("LEFT", "user", "user.id = user_identity.uid").
@@ -837,7 +895,7 @@ func CentralKitchenForSchoolOrdStatistics(req md.CentralKitchenForSchoolOrdListR
if err != nil {
return 0, 0, 0, 0, 0, err
}
orderCountByDay, err = sess.And("central_kitchen_for_school_package_ord.kind = ?", 3).
orderCountByDay, err = sess4.And("central_kitchen_for_school_package_ord.kind = ?", 3).
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id").
Join("LEFT", "user", "user.id = user_identity.uid").
@@ -850,7 +908,7 @@ func CentralKitchenForSchoolOrdStatistics(req md.CentralKitchenForSchoolOrdListR
}

var mm db.CentralKitchenForSchoolPackageOrdWithUserIdentity
consumeAmount, err = sess.
consumeAmount, err = sess5.
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id").
Join("LEFT", "user", "user.id = user_identity.uid").


+ 78
- 14
app/admin/svc/enterprise_manage/svc_self_support_for_school.go Dosyayı Görüntüle

@@ -703,47 +703,111 @@ func SelfSupportForSchoolOrdStatistics(req md.SelfSupportForSchoolOrdListReq) (p
}
}

sess := db.Db.Desc("self_support_for_school_ord.id")
sess1 := db.Db.Where("1=1")
sess2 := db.Db.Where("1=1")
sess3 := db.Db.Where("1=1")
sess4 := db.Db.Where("1=1")
sess5 := db.Db.Where("1=1")
sess6 := db.Db.Where("1=1")
if req.EnterpriseId != 0 {
sess.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId)
sess1.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId)
sess2.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId)
sess3.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId)
sess4.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId)
sess5.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId)
sess6.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId)
}
if req.StartDate != "" {
sess.And("self_support_for_school_ord.face_time >= ?", req.StartDate)
sess1.And("self_support_for_school_ord.face_time >= ?", req.StartDate)
sess2.And("self_support_for_school_ord.face_time >= ?", req.StartDate)
sess3.And("self_support_for_school_ord.face_time >= ?", req.StartDate)
sess4.And("self_support_for_school_ord.face_time >= ?", req.StartDate)
sess5.And("self_support_for_school_ord.face_time >= ?", req.StartDate)
sess6.And("self_support_for_school_ord.face_time >= ?", req.StartDate)
}
if req.EndDate != "" {
sess.And("self_support_for_school_ord.face_time <= ?", req.EndDate)
sess1.And("self_support_for_school_ord.face_time <= ?", req.EndDate)
sess2.And("self_support_for_school_ord.face_time <= ?", req.EndDate)
sess3.And("self_support_for_school_ord.face_time <= ?", req.EndDate)
sess4.And("self_support_for_school_ord.face_time <= ?", req.EndDate)
sess5.And("self_support_for_school_ord.face_time <= ?", req.EndDate)
sess6.And("self_support_for_school_ord.face_time <= ?", req.EndDate)
}
if req.OrderStatus != 0 {
sess.And("self_support_for_school_ord.order_status = ?", req.OrderStatus)
sess1.And("self_support_for_school_ord.order_status = ?", req.OrderStatus)
sess2.And("self_support_for_school_ord.order_status = ?", req.OrderStatus)
sess3.And("self_support_for_school_ord.order_status = ?", req.OrderStatus)
sess4.And("self_support_for_school_ord.order_status = ?", req.OrderStatus)
sess5.And("self_support_for_school_ord.order_status = ?", req.OrderStatus)
sess6.And("self_support_for_school_ord.order_status = ?", req.OrderStatus)
}
if req.OutTradeNo != "" {
sess.And("self_support_for_school_ord.out_order_no like ?", "%"+req.OutTradeNo+"%")
sess1.And("self_support_for_school_ord.out_order_no like ?", "%"+req.OutTradeNo+"%")
sess2.And("self_support_for_school_ord.out_order_no like ?", "%"+req.OutTradeNo+"%")
sess3.And("self_support_for_school_ord.out_order_no like ?", "%"+req.OutTradeNo+"%")
sess4.And("self_support_for_school_ord.out_order_no like ?", "%"+req.OutTradeNo+"%")
sess5.And("self_support_for_school_ord.out_order_no like ?", "%"+req.OutTradeNo+"%")
sess6.And("self_support_for_school_ord.out_order_no like ?", "%"+req.OutTradeNo+"%")
}
if req.EnterpriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterpriseKind)
sess1.And("enterprise.kind = ?", req.EnterpriseKind)
sess2.And("enterprise.kind = ?", req.EnterpriseKind)
sess3.And("enterprise.kind = ?", req.EnterpriseKind)
sess4.And("enterprise.kind = ?", req.EnterpriseKind)
sess5.And("enterprise.kind = ?", req.EnterpriseKind)
sess6.And("enterprise.kind = ?", req.EnterpriseKind)
}
if req.IsTeacher != 0 {
if req.IsTeacher == 1 {
sess.And("user_identity.identity =?", enum2.UserIdentityForCentralKitchenForTeacher)
sess1.And("user_identity.identity =?", enum2.UserIdentityForCentralKitchenForTeacher)
sess2.And("user_identity.identity =?", enum2.UserIdentityForCentralKitchenForTeacher)
sess3.And("user_identity.identity =?", enum2.UserIdentityForCentralKitchenForTeacher)
sess4.And("user_identity.identity =?", enum2.UserIdentityForCentralKitchenForTeacher)
sess5.And("user_identity.identity =?", enum2.UserIdentityForCentralKitchenForTeacher)
sess6.And("user_identity.identity =?", enum2.UserIdentityForCentralKitchenForTeacher)
}
if req.IsTeacher == 2 {
sess.And("user_identity.identity !=?", enum2.UserIdentityForCentralKitchenForTeacher)
sess1.And("user_identity.identity !=?", enum2.UserIdentityForCentralKitchenForTeacher)
sess2.And("user_identity.identity !=?", enum2.UserIdentityForCentralKitchenForTeacher)
sess3.And("user_identity.identity !=?", enum2.UserIdentityForCentralKitchenForTeacher)
sess4.And("user_identity.identity !=?", enum2.UserIdentityForCentralKitchenForTeacher)
sess5.And("user_identity.identity !=?", enum2.UserIdentityForCentralKitchenForTeacher)
sess6.And("user_identity.identity !=?", enum2.UserIdentityForCentralKitchenForTeacher)
}
}

if req.Name != "" {
sess.And("user_identity.name like ?", "%"+req.Name+"%")
sess1.And("user_identity.name like ?", "%"+req.Name+"%")
sess2.And("user_identity.name like ?", "%"+req.Name+"%")
sess3.And("user_identity.name like ?", "%"+req.Name+"%")
sess4.And("user_identity.name like ?", "%"+req.Name+"%")
sess5.And("user_identity.name like ?", "%"+req.Name+"%")
sess6.And("user_identity.name like ?", "%"+req.Name+"%")
}
if req.Phone != "" {
sess.And("user.phone like ?", "%"+req.Phone+"%")
sess1.And("user.phone like ?", "%"+req.Phone+"%")
sess2.And("user.phone like ?", "%"+req.Phone+"%")
sess3.And("user.phone like ?", "%"+req.Phone+"%")
sess4.And("user.phone like ?", "%"+req.Phone+"%")
sess5.And("user.phone like ?", "%"+req.Phone+"%")
sess6.And("user.phone like ?", "%"+req.Phone+"%")
}
if len(classWithUserIdentityIdsOne) > 0 {
sess.In("user_identity.id", classWithUserIdentityIdsOne)
sess1.In("user_identity.id", classWithUserIdentityIdsOne)
sess2.In("user_identity.id", classWithUserIdentityIdsOne)
sess3.In("user_identity.id", classWithUserIdentityIdsOne)
sess4.In("user_identity.id", classWithUserIdentityIdsOne)
sess5.In("user_identity.id", classWithUserIdentityIdsOne)
sess6.In("user_identity.id", classWithUserIdentityIdsOne)
}
if len(classWithUserIdentityIdsTwo) > 0 {
sess.In("user_identity.id", classWithUserIdentityIdsTwo)
sess1.In("user_identity.id", classWithUserIdentityIdsTwo)
sess2.In("user_identity.id", classWithUserIdentityIdsTwo)
sess3.In("user_identity.id", classWithUserIdentityIdsTwo)
sess4.In("user_identity.id", classWithUserIdentityIdsTwo)
sess5.In("user_identity.id", classWithUserIdentityIdsTwo)
sess6.In("user_identity.id", classWithUserIdentityIdsTwo)
}
var sess1, sess2, sess3, sess4, sess5, sess6 = sess, sess, sess, sess, sess, sess

var m []*db.SelfSupportForSchoolOrdWithUserIdentity
personNum, err = sess1.


Yükleniyor…
İptal
Kaydet