资源简介
本系统比较容易理解,适合初学者,作为大学毕业论文,拿出来分享一下
代码片段和文件信息
package dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import util.Pages;
import util.getCon;
import domain.Charge;
import domain.People;
public class Chargedao {
public List findAll(Pages page) {
List list=new ArrayList();
Connection con=getCon.getConnection();
PreparedStatement pst = null;
ResultSet rs=null;
String sql=“c.idc.ridc.moneyr.rname from charge ctb_role r where c.rid=r.rid“;
sql=page.wrapSqlTotal(sql “c.id“ con null);
try {
pst = con.prepareStatement(sql);
rs = pst.executeQuery();
while(rs.next()){
Charge c=new Charge();
c.setId(rs.getInt(“id“));
c.setMoney(rs.getString(“money“));
c.setRid(rs.getInt(“rid“));
c.setRname(rs.getString(“rname“));
list.add(c);
}
return list;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
try {
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
public Charge findById(int id) {
Connection con=getCon.getConnection();
PreparedStatement pst = null;
ResultSet rs=null;
String sql=“select * from charge where id=?“;
try {
pst=con.prepareStatement(sql);
pst.setInt(1 id);
rs=pst.executeQuery();
if(rs.next()){
Charge c=new Charge();
c.setId(rs.getInt(“id“));
c.setMoney(rs.getString(“money“));
return c;
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return null;
}
public boolean update(String id String money) {
Connection con=getCon.getConnection();
PreparedStatement pst = null;
String sql=“update charge set money=? where id=?“;
try {
pst = con.prepareStatement(sql);
pst.setString(1 money);
pst.setInt(2 Integer.parseInt(id));
pst.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}finally{
try {
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return true;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-04-16 10:44 Heating\
文件 838 2015-04-16 10:44 Heating\.classpath
文件 1040 2015-04-16 10:44 Heating\.project
目录 0 2015-04-16 10:44 Heating\.settings\
文件 503 2015-04-16 10:44 Heating\.settings\.jsdtscope
文件 364 2015-04-16 10:44 Heating\.settings\org.eclipse.jdt.core.prefs
文件 475 2015-04-16 10:44 Heating\.settings\org.eclipse.wst.common.component
文件 349 2015-04-16 10:44 Heating\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2015-04-16 10:44 Heating\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2015-04-16 10:44 Heating\.settings\org.eclipse.wst.jsdt.ui.superType.name
目录 0 2015-04-16 10:44 Heating\build\
目录 0 2015-04-20 18:56 Heating\build\classes\
目录 0 2015-04-20 18:56 Heating\build\classes\dao\
文件 3890 2015-04-20 18:56 Heating\build\classes\dao\Chargedao.class
文件 3747 2015-04-20 18:56 Heating\build\classes\dao\Menudao.class
文件 6578 2015-05-09 22:12 Heating\build\classes\dao\Owedao.class
文件 6607 2015-04-20 18:56 Heating\build\classes\dao\Peopledao.class
文件 4017 2015-05-10 20:57 Heating\build\classes\dao\Recorddao.class
文件 5888 2015-04-20 18:56 Heating\build\classes\dao\Roledao.class
文件 9075 2015-05-09 21:33 Heating\build\classes\dao\Userdao.class
目录 0 2015-04-20 18:56 Heating\build\classes\domain\
文件 1067 2015-04-20 18:56 Heating\build\classes\domain\Charge.class
文件 868 2015-04-20 18:56 Heating\build\classes\domain\DefectStatistic.class
文件 1486 2015-04-20 18:56 Heating\build\classes\domain\menu.class
文件 808 2015-04-20 18:56 Heating\build\classes\domain\MenuComparator.class
文件 1819 2015-04-20 18:56 Heating\build\classes\domain\Owe.class
文件 1807 2015-04-20 18:56 Heating\build\classes\domain\People.class
文件 1443 2015-04-20 18:56 Heating\build\classes\domain\Record.class
文件 697 2015-04-20 18:56 Heating\build\classes\domain\role.class
文件 700 2015-04-20 18:56 Heating\build\classes\domain\State.class
文件 4317 2015-04-20 18:56 Heating\build\classes\domain\TreeHelper.class
............此处省略1037个文件信息
评论
共有 条评论