第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

缺了兩個實(shí)體類,兩個Dao類不會打啊

求源代碼,,謝。我定好好學(xué)習(xí)

正在回答

2 回答

package?com.xiong.lq.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?com.xiong.lq.db.C3P0Util;
import?com.xiong.lq.db.DBCPUtil;
import?com.xiong.lq.db.DB_util;
import?com.xiong.lq.model.Account;
public?class?AccountDAO?{
?public?void?insert(Account?account)?throws?SQLException{
??Connection?conn?=DB_util.getConnection();
??PreparedStatement?st?=conn.prepareStatement("insert?into?account_info(account,amount)?values?(?,?)");
??st.setString(1,?account.getAccount());
??st.setDouble(2,?account.getAmount());
??st.execute();
?}
?public?void?update(Account?account)?throws?SQLException{
??Connection?conn?=DB_util.getConnection();
??PreparedStatement?st?=conn.prepareStatement("update?account_info?set?account?=?,amount=??where?id?=?");
??st.setString(1,?account.getAccount());
??st.setDouble(2,?account.getAmount());
??st.setInt(3,?account.getId());
??st.execute();
?}
?public?void?delete(Account?account)?throws?SQLException{
??Connection?conn?=DB_util.getConnection();
??PreparedStatement?st?=conn.prepareStatement("delete?from?account_info?where?id?=?");
??st.setInt(1,?account.getId());
??st.execute();
?}
?public?List<Account>?query(Account?account)?throws?SQLException{
??List<Account>?list?=new?ArrayList<Account>();
??Connection?conn?=DB_util.getConnection();
??StringBuilder?sb?=new?StringBuilder();
??sb.append("select?*?from?account_info");
??sb.append("where?account?like??");
??PreparedStatement?st?=conn.prepareStatement(sb.toString());
??st.setString(1,?"%"+account.getAccount()+"%");
??ResultSet?rs?=st.executeQuery();
??Account?a?=null;
??while(rs.next()){
???a=new?Account();
???a.setAccount(rs.getString("account"));
???a.setAmount(rs.getDouble("amount"));
???a.setCreate_at(rs.getDate("create_at"));
???a.setId(rs.getInt("id"));
???list.add(a);
??}
??return?list;
?}
?public?Account?query(int?id)?throws?SQLException{
??List<Account>?list?=new?ArrayList<Account>();
??Connection?conn?=DB_util.getConnection();
??StringBuilder?sb?=new?StringBuilder();
??sb.append("select?*?from?account_info");
??sb.append("?where?id?like??");
??PreparedStatement?st?=conn.prepareStatement(sb.toString());
??st.setInt(1,?id);
??ResultSet?rs?=st.executeQuery();
??Account?a?=null;
??while(rs.next()){
???a=new?Account();
???a.setAccount(rs.getString("account"));
???a.setAmount(rs.getDouble("amount"));
???a.setCreate_at(rs.getDate("create_at"));
???a.setId(rs.getInt("id"));
//???list.add(a);
??}
??return?a;
?}
?
?public?Account?queryByDbcp(int?id)?throws?SQLException{
??DBCPUtil?db?=new?DBCPUtil();
??List<Account>?list?=new?ArrayList<Account>();
??Connection?conn?=db.getConn();
??StringBuilder?sb?=new?StringBuilder();
??sb.append("select?*?from?account_info");
??sb.append("?where?id?like??");
??PreparedStatement?st?=conn.prepareStatement(sb.toString());
??st.setInt(1,?id);
??ResultSet?rs?=st.executeQuery();
??Account?a?=null;
??while(rs.next()){
???a=new?Account();
???a.setAccount(rs.getString("account"));
???a.setAmount(rs.getDouble("amount"));
???a.setCreate_at(rs.getDate("create_at"));
???a.setId(rs.getInt("id"));
//???list.add(a);
??}
??return?a;
?}
?public?Account?queryByC3P0(int?id)?throws?SQLException{
??C3P0Util?c3p0?=new?C3P0Util();
??List<Account>?list?=new?ArrayList<Account>();
??Connection?conn?=c3p0.getConnection();
??StringBuilder?sb?=new?StringBuilder();
??sb.append("select?*?from?account_info");
??sb.append("?where?id?like??");
??PreparedStatement?st?=conn.prepareStatement(sb.toString());
??st.setInt(1,?id);
??ResultSet?rs?=st.executeQuery();
??Account?a?=null;
??while(rs.next()){
???a=new?Account();
???a.setAccount(rs.getString("account"));
???a.setAmount(rs.getDouble("amount"));
???a.setCreate_at(rs.getDate("create_at"));
???a.setId(rs.getInt("id"));
//???list.add(a);
??}
??return?a;
?}
}

package?com.xiong.lq.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?com.xiong.lq.db.DB_util;
import?com.xiong.lq.model.TransInfo;
public?class?TransInfoDAO?{
?public?void?insert(TransInfo?transInfo)?throws?SQLException{
??Connection?conn?=DB_util.getConnection();
??PreparedStatement?st?=conn.prepareStatement("insert?into?trans_info(source_id,source_account,destination_id,destination_account,amount)?values(?,?,?,?,?)");
??st.setInt(1,?transInfo.getSource_id());
??st.setString(2,?transInfo.getSource_account());
??st.setInt(3,?transInfo.getDesitination_id());
??st.setString(4,?transInfo.getDesitination_account());
??st.setDouble(5,?transInfo.getAmount());
??st.execute();
?}
?public?void?update(TransInfo?transInfo)?throws?SQLException{
??Connection?conn?=DB_util.getConnection();
??PreparedStatement?st?=conn.prepareStatement("update?trans_info?set?source_id?=?,source_account?=?,destination_id?=?,destination_account=?,amount=??where?id?=?");
??st.setInt(1,?transInfo.getSource_id());
??st.setString(2,?transInfo.getSource_account());
??st.setInt(3,?transInfo.getDesitination_id());
??st.setString(4,?transInfo.getDesitination_account());
??st.setDouble(5,?transInfo.getAmount());
??st.setInt(6,?transInfo.getId());
??st.execute();
?}
?public?void?delete(TransInfo?transInfo)?throws?SQLException{
??Connection?conn?=DB_util.getConnection();
??PreparedStatement?st?=conn.prepareStatement("delete?from?trans_info?where?id=?");
??st.setInt(1,?transInfo.getId());
??st.execute();
?}
?public?List<TransInfo>?query(TransInfo?transInfo)?throws?SQLException{
??List<TransInfo>?list?=new?ArrayList<TransInfo>();
??Connection?conn?=DB_util.getConnection();
??PreparedStatement?st?=conn.prepareStatement("select?*?from?trans_info?where?id?=?");
??st.setInt(1,?transInfo.getId());
??ResultSet?rs?=st.getResultSet();
??TransInfo?t?=null;
??while(rs.next()){
???t.setId(rs.getInt("id"));
???t.setSource_id(rs.getInt("source_id"));
???t.setSource_account(rs.getString("source_account"));
???t.setDesitination_id(rs.getInt("destination_id"));
???t.setDesitination_account(rs.getString("desitination_account"));
???t.setAmount(rs.getDouble("amount"));
???list.add(t);
??}
??return?list;
?}
}


0 回復(fù) 有任何疑惑可以回復(fù)我~

謝啦!謝謝謝

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

缺了兩個實(shí)體類,兩個Dao類不會打啊

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號