package com.iamberry.wechat.service.admin.dao.impl;

import java.util.List;

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

import com.iamberry.wechat.core.entity.PaperBean;
import com.iamberry.wechat.core.entity.admin.AdminChildInfo;
import com.iamberry.wechat.core.entity.admin.AdminInfo;
import com.iamberry.wechat.service.admin.dao.AdminAdministratorDAO;
import com.iamberry.wechat.service.mapper.AdminInfoMapper;

@Repository
public class AdminAdministratorDAOImpl implements AdminAdministratorDAO{
	@Autowired
	private AdminInfoMapper adminInfoMapper;
	public void setAdminInfoMapper(AdminInfoMapper adminInfoMapper) {
		this.adminInfoMapper = adminInfoMapper;
	}

	/**
	 * 新增二級管理員
	 */
	@Override
	public void insertadmin(AdminChildInfo adminchildinfo){
		adminInfoMapper.insertadmin(adminchildinfo);
	}
	/**
	 * 根據用戶名查詢是否有重複用戶
	 */
	@Override
	public AdminChildInfo selectAdminChildInfoByName(String adminLoginName){
		// TODO Auto-generated method stub
		return adminInfoMapper.selectAdminChildInfoByName(adminLoginName);
	}
	/**
	 * 查詢所有二級管理員
	 */
	@Override
	public List<AdminChildInfo> selectAdminChildInfoByList(PaperBean bean) {
		// TODO Auto-generated method stub
		return adminInfoMapper.selectAdminChildInfoByList(bean);
	}
/**
 * 模糊查询
 */
	@Override
	public List<AdminChildInfo> selectAdminChildInfoByNameList(PaperBean bean) {
		// TODO Auto-generated method stub
		return adminInfoMapper.selectAdminChildInfoByNameList(bean);
	}
	/**
	 * 删除二级管理员
	 */
	@Override
	public int deleteAdminChildInfoById(String adminid) {
		// TODO Auto-generated method stub
		return	adminInfoMapper.deleteAdminChildInfoById(adminid);
	}
	
	/**
	 * 根据id查找二级管理员
	 */
	@Override
	public AdminChildInfo selectAdminChildInfoById(String adminid) {
		return adminInfoMapper.selectAdminChildInfoById(adminid);
	}

	/**
	 * 根据id修改二级管理员
	 */
	@Override
	public Integer updateAdminChildInfoById(AdminChildInfo adminchildinfo) {
		return adminInfoMapper.updateAdminChildInfoById(adminchildinfo);
	}

	/**
	 * 根据id修改二级管理员权限
	 */
	@Override
	public Integer updatePermissionsById(String adminid, String adminStatus) {
		// TODO Auto-generated method stub
		return adminInfoMapper.updatePermissionsById(adminid,adminStatus);
	}

	/**
	 * 查询所有二级管理员数量
	 */
	@Override
	public int selectAdminChildInfoByCount() {
		return adminInfoMapper.selectAdminChildInfoByCount();
	}
	
	/**
	 * 模糊查询二级管理员数量
	 */
	@Override
	public int selectAdminChildInfoByNameCount(String adminLoginName) {
		// TODO Auto-generated method stub
		return adminInfoMapper.selectAdminChildInfoByNameCount(adminLoginName);
	}
	/**
	 * 修改二级管理员密码
	 */
	@Override
	public void updateAdminByPwd(AdminChildInfo adminchildinfo) {
		// TODO Auto-generated method stub
		adminInfoMapper.updateAdminByPwd(adminchildinfo);
	}
	/**
	 * 修改超级管理员密码
	 */
	@Override
	public void updateSuperAdminByPwd(AdminInfo admininfo) {
		// TODO Auto-generated method stub
		adminInfoMapper.updateSuperAdminByPwd(admininfo);
	}

	
	
}
