package com.iamberry.wechat.service.admin;
import java.util.List;

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

import com.iamberry.wechat.core.entity.admin.AdminChildHavePermission;
import com.iamberry.wechat.face.admin.AdminPermissionsService;
import com.iamberry.wechat.service.admin.dao.AdminPermissionsDAO;


@Service
public class AdminPermissionsServiceImpl implements AdminPermissionsService{
	@Autowired
	private AdminPermissionsDAO adminpermissionsdao;
	public void setAdminPermissionsDAO(AdminPermissionsDAO adminpermissionsdao) {
		this.adminpermissionsdao = adminpermissionsdao;
	}
	
	/**
	 * 根据二级管理ID，获取此二级管理员所有的权限
	 */
	public List<AdminChildHavePermission> selectPermissionById(Integer id) {
		// TODO Auto-generated method stub
		return adminpermissionsdao.selectPermissionById(id);
	}

	/**
	 * 根据二级管理ID，保存二级管理员权限
	 */
	public Integer insertPermissionById(AdminChildHavePermission adminChildHavePermission) {
		// TODO Auto-generated method stub
		return adminpermissionsdao.insertPermissionById(adminChildHavePermission);
	}

	/**
	 * 根据二级管理ID，删除所有二级权限
	 * @param id
	 * @return
	 */
	public Integer deletePermissionById(Integer adminChildId) {
		// TODO Auto-generated method stub
		return adminpermissionsdao.deletePermissionById(adminChildId);
	}
}
