task_logistics_dao.go 480 B

123456789101112131415161718192021
  1. package dao
  2. import (
  3. "errors"
  4. "gorm.io/gorm"
  5. "youngee_b_api/app/entity"
  6. )
  7. type TaskLogisticsDao struct{}
  8. func (d TaskLogisticsDao) SelectTaskLogistics(taskId string) (*entity.TaskLogistics, error) {
  9. var taskLogistics *entity.TaskLogistics
  10. err := Db.Model(&entity.TaskLogistics{}).Where("task_id = ?", taskId).Find(&taskLogistics).Error
  11. if err != nil {
  12. if errors.Is(err, gorm.ErrRecordNotFound) {
  13. return nil, nil
  14. }
  15. return nil, err
  16. }
  17. return taskLogistics, nil
  18. }