cust_customer_belong.go 953 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package cust
  2. import (
  3. "context"
  4. "github.com/gogf/gf/errors/gerror"
  5. "github.com/gogf/gf/frame/g"
  6. "dashoo.cn/micro/app/dao/cust"
  7. model "dashoo.cn/micro/app/model/cust"
  8. "dashoo.cn/micro/app/service"
  9. )
  10. type customerbelongService struct {
  11. *service.ContextService
  12. Dao *cust.CustCustomerBelongDao
  13. }
  14. func NewCustomerBelongService(ctx context.Context) (svc *customerbelongService, err error) {
  15. svc = new(customerbelongService)
  16. if svc.ContextService, err = svc.Init(ctx); err != nil {
  17. return nil, err
  18. }
  19. svc.Dao = cust.NewCustCustomerBelongDao(svc.Tenant)
  20. return svc, nil
  21. }
  22. //获取客户归属信息
  23. func (c *customerbelongService) GetEntityById(CustId int) (Info []*model.CustomerBelongInfo, err error) {
  24. Model := c.Dao.M
  25. err = Model.Where(c.Dao.Columns.CustId, CustId).Where(c.Dao.Columns.DeletedTime + " is null ").Scan(&Info)
  26. if err != nil {
  27. g.Log().Error(err)
  28. err = gerror.New("获取联系人信息失败")
  29. return
  30. }
  31. return
  32. }