附近小店
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

db_printer_detail.go 660 B

1 개월 전
1234567891011121314151617181920212223242526272829
  1. package db
  2. import (
  3. "applet/app/db/model"
  4. "xorm.io/xorm"
  5. )
  6. func DetailInsert(Db *xorm.Engine, data *model.CommunityTeamStorePrinterDetail) (int64, error) {
  7. affected, err := Db.InsertOne(data)
  8. if err != nil {
  9. return 0, err
  10. }
  11. return affected, nil
  12. }
  13. func DetailUpdate(Db *xorm.Engine, id interface{}, data *model.CommunityTeamStorePrinterDetail, forceColums ...string) (int64, error) {
  14. var (
  15. affected int64
  16. err error
  17. )
  18. if forceColums != nil {
  19. affected, err = Db.Where("id=?", id).Cols(forceColums...).Update(data)
  20. } else {
  21. affected, err = Db.Where("id=?", id).Update(data)
  22. }
  23. if err != nil {
  24. return 0, err
  25. }
  26. return affected, nil
  27. }