附近小店
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.
 
 
 

30 line
660 B

  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. }