首页>代码>java web学生信息管理系统 >/StudentManagerWeb/src/com/ischoolbar/programmer/dao/AdminDao.java
package com.ischoolbar.programmer.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.ischoolbar.programmer.model.Admin;
import com.ischoolbar.programmer.model.Clazz;

/**
 * 
 * @author llq
 *管理员数据库操作封装
 */
public class AdminDao extends BaseDao {
	
	public Admin login(String name ,String password){
		String sql = "select * from s_admin where name = '" + name + "' and password = '" + password + "'";
		ResultSet resultSet = query(sql);
		try {
			if(resultSet.next()){
				Admin admin = new Admin();
				admin.setId(resultSet.getInt("id"));
				admin.setName(resultSet.getString("name"));
				admin.setPassword(resultSet.getString("password"));
				admin.setStatus(resultSet.getInt("status"));
				return admin;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
	public boolean editPassword(Admin admin,String newPassword) {
		// TODO Auto-generated method stub
		String sql = "update s_admin set password = '"+newPassword+"' where id = " + admin.getId();
		return update(sql);
	}
}
最近下载更多
李清清  LV2 2024年11月6日
lxm2440226414  LV2 2024年6月10日
云着殇  LV9 2024年6月5日
lzx602  LV3 2024年4月15日
微信网友_6906962132258816  LV7 2024年3月16日
zhangjilu  LV18 2024年1月1日
磊哥哥哥哥  LV13 2023年12月26日
heweimin  LV13 2023年12月12日
hapilong  LV6 2023年12月11日
蹇金金  LV7 2023年10月31日
最近浏览更多
xianyu091012  LV5 2024年12月26日
言123456 2024年12月24日
暂无贡献等级
3375276400 2024年12月24日
暂无贡献等级
TTThai  LV1 2024年12月17日
微信网友_7298641941385216 2024年12月16日
暂无贡献等级
Daima000  LV4 2024年12月5日
李清清  LV2 2024年11月6日
送你一张  LV1 2024年10月28日
krispeng  LV14 2024年9月10日
nurxshat_outl 2024年7月3日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友