⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 billserviceimpl.java

📁 自己做的关于spring框架的使用
💻 JAVA
字号:
package myspring.v3.ts;

import org.springframework.dao.DataAccessException;
import org.springframework.dao.DataIntegrityViolationException;

public class BillServiceImpl implements BillService {

	private AccountDao accountDao;
	
	private BillDao billDao;

	public void setAccountDao(AccountDao accountDao) {
		this.accountDao = accountDao;
	}

	public void setBillDao(BillDao billDao) {
		this.billDao = billDao;
	}
	
	public boolean buy(int accountId, int billId, float sum) {
		// TODO Auto-generated method stub
				
		if (billDao.addBill(billId, sum)){
			if (accountDao.pay(accountId, sum)){
				return true;
			} else {
				//throw new DataIntegrityViolationException("扣款失败,生成订单无效");
				//throw new Exception("扣款失败,生成订单无效");
				return false;
			}
		} else {
			return false;
		}
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -