|
|
@@ -69,14 +69,18 @@ func NewCustomerService(ctx context.Context) (svc *CustomerService, err error) {
|
|
|
// GetList 客户列表列表
|
|
|
func (s *CustomerService) GetList(req *model.CustCustomerSearchReq) (total int, customerList []*model.CustList, err error) {
|
|
|
Model := s.Dao.DataScope(s.Ctx, "sales_id")
|
|
|
- if req.TargetType == "" {
|
|
|
- if !req.IsPublic {
|
|
|
- Model = Model.Where(s.Dao.C.SalesId, s.CxtUser.Id).Where(s.Dao.C.IsPublic, noPublic)
|
|
|
- } else {
|
|
|
-
|
|
|
- Model = Model.Where(s.Dao.C.IsPublic, isPublic)
|
|
|
+ if req.IsPublic {
|
|
|
+ Model = Model.Where(s.Dao.C.IsPublic, isPublic)
|
|
|
+ } else {
|
|
|
+ Model = Model.Where(s.Dao.C.IsPublic, noPublic)
|
|
|
+ if req.TargetType == "self" {
|
|
|
+ Model = Model.Where(s.Dao.C.SalesId, s.CxtUser.Id)
|
|
|
+ }
|
|
|
+ if req.TargetType == "other" {
|
|
|
+ Model = Model.WhereNot(s.Dao.C.SalesId, s.CxtUser.Id)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//客户名称
|
|
|
if req.CustName != "" {
|
|
|
Model = Model.Where(s.Dao.C.CustName+" like ?", "%"+req.CustName+"%")
|