/**
 * Copyright &copy; 2013-2017 <a href="http://www.rhcncpa.com/">瑞华会计师事务所</a> All rights reserved.
 */
package com.jeeplus.modules.sys.dao;

import com.jeeplus.common.persistence.CrudDao;
import com.jeeplus.common.persistence.annotation.MyBatisDao;
import com.jeeplus.modules.sys.entity.Office;
import com.jeeplus.modules.sys.entity.Role;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 岗位DAO接口
 * @author jeeplus
 * @version 2013-12-05
 */
@MyBatisDao
public interface RoleDao extends CrudDao<Role> {

	public Role getByName(Role role);

	public Role getByEnname(Role role);

	public Integer getByGlyCount(Role role);
	public Integer getMaxNumberByOffice(Role role);

	//获取岗位和角色的关联关系
	public Role getByRoleActivity(Role role);
	//获取岗位和角色的关联关系
	public List<Role> getActivityByRole(Role role);

	public List<Role> getRoleListByCompanys(Role role);

	/**
	 * 维护岗位与菜单权限关系
	 * @param role
	 * @return
	 */
	public int deleteRoleMenu(Role role);

	public int insertRoleMenu(Role role);
	public int deleteRoleActivity(Role role);
	public int deleteRoleActivityOne(@Param("id")String id, @Param("roleActivityId")String roleActivityId);
	public List<Role> getRolesByMenu(@Param("userId")String userId, @Param("menuId")String menuId, @Param("companyId")String companyId);
	public int insertRoleActivity(Role role);

	/**
	/**
	 * 维护岗位与公司部门关系
	 * @param role
	 * @return
	 */

	public int deleteUserRole(Role role);
	public List<Role> findRoleList(Role role);
	public List<Role> findListRole(Role role);

	/**
	 * 根据公司id和用户id获取用户对应的岗位信息
	 * @param id 用户id
	 * @param comId  公司id
	 * @return
	 */
	public List<Role> checkRole(String id, String comId);

	public Role getMenuList(String id);


	public String queryMasterByEnameAndOfficeId(Map<Object,Object> map);
	public int findUserRoleCount(Role role);

	//根据角色别名获取岗位
	public List<Role> getByRoleActivityEnname(Role role);

	public List<Role> getRoleByCompanyId(@Param("roleId")String roleId,@Param("companyId")String companyId);
	//部门调整用
	public Role getRoleByOfficeId(Role role);

    void deleteByOffice(Office office);

	//获取当前登录人管理员岗位
	public List<Role> getManagerRoleList(@Param("userId") String userId,@Param("companyId") String companyId);
}
