package com.cyksj.service.mange.cms.service.impl;

import com.cyksj.model.views.CmsUserVO;
import com.cyksj.service.mange.cms.service.CmsUserService;
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;

/**
 * 项目名: yhlxj
 * 文件名: CmsUserServiceImpl
 * 创建者: JavaZou
 * 创建时间:2024/3/1 13:50
 */
@Service
@RequiredArgsConstructor
public class CmsUserServiceImpl implements CmsUserService {
	private final BeanSearcher beanSearcher;

	@Override
	public Boolean isRootRole(long adminId) {
		CmsUserVO root = beanSearcher.searchFirst(CmsUserVO.class, MapUtils.builder()
				.field(CmsUserVO::getId, adminId)
				.field(CmsUserVO::getRoleNames, "root").op(Operator.Contain)
				.build());
		return root != null ? true : false;
	}
}
