package com.njcn.serviceimpl.user;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import com.njcn.enums.RoleGroupEnum;
import org.springframework.stereotype.Service;

import com.njcn.mapper.user.RoleGroupMapper;
import com.njcn.pojo.user.Role;
import com.njcn.pojo.user.RoleGroup;
import com.njcn.service.user.RoleGroupService;

import tk.mybatis.mapper.entity.Example;
@Service
public class RoleGroupServiceImpl implements RoleGroupService  {
	@Resource
	RoleGroupMapper rgm;   
	@Override
	public int insertRole(RoleGroup role) {
		// TODO Auto-generated method stub
		return rgm.insertRole(role);
	}

	@Override
	public int deleteRole(RoleGroup role) {
		// TODO Auto-generated method stub
		return rgm.deleteRole(role);
	}

	@Override
	public int updateRole(RoleGroup role) {
		// TODO Auto-generated method stub
		return rgm.updateRole(role);
	}


	@Override
	public RoleGroup selectRoleIndex(String roleIndex) {
		// TODO Auto-generated method stub
		return rgm.selectRoleIndex(roleIndex);
	}

	@Override
	public List<Role> getRoleName(String roleGpIndex,String sysType,List<String> list) {
		
		return rgm.getRoleName(roleGpIndex,sysType,list);
	}

	@Override
	public void deleteByGpIndex(String roleGpIndex,String sysType) {
		rgm.deleteByGpIndex(roleGpIndex,sysType);
	}

	@Override
	public void addASS(String userIndex, String index,String sysType) {
		rgm.addASS(userIndex,index,sysType);
	}

	@Override
	public List<RoleGroup> selectAllName(List<String> roleDescription) {
		// TODO Auto-generated method stub
		return rgm.selectAllName(roleDescription);
	}

	@Override
	public List<RoleGroup> selectByExample(Example example) {
		return rgm.selectByExample(example);
	}

	@Override
	public RoleGroup selectOne(RoleGroup rolegp) {
		return rgm.selectOne(rolegp);
	}

	/**
	 * 获取所有管理员角色组
	 */
	@Override
	public List<RoleGroup> getAllManagerRoleGroup() {
		List<String> ManagerRolegroup=new ArrayList<>();
		ManagerRolegroup.add(RoleGroupEnum.SYSTEM.getEname());
		ManagerRolegroup.add(RoleGroupEnum.AUDIT.getEname());
		ManagerRolegroup.add(RoleGroupEnum.CHECK.getEname());
		ManagerRolegroup.add(RoleGroupEnum.BUSINESS.getEname());
		return rgm.getAllManagerRoleGroup(ManagerRolegroup);
	}

}
