package com.chinasofti.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.chinasofti.domain.Admin;
import com.chinasofti.util.ConnectionUtil;

public class AdminDao {
	public Admin queryAdmin(Admin Admin){
		String sql = "select * from administrator where admin_username = ?";
		Connection conn = ConnectionUtil.getConection();
		PreparedStatement ps = null;
		try {
			ps = conn.prepareStatement(sql);
			ps.setObject(1, Admin.getAdmin_username());
			ResultSet rs = ps.executeQuery();
			Admin u = null;
			if(rs.next()){
				Integer admin_id = rs.getInt("admin_id");
				String admin_username = rs.getString("admin_username");
				String admin_password = rs.getString("admin_password");
				//u = new Staff(p_id, p_name, sex, degree, department, position, state, user_name,user_password);
				u=new Admin(admin_id,admin_username,admin_password);
			}
			if(u.getAdmin_password().equals(Admin.getAdmin_password())){
				return u;
			}else{
				return null;
			}
		} catch (SQLException e) {
			e.printStackTrace();
			return null;
		}
	}
}
最近下载更多
123krunn  LV2 2023年7月8日
DeFywOo  LV4 2022年12月5日
苏沐秋  LV1 2022年6月8日
zxcvbnmjs  LV1 2022年5月19日
mepan01  LV2 2021年12月23日
2030249830  LV1 2021年9月18日
暗魇123456  LV1 2021年6月29日
haoshuai123  LV1 2021年6月21日
 LV10 2021年6月12日
冰摇呆桃绿茶  LV1 2021年6月7日
最近浏览更多
1159572424 3月11日
暂无贡献等级
hxy19991216  LV4 2023年12月30日
音乐节 2023年12月13日
暂无贡献等级
大道至简  LV13 2023年11月3日
haotzy  LV3 2023年10月8日
2036495585  LV9 2023年9月20日
lingleng  LV2 2023年8月28日
123krunn  LV2 2023年7月8日
huangtian  LV3 2023年6月24日
lhlhlhlh55 2023年6月13日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友