1 Star 0 Fork 4

eaglesinchina/shopping

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
AdminDao.java 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
package com.dhxy.dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import com.dhxy.entity.Admin;
/**
* 管理员
* @author Administrator
*
*/
public class AdminDao extends DataBaseDao {
public List<Admin> chaoxun() throws ClassNotFoundException, SQLException {
load();
List<Admin> arrayList = new ArrayList();
ResultSet rs = stmt.executeQuery("SELECT * FROM Admin;");// mysql语句
Admin admin = null;
while (rs.next()) {
admin = new Admin();
admin.setAnumber(rs.getInt("anumber"));
admin.setAname(rs.getString("aname"));
admin.setApassword(rs.getString("apassword"));
admin.setAphontnumber(rs.getInt("aphontnumber"));
arrayList.add(admin);
}
closeAll();
return arrayList;
}
public int tj(Admin admin) throws ClassNotFoundException, SQLException {
String aname = admin.getAname();
String apassword = admin.getApassword();
int aphonenumber = admin.getAphontnumber();
String str = "INSERT INTO Admin(aname,apassword,aphonenumber) VALUES(?,?,?);";
return super.addAll(str, aname, apassword, aphonenumber);
}
public void sc() throws ClassNotFoundException, SQLException {
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/github-32092740/shopping.git
git@gitee.com:github-32092740/shopping.git
github-32092740
shopping
shopping
master

搜索帮助