面包店
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

39 lines
809 B

  1. package db
  2. import (
  3. "xorm.io/xorm"
  4. "applet/app/db/model"
  5. "applet/app/utils/logx"
  6. )
  7. // 批量获取信息
  8. func DbsDealOrderUseFindByIds(eg *xorm.Engine, types string, ids []string) (*[]model.DealOrderUser, error) {
  9. var ord []model.DealOrderUser
  10. if err := eg.In("id", ids).
  11. Where("type = ?", types).
  12. Find(&ord); err != nil {
  13. return nil, logx.Error(err)
  14. }
  15. if len(ord) == 0 {
  16. return nil, nil
  17. }
  18. return &ord, nil
  19. }
  20. func DbsDealOrderUserUpdate(eg *xorm.Engine, id int, ord *model.DealOrderUser) error {
  21. if _, err := eg.Where(" `id` = ?", id).AllCols().Update(ord); err != nil {
  22. return logx.Warn(err)
  23. }
  24. return nil
  25. }
  26. func DbsDealOrderUserInsert(eg *xorm.Engine, ord *model.DealOrderUser) bool {
  27. _, err := eg.InsertOne(ord)
  28. if err != nil {
  29. logx.Warn(err)
  30. return false
  31. }
  32. return true
  33. }