plat_followup_file.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package plat
  2. import (
  3. "context"
  4. "dashoo.cn/opms_libary/myerrors"
  5. "github.com/gogf/gf/frame/g"
  6. "dashoo.cn/micro/app/dao/plat"
  7. model "dashoo.cn/micro/app/model/plat"
  8. "dashoo.cn/micro/app/service"
  9. )
  10. type followupFileService struct {
  11. *service.ContextService
  12. Dao *plat.PlatFollowupFileDao
  13. }
  14. func NewFollowupFileService(ctx context.Context) (svc *followupFileService, err error) {
  15. svc = new(followupFileService)
  16. if svc.ContextService, err = svc.Init(ctx); err != nil {
  17. return nil, err
  18. }
  19. svc.Dao = plat.NewPlatFollowupFileDao(svc.Tenant)
  20. return svc, nil
  21. }
  22. // 跟进记录附件信息列表
  23. func (s *followupFileService) GetList(req *model.SearchPlatFollowupFileReq) (total int, followupFileList []*model.PlatFollowupFile, err error) {
  24. followupFileModel := s.Dao.M
  25. if req.FollowId != "" {
  26. followupFileModel = followupFileModel.Where("follow_id", req.FollowId)
  27. }
  28. total, err = followupFileModel.Count()
  29. if err != nil {
  30. g.Log().Error(err)
  31. err = myerrors.DbError("获取总行数失败。")
  32. return
  33. }
  34. err = followupFileModel.Order("created_time ASC").Scan(&followupFileList)
  35. return
  36. }