package com.cyksj.service.user.impl;

import com.cyksj.model.views.CmsUserVO;
import com.cyksj.service.user.UserBackService;
import com.ejlchina.searcher.BeanSearcher;
import com.ejlchina.searcher.param.Operator;
import com.ejlchina.searcher.util.MapUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/*
 *项目名: netflix
 *文件名: UserBackServiceImpl
 *创建者: JavaZou
 *创建时间:2023/9/5 12:19
 */
@Service
@RequiredArgsConstructor
public class UserBackServiceImpl implements UserBackService {
	private final BeanSearcher beanSearcher;

	@Override
	public boolean isCustomer(Long adminId) {
		//是不是客服
		CmsUserVO isCustomer = beanSearcher.searchFirst(CmsUserVO.class, MapUtils.builder()
				.field(CmsUserVO::getId, adminId)
				.field(CmsUserVO::getRoleNames, "客服").op(Operator.Contain)
				.build());
		if (isCustomer != null) {
			return true;
		}
		return false;
	}
}
