|  | @@ -237,17 +237,15 @@ func (s *StoreEntry) SystemDeptTree(ctx context.Context, req *pasturePb.SearchDe
 | 
	
		
			
				|  |  |  		return nil, xerr.Customf("请先将该用户绑定牧场!谢谢!")
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	pastureIds := currentUser.GetPastureIds()
 | 
	
		
			
				|  |  | -	systemDeptList := make([]*model.SystemDept, 0)
 | 
	
		
			
				|  |  | +	userModel, err := s.GetUserModel(ctx)
 | 
	
		
			
				|  |  | +	if err != nil {
 | 
	
		
			
				|  |  | +		return nil, xerr.WithStack(err)
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +	systemDeptList := make([]*model.SystemDept, 0)
 | 
	
		
			
				|  |  |  	pref := s.DB.Model(new(model.SystemDept)).
 | 
	
		
			
				|  |  | -		Where("is_delete = ?", pasturePb.IsShow_Ok)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	if req.PastureId > 0 {
 | 
	
		
			
				|  |  | -		pref.Where("pasture_id = ?", req.PastureId)
 | 
	
		
			
				|  |  | -	} else {
 | 
	
		
			
				|  |  | -		pref.Where("pasture_id IN ?", pastureIds)
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | +		Where("is_delete = ?", pasturePb.IsShow_Ok).
 | 
	
		
			
				|  |  | +		Where("pasture_id = ?", userModel.AppPasture.Id)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	if req.Name != "" {
 | 
	
		
			
				|  |  |  		pref.Where("name like ?", fmt.Sprintf("%s%s%s", "%", req.Name, "%"))
 | 
	
	
		
			
				|  | @@ -262,7 +260,7 @@ func (s *StoreEntry) SystemDeptTree(ctx context.Context, req *pasturePb.SearchDe
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	if req.Name != "" {
 | 
	
		
			
				|  |  | -		parentDepths, err := s.findAllParentDepths(ctx, systemDeptList, pastureIds)
 | 
	
		
			
				|  |  | +		parentDepths, err := s.findAllParentDepths(ctx, systemDeptList, []int32{int32(userModel.AppPasture.Id)})
 | 
	
		
			
				|  |  |  		if err != nil {
 | 
	
		
			
				|  |  |  			return nil, xerr.WithStack(err)
 | 
	
		
			
				|  |  |  		}
 |