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

📄 xiaoshoudingdanserviceimpl.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.XiaoShouDingDanDAO;
import com.yuanjin.mtgx.dao.impl.XiaoShouDingDanDAOImpl;
import com.yuanjin.mtgx.entity.XiaoShouDingDan;
import com.yuanjin.mtgx.service.XiaoShouDingDanService;
import com.yuanjin.mtgx.util.HbnUtil;

public class XiaoShouDingDanServiceImpl implements XiaoShouDingDanService {
	
	private XiaoShouDingDanDAO dao=new XiaoShouDingDanDAOImpl();

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

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

	public List findAllXiaoShouDingDan() {
		// 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 XiaoShouDingDan findXiaoShouDingDanByNo(String xsddbh) {
		// TODO Auto-generated method stub
		Session session=null;
		Transaction tran=null;
		XiaoShouDingDan xsdd=null;
		try {
			session=HbnUtil.getCurrentSession();
			tran=session.beginTransaction();
			xsdd=dao.findByNo(xsddbh);
			tran.commit();
		} catch (HibernateException e) {
			tran.rollback();
			e.printStackTrace();
		}
		return xsdd;
	}

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

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

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

}

⌨️ 快捷键说明

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