java银行管理系统窗体sql,java swing银行管理系统,java实现的毕业设计

package com.bank.dao;

import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import com.bank.model.CusFunds;

import com.bank.util.StringUtil;

public class CusFundsDao {

/**

* 更新账户资金(取款)

* @param con

* @param

* @return

* @throws Exception

*/

public int noraddupdate(Connection con,double balance,String AccoutID)throws Exception{

String sql="update customer_funds set TotalFunds=TotalFunds-? where cu_fAccount=?";

PreparedStatement pstmt=con.prepareStatement(sql);

pstmt.setDouble(1,balance);

pstmt.setString(2,AccoutID);

return pstmt.executeUpdate();

}

/**

* 更新账户资金(存款)

* @param con

* @param

* @return

* @throws Exception

*/

public int norsubupdate(Connection con,double balance,String AccoutID)throws Exception{

String sql="update customer_funds set TotalFunds=TotalFunds+? where cu_fAccount=?";

PreparedStatement pstmt=con.prepareStatement(sql);

pstmt.setDouble(1,balance);

pstmt.setString(2,AccoutID);

return pstmt.executeUpdate();

}

/**

* 查询客户资金情况

* @param con

* @param cusFunds

* @return

* @throws Exception

*/

public ResultSet list(Connection con,CusFunds cusFunds)throws Exception{

StringBuffer sb=new StringBuffer("select * from customer_funds");

if(StringUtil.isNotEmpty(cusFunds.getCu_fAccount())){

//先用and 为后续多个条件方便使用

sb.append(" and cu_fAccount ="+cusFunds.getCu_fAccount().trim()+"");

}

//替换语句 将and 处理转为where

PreparedStatement pstmt=con.prepareStatement(sb.toString().replaceFirst("and", "where"));

return pstmt.executeQuery();

}

/**

* 冻结客户资金

* @param con

* @param cusFunds

* @return

* @throws Exception

*/

public int frozeupdate(Connection con,CusFunds cusFunds)throws Exception{

String sql="update customer_funds set TotalFunds=?,FrozenCapital=? where cu_fAccount=?";

PreparedStatement pstmt=con.prepareStatement(sql);

pstmt.setDouble(1,0.00);

pstmt.setDouble(2,cusFunds.getTotalFunds());

pstmt.setString(3,cusFunds.getCu_fAccount());

return pstmt.executeUpdate();

}

/**

* 解冻客户资金

* @param con

* @param cusFunds

* @return

* @throws Exception

*/

public int unfreupdate(Connection con,CusFunds cusFunds)throws Exception{

String sql="update customer_funds set TotalFunds=?,FrozenCapital=? where cu_fAccount=?";

PreparedStatement pstmt=con.prepareStatement(sql);

pstmt.setDouble(1,cusFunds.getFrozenCapital());

pstmt.setDouble(2,0.00);

pstmt.setString(3,cusFunds.getCu_fAccount());

return pstmt.executeUpdate();

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值