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

📄 yuexiaoshouzhangdanserviceimpl.java

📁 自己写的一个java购销系统
💻 JAVA
字号:
package com.yuanjin.mtgx.service.impl;

import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.yuanjin.mtgx.dao.YueXiaoShouZhangDanDAO;
import com.yuanjin.mtgx.dao.impl.YueXiaoShouZhangDanDAOImpl;
import com.yuanjin.mtgx.entity.YueXiaoShouZhangDan;
import com.yuanjin.mtgx.service.YueXiaoShouZhangDanService;
import com.yuanjin.mtgx.util.HbnUtil;

public class YueXiaoShouZhangDanServiceImpl implements YueXiaoShouZhangDanService {
	
	private YueXiaoShouZhangDanDAO dao=new YueXiaoShouZhangDanDAOImpl();

	public boolean addYueXiaoShouZhangDan(YueXiaoShouZhangDan yxszd) {
		// TODO Auto-generated method stub
		Session session=null;
		Transaction tran=null;
		boolean success=false;
		try {
			session=HbnUtil.getCurrentSession();
			tran=session.beginTransaction();
			dao.save(yxszd);
			tran.commit();
			success=true;
		} catch (HibernateException e) {
			tran.rollback();
			e.printStackTrace();
		}
		return success;
	}

	public boolean deleteYueXiaoShouZhangDan(YueXiaoShouZhangDan yxszd) {
		// TODO Auto-generated method stub
		Session session=null;
		Transaction tran=null;
		boolean success=false;
		try {
			session=HbnUtil.getCurrentSession();
			tran=session.beginTransaction();
			dao.delete(yxszd);
			tran.commit();
			success=true;
		} catch (HibernateException e) {
			tran.rollback();
			e.printStackTrace();
		}
		return success;
	}

	public List findAllYueXiaoShouZhangDan() {
		// TODO Auto-generated method stub
		Session session=null;
		Transaction tran=null;
		List list=null;
		try {
			session=HbnUtil.getCurrentSession();
			tran=session.beginTransaction();
			list=dao.findALL();
			tran.commit();
		} catch (HibernateException e) {
			tran.rollback();
			e.printStackTrace();
		}
		return list;
	}

	public YueXiaoShouZhangDan findYueXiaoShouZhangDanByNo(String zdbh) {
		// TODO Auto-generated method stub
		Session session=null;
		Transaction tran=null;
		YueXiaoShouZhangDan yxszd=null;
		try {
			session=HbnUtil.getCurrentSession();
			tran=session.beginTransaction();
			yxszd=dao.findByNo(zdbh);
			tran.commit();
		} catch (HibernateException e) {
			tran.rollback();
			e.printStackTrace();
		}
		return yxszd;
	}

	public boolean modifyYueXiaoShouZhangDan(YueXiaoShouZhangDan yxszd) {
		// TODO Auto-generated method stub
		Session session=null;
		Transaction tran=null;
		boolean success=false;
		try {
			session=HbnUtil.getCurrentSession();
			tran=session.beginTransaction();
			dao.update(yxszd);
			tran.commit();
			success=true;
		} catch (HibernateException e) {
			tran.rollback();
			e.printStackTrace();
		}
		return success;
	}

	public YueXiaoShouZhangDan findYueXiaoShouZhangDanByMonth(String month) {
		// TODO Auto-generated method stub
		Session session=null;
		Transaction tran=null;
		YueXiaoShouZhangDan yxszd=null;
		try {
			session=HbnUtil.getCurrentSession();
			tran=session.beginTransaction();
			yxszd=dao.findByMonth(month);
			tran.commit();
		} catch (HibernateException e) {
			tran.rollback();
			e.printStackTrace();
		}
		return yxszd;
	}

}

⌨️ 快捷键说明

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