package com.dcit.authority.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dcit.authority.dao.SysResourcesMapper;
import com.dcit.authority.model.SysResources;
import com.dcit.authority.model.SysResourcesExample;
import com.dcit.authority.service.SysResourcesService;

@Service
public class SysResourcesServiceImpl implements SysResourcesService {
	
	@Autowired
	private SysResourcesMapper sysResourcesMapper;

	@Override
	public List<SysResources> getAuthorityMenusByUid(String uid) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.selectAuthorityMenusByUid(uid);
	}

	@Override
	public List<SysResources> getMenus() {
		// TODO Auto-generated method stub
		return sysResourcesMapper.selectMenus();
	}

	@Override
	public boolean addMenu(SysResources menu) {
		int num = sysResourcesMapper.insertSelective(menu);
        return num == 1 ? Boolean.TRUE : Boolean.FALSE;
	}

	@Override
	public boolean modifyMenu(SysResources menu) {
		int num = sysResourcesMapper.updateByPrimaryKeySelective(menu);
        return num == 1 ? Boolean.TRUE : Boolean.FALSE;
	}

	@Override
	public boolean deleteMenuByMenuId(String menuId) {
		int num = sysResourcesMapper.deleteByPrimaryKey(menuId);
        return num == 1 ? Boolean.TRUE : Boolean.FALSE;
	}

	@Override
	public List<SysResources> getApiTeamList() {
		// TODO Auto-generated method stub
		return sysResourcesMapper.selectApiTeamList();
	}

	@Override
	public List<SysResources> getApiList() {
		// TODO Auto-generated method stub
		return sysResourcesMapper.selectApiList();
	}

	@Override
	public List<SysResources> getApiListByTeamId(String teamId) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.selectApiListByTeamId(teamId);
	}

	@Override
	public List<SysResources> getAuthorityApisByRoleId(String roleId) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.selectApisByRoleId(roleId);
	}

	@Override
	public List<SysResources> getAuthorityMenusByRoleId(String roleId) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.selectMenusByRoleId(roleId);
	}

	@Override
	public List<SysResources> getNotAuthorityApisByRoleId(String roleId) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.selectNotAuthorityApisByRoleId(roleId);
	}

	@Override
	public List<SysResources> getNotAuthorityMenusByRoleId(String roleId) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.selectNotAuthorityMenusByRoleId(roleId);
	}

	@Override
	public int countByExample(SysResourcesExample example) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.countByExample(example);
	}

	@Override
	public int deleteByExample(SysResourcesExample example) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.deleteByExample(example);
	}

	@Override
	public int deleteByPrimaryKey(String id) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(SysResources record) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.insert(record);
	}

	@Override
	public int insertSelective(SysResources record) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.insertSelective(record);
	}

	@Override
	public List<SysResources> selectByExample(SysResourcesExample example) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.selectByExample(example);
	}

	@Override
	public SysResources selectByPrimaryKey(String id) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.selectByPrimaryKey(id);
	}

	@Override
	public int updateByExampleSelective(SysResources record, SysResourcesExample example) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.updateByExampleSelective(record, example);
	}

	@Override
	public int updateByExample(SysResources record, SysResourcesExample example) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.updateByExample(record, example);
	}

	@Override
	public int updateByPrimaryKeySelective(SysResources record) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(SysResources record) {
		// TODO Auto-generated method stub
		return sysResourcesMapper.updateByPrimaryKey(record);
	}

}
