sectask_logistics.go 682 B

1234567891011121314151617181920212223242526272829
  1. package db
  2. import (
  3. "context"
  4. "youngee_m_api/model/gorm_model"
  5. )
  6. func CreateSecTaskLogistics(ctx context.Context, logistics gorm_model.YoungeeTaskLogistics) (*int64, error) {
  7. db := GetWriteDB(ctx)
  8. err := db.Create(&logistics).Error
  9. if err != nil {
  10. return nil, err
  11. }
  12. return &logistics.LogisticsID, nil
  13. }
  14. func UpdateSecTaskLogistics(ctx context.Context, updateData gorm_model.YoungeeTaskLogistics) (*int64, error) {
  15. db := GetWriteDB(ctx)
  16. whereCondition := gorm_model.YoungeeTaskLogistics{
  17. LogisticsID: updateData.LogisticsID,
  18. }
  19. err := db.Where(whereCondition).Updates(&updateData).Error
  20. if err != nil {
  21. return nil, err
  22. }
  23. return &updateData.LogisticsID, nil
  24. }