package cn.bsystem.ptlogin.service;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.datasource.DS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.bsystem.ptlogin.dao.LoginDAO;
import cn.bsystem.ptuserrole.model.PtyhBean;

@Service("loginService")
public class LoginService {
	
	@Autowired
	private LoginDAO dao;
	
	/*public void updateLastLoginTime(String adminName) throws Exception {
		getDao().updateLastLoginTime(adminName);
	}*/
	/***
	 * 查询登录机构  
	 * @throws SQLException 
	 */

	public List selectUserRole(Map map) throws SQLException{
		return dao.selectUserRole(map);
	}
	/***
	 * 查询登录用户 
	 * @throws SQLException 
	 */

	public List selectUser(Map map) throws SQLException{
		return dao.selectUser(map);
	}
	/***
	 * 验证账号密码 
	 * @throws SQLException 
	 */
	public PtyhBean userloginValidation(Map map) throws SQLException{
		Map account = new HashMap();
		account.put("yhzh", map.get("yhzh"));
		return dao.selectUserInfo(account);
	}
	/***
	 * 查询登录用户信息 
	 * @throws SQLException 
	 */

	public PtyhBean selectUserInfo(Map map) throws SQLException{
		PtyhBean user = new PtyhBean();
		user = dao.selectUserInfo(map);
		return user;
	}
	/***
	 * 修改登录密码 
	 * @throws SQLException 
	 */
	public int updatePasswd(Map map) throws SQLException{
		return dao.updatePasswd(map);
	}
}
