package com.neusoft.pre_fee_gatherDao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import com.neusoft.hr.dao.DbUtils;
public class Pre_Fee_GatherRecordDao {
//����
public boolean insert(Pre_Fee_GatherRecord csr){
//1.��ȡ����'
Connection conn = DbUtils.getConnection();
//2.Ԥ����
String sql = "TEAM101_RP_PRE_FEE_GATHER_T_3(account_month,city_code,product_code,write_off_type_code,write_off_fee,update_time) values(?,?,?,?,?,to_date(?,'yyyy-mm-dd'))";
try {
PreparedStatement ps = conn.prepareStatement(sql);
//3.����
ps.setString(1,csr.getAccount_month());
ps.setString(2,csr.getCity_code());
ps.setString(3, csr.getProduct_code());
ps.setString(4, csr.getWrite_off_type_code());
ps.setString(5, csr.getWrite_off_fee());
ps.setString(6, csr.getUpdate_time());
//4.ִ��sql���
int x = ps.executeUpdate();
if(x>0){
System.out.println("添加成功!!!");
return true;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
DbUtils.closeConnection();
}
return false;
}
//����
public boolean update(Pre_Fee_GatherRecord csr){
//1.��ȡ����'
Connection conn = DbUtils.getConnection();
//2.Ԥ����
String sql = "update TEAM101_RP_CARD_SALE_5 set getSale_date=to_date(?,'yyyy-mm-dd'),City_code=?,Product_code=?,Card_sale_amount=?,Card_par_value_fee=?,Total_fee=?,Discount_fee=? where ID=?";
try {
PreparedStatement ps = conn.prepareStatement(sql);
//3.����
ps.setString(1,csr.getAccount_month());
ps.setString(2,csr.getCity_code());
ps.setString(3, csr.getProduct_code());
ps.setString(4, csr.getWrite_off_type_code());
ps.setString(5, csr.getWrite_off_fee());
ps.setString(6, csr.getUpdate_time());
//4.ִ��sql���
int x = ps.executeUpdate();
if(x>0){
return true;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
DbUtils.closeConnection();
}
return false;
}
//ɾ��
public boolean delete(String ACCOUNT_MONTH){
//1.��ȡ����'
Connection conn = DbUtils.getConnection();
//2.Ԥ����
String sql = "delete from TEAM101_RP_PRE_FEE_GATHER_T_3 where ACCOUNT_MONTH=?";
try {
PreparedStatement ps = conn.prepareStatement(sql);
//3.����
ps.setString(1,ACCOUNT_MONTH);
//4.ִ��sql���
int x = ps.executeUpdate();
if(x>0){
return true;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
DbUtils.closeConnection();
}
return false;
}
//��������̬��ѯ
public ArrayList<Pre_Fee_GatherRecord> query(Pre_Fee_GatherRecord csr){
ArrayList<String> params = new ArrayList<String>();
//����ж��Ǹ��ʲô������ѯ???
String Account_Month=csr.getWrite_off_type_code();
String City_code=csr.getCity_code();
String Product_code=csr.getProduct_code();
StringBuffer sql = new StringBuffer("select to_char(sale_date,'yyyy-mm-dd') as update_time,city_code,product_code from TEAM101_RP_PRE_FEE_GATHER_T_3 e,TEAM101_RP_PRE_FEE_GATHER_T_3_state s where e.state = s.skey");
//��̬ƴ�Ӳ�ѯ���
if(Account_Month !=null && !Account_Month .equals("")){
sql.append(" and Account_Month=?");
params.add(Account_Month);
}
if(City_code !=null && !City_code.equals("")){
sql.append(" and City_code=?");
params.add("%"+City_code +"%");
}
if(Product_code !=null && !Product_code.equals("") && !Product_code.equals("0")){
sql.append(" and Product_code=?");
params.add(Product_code);
}
ArrayList<Pre_Fee_GatherRecord> csrs = new ArrayList<Pre_Fee_GatherRecord>();
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
conn = DbUtils.getConnection();
try {
ps = conn.prepareStatement(sql.toString());
//�������?����
for(int i=0;i<params.size();i++){
ps.setString(i+1, params.get(i));
}
rs = ps.executeQuery();
//����rs
while(rs.next()){
Pre_Fee_GatherRecord csrr = new Pre_Fee_GatherRecord();
csrr.setAccount_month("Account_Month");
csrr.setCity_code(rs.getString("City_code"));
csrr.setProduct_code(rs.getString("Product_code"));
csrr.setWrite_off_type_code(rs.getString("Write_off_type_code"));
csrr.setWrite_off_fee(rs.getString("Write_off_fee"));
csrr.setUpdate_time(rs.getString("Update_time"));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
DbUtils.closeConnection();
}
return csrs;
}
public Pre_Fee_GatherRecord queryById(String id){
Pre_Fee_GatherRecord csr = null;
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
conn = DbUtils.getConnection();
String sql = "select to_char(birth,'yyyy-mm-dd') as birth from t_emp where empno=?";
try {
ps = conn.prepareStatement(sql);
ps.setString(1,id);
rs = ps.executeQuery();
//����rs
if(rs.next()){
csr = new Pre_Fee_GatherRecord();
csr.setAccount_month("Account_Month");
csr.setCity_code(rs.getString("City_code"));
csr.setProduct_code(rs.getString("Product_code"));
csr.setWrite_off_type_code(rs.getString("Write_off_type_code"));
csr.setWrite_off_fee(rs.getString("Write_off_fee"));
csr.setUpdate_time(rs.getString("Update_time"));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
DbUtils.closeConnection();
}
return csr;
}
//遍历
public ArrayList<Pre_Fee_GatherRecord> display(){
ArrayList<String> params = new ArrayList<String>();
//����ж��Ǹ��ʲô������ѯ???
String sql = "select * from TEAM101_RP_CARD_SALE_5";
ArrayList<Pre_Fee_GatherRecord> csrs = new ArrayList<Pre_Fee_GatherRecord>();
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
conn = DbUtils.getConnection();
try {
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
while(rs.next()){
Pre_Fee_GatherRecord csr = new Pre_Fee_GatherRecord();
csr.setAccount_month("Account_Month");
csr.setCity_code(rs.getString("City_code"));
csr.setProduct_code(rs.getString("Product_code"));
csr.setWrite_off_type_code(rs.getString("Write_off_type_code"));
csr.setWrite_off_fee(rs.getString("Write_off_fee"));
csr.setUpdate_time(rs.getString("Update_time"));
csrs.add(csr);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
DbUtils.closeConnection();
}
return csrs;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
MVC模式的Web电信报表系统
共207个文件
html:59个
class:42个
java:37个
需积分: 9 14 下载量 96 浏览量
2013-05-29
08:17:18
上传
评论 2
收藏 1.82MB ZIP 举报
温馨提示
JSP+Servlet+JavaBean的MVC模式的Web电信报表系统
资源推荐
资源详情
资源评论
收起资源包目录
MVC模式的Web电信报表系统 (207个子文件)
Pre_Fee_GatherRecordDao.class 6KB
OncomeDao.class 4KB
OncomeDao.class 4KB
Card_sale_record.class 3KB
Net_balance_record.class 3KB
Account_fee_record.class 3KB
Business_fee_record.class 3KB
OnCome.class 3KB
OnCome.class 3KB
Pre_fee_record.class 2KB
Account_type_code.class 2KB
Product_code.class 2KB
User_enter_module.class 2KB
Updatepre_fee_gatherServlet.class 2KB
Displaypre_fee_gatherServlet.class 2KB
Pre_Fee_GatherDao.class 2KB
Pre_Fee_GatherRecord.class 2KB
Business_fee_gather.class 2KB
Pre_fee_gather.class 2KB
Account_gather.class 2KB
Syslog.class 2KB
DbUtils.class 1KB
EmpDao.class 1KB
EmpDao.class 1KB
User_operate.class 1KB
DbUtils.class 1KB
Addpre_fee_gatherServlet.class 1KB
Deletepre_fee_gatherServlet.class 1KB
Emp.class 1KB
Emp.class 1KB
P800_local_account_code.class 1KB
Querypre_fee_gatherServlet.class 1KB
Business_fee_type_code.class 917B
Write_off_type_code.class 884B
Balance_type_code.class 864B
Return_fee_code.class 842B
Fee_source_code.class 842B
Balance_sp_code.class 842B
Fee_use_code.class 809B
City_code.class 778B
Pre_Fee_Gather.class 743B
Usiness_fee_type_code.class 330B
.classpath 453B
org.eclipse.wst.jsdt.ui.superType.container 49B
calendar-win2k-cold-1.css 5KB
base.css 2KB
left.css 522B
register.css 258B
head.css 201B
login.css 177B
buttom.css 111B
index.css 97B
top.css 84B
Thumbs.db 51KB
Thumbs.db 48KB
bg1.gif 3KB
chaxun1.html 9KB
chaxun1.html 9KB
limit.html 8KB
limit.html 8KB
canshu1.html 8KB
canshu1.html 8KB
canshu3.html 8KB
canshu3.html 8KB
canshu2.html 8KB
canshu2.html 8KB
cardsold1.html 7KB
cardsold1.html 7KB
jiawei1.html 6KB
jiawei1.html 6KB
noruz4.html 5KB
noruz3.html 5KB
noruz3.html 5KB
noruz2.html 4KB
noruz2.html 4KB
noruz1.html 4KB
noruz1.html 4KB
chaxun3.html 4KB
chaxun3.html 4KB
jiawei3.html 4KB
jiawei3.html 4KB
chaxun2.html 4KB
chaxun2.html 4KB
left.html 4KB
xiaohai2.html 4KB
xiaohai4.html 4KB
xiaohai3.html 4KB
xiaohai1.html 4KB
xiaohai2.html 4KB
xiaohai3.html 4KB
xiaohai1.html 4KB
xiaohai4.html 4KB
xing.html 4KB
xing.html 4KB
cardsold3.html 3KB
cardsold3.html 3KB
jiawei111.html 3KB
jiawei111.html 3KB
cardsold2.html 3KB
cardsold2.html 3KB
共 207 条
- 1
- 2
- 3
资源评论
nizhegefeifei
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功