package org.yeeku.service.impl;
import javax.servlet.http.*;
import javax.servlet.*;
import org.hibernate.*;
import org.hibernate.cfg.*;
import java.util.*;
import org.yeeku.model.*;
import org.yeeku.factory.*;
import org.yeeku.tools.*;
import org.yeeku.dao.*;
import org.yeeku.dao.impl.*;
import org.yeeku.exception.*;
import org.yeeku.service.*;
import org.yeeku.vo.*;
/**
* @author yeeku.H.lee kongyeeku@163.com
* @version 1.0
* <br>Copyright (C), 2005-2008, yeeku.H.Lee
* <br>This program is protected by copyright laws.
* <br>Program Name:
* <br>Date:
*/
public class WebServiceImpl implements WebService
{
/**
* 新增一个供货商
* @param vendorName 供货商名字
* @param vendorAddress 供货商地址
* @param vendorPhone 供货商电话
* @param vendorFax 供货商传真
* @param vendorContentPerson 供货商联系人
* @return 创建是否成功
*/
public boolean createVendor(String vendorName , String vendorAddress , String vendorPhone , String vendorFax ,
String vendorContactPerson)throws WEBException
{
VendorDao vd = null;
try
{
vd = (VendorDao)DaoFactory.instance().getDao("vendorDao");
Session sess = HibernateUtil.currentSession();
Transaction tran = sess.beginTransaction();
Vendor v = new Vendor();
v.setVendorName(vendorName);
v.setVendorAddress(vendorAddress);
v.setVendorPhone(vendorPhone);
v.setVendorFax(vendorFax);
v.setVendorContactPerson(vendorContactPerson);
vd.save(sess , v);
tran.commit();
return true;
}
catch (Exception ee)
{
throw new WEBException("增加供应商出现异常,请重试");
}
finally
{
HibernateUtil.closeSession();
}
}
/**
* 根据分页列出所有供货商
* @param page 页码
* @return 指定页的所有供货商
*/
public Collection showVendor(int page)throws WEBException
{
try
{
System.out.println("page=" + page);
int beginPage = 0;
int listPage = 0;
if (page == 1)
{
beginPage = 0;
listPage = beginPage + 10;
}
else
{
beginPage = page * 10;
listPage = beginPage + 10;
}
Collection result = new ArrayList();
VendorDao vendorDao = (VendorDao)DaoFactory.instance().getDao("vendorDao");
Session sess = HibernateUtil.currentSession();
Transaction tran = sess.beginTransaction();
List l = vendorDao.findByShowVendor(sess , beginPage , listPage);
System.out.println("l=" + l);
for (Iterator it = l.iterator(); it.hasNext() ; )
{
Vendor v = (Vendor)it.next();
VendorVo vv = new VendorVo(v.getVendorId() , v.getVendorName() , v.getVendorAddress() ,
v.getVendorPhone() , v.getVendorFax() , v.getVendorContactPerson());
result.add(vv);
}
tran.commit();
return result;
}
catch (Exception ee)
{
throw new WEBException("查询供货商出现异常,请重试");
}
finally
{
HibernateUtil.closeSession();
}
}
/**
* 修改供货商
* @param vendorId 供货商id
* @param vendorName 供货商名字
* @param vendorAddress 供货商地址
* @param vendorPhone 供货商电话
* @param vendorFax 供货商传真
* @param vendorContentPerson 供货商联系人
* @return 修改是否成功
*/
public boolean updateVendor(Integer vendorId , String vendorName , String vendorAddress , String vendorPhone , String vendorFax ,
String vendorContactPerson)throws WEBException
{
try
{
VendorDao vd = (VendorDao)DaoFactory.instance().getDao("vendorDao");
Session sess = HibernateUtil.currentSession();
Transaction tran = sess.beginTransaction();
Vendor v = vd.get(sess , vendorId);
if (v != null)
{
v.setVendorName(vendorName);
v.setVendorAddress(vendorAddress);
v.setVendorPhone(vendorPhone);
v.setVendorFax(vendorFax);
v.setVendorContactPerson(vendorContactPerson);
vd.update(sess , v);
tran.commit();
return true;
}
return false;
}
catch (Exception ee)
{
throw new WEBException("更新供货商出现异常,请重试");
}
finally
{
HibernateUtil.closeSession();
}
}
/**
* 根据ID查询供货商
* @param id 供货商id
* @return 该id对应的供货商组成的集合
*/
public Collection showVendorId(Integer id)throws WEBException
{
try
{
Collection result = new ArrayList();
VendorDao vendorDao = (VendorDao)DaoFactory.instance().getDao("vendorDao");
Session sess = HibernateUtil.currentSession();
Transaction tran = sess.beginTransaction();
Vendor v = vendorDao.get(sess , id);
if (v != null)
{
VendorVo vv = new VendorVo(v.getVendorId() , v.getVendorName() , v.getVendorAddress() ,
v.getVendorPhone() , v.getVendorFax() , v.getVendorContactPerson());
result.add(vv);
tran.commit();
return result;
}
return null;
}
catch (Exception ee)
{
throw new WEBException("无法取得对应供货商,请重试");
}
finally
{
HibernateUtil.closeSession();
}
}
/**
* 获取所有供货商
* @return 返回系统的全部供货商
*/
public Collection showVendor()throws WEBException
{
try
{
Collection result = new ArrayList();
VendorDao vendorDao = (VendorDao)DaoFactory.instance().getDao("vendorDao");
Session sess = HibernateUtil.currentSession();
Transaction tran = sess.beginTransaction();
List l = vendorDao.findByShowVendor(sess);
System.out.println("l=" + l);
for (Iterator it = l.iterator(); it.hasNext() ; )
{
Vendor v = (Vendor)it.next();
VendorVo vv = new VendorVo(v.getVendorId() , v.getVendorName() , v.getVendorAddress() ,
v.getVendorPhone() , v.getVendorFax() , v.getVendorContactPerson());
result.add(vv);
}
tran.commit();
return result;
}
catch (Exception ee)
{
throw new WEBException("返回所有供货商时出现异常,请重试");
}
finally
{
HibernateUtil.closeSession();
}
}
/**
* 新增一个部门
* @param deptName 部门名
* @param description 部门描述
* @return 创建部门是否成功
*/
public boolean createDept(String deptName , String description)throws WEBException
{
DeptDao dd = null;
try
{
dd = (DeptDao)DaoFactory.instance().getDao("deptDao");
Session sess = HibernateUtil.currentSession();
Transaction tran = sess.beginTransaction();
Dept d = new Dept();
d.setDeptName(deptName);
d.setDescription(description);
dd.save(sess , d);
tran.commit();
return true;
}
catch (Exception ee)
{
throw new WEBException("添加部门时出现异常,请重试");
}
finally
{
HibernateUtil.closeSession();
}
}
/**
* 根据分页列出所有部门
* @param page 页码
* @return 指定页的所有部门
*/
public Collection showDept(int page)throws WEBException
{
DeptDao deptDao = null;
System.out.println("page=" + page);
int beginPage = 0;
int listPage = 0;
if (page == 1)
{
beginPage = 0;
listPage = beginPage + 10;
}
else
{
beginPage = page * 10;
listPage = beginPage + 10;
}
Collection result = new ArrayList();
try
{
deptDao = (DeptDao)DaoFactory.instance().getDao("deptDao");
Session sess = HibernateUtil.currentSession();
Transaction tran = sess.beginTransaction();
List l = deptDao.findByShowDept(sess , beginPage , listPage);
System.out.println("l=" + l);
for (Iterator it = l.iterator(); it.hasNext() ; )
{
Dept d = (Dept)it.next();
DeptVo dv = new DeptVo(d.getDeptId() , d.getDeptName() , d.getDescription());
result.add(dv);
}
tran.commit();
return result;
}
catch (Exception ee)
{
throw new WEBException("查询部门时出现异常,请重试");
}
finally
{
HibernateUtil.closeSession();
}
}
/**
* 修改部门
* @param deptId 部门id
* @param deptName 部门名
* @param description 部门描述
* @return 修改部门是否成功
*/
public boolean updateDept(Integer deptId , String deptName , String description)throws WEBException
{
DeptDao dd = null;
try
{
dd = (
没有合适的资源?快使用搜索试试~ 我知道了~
超市管理信息系统(SSH struts+spring+hibernate)
共175个文件
class:51个
java:51个
jsp:18个
2星 需积分: 10 32 下载量 47 浏览量
2008-12-21
17:20:16
上传
评论
收藏 5MB RAR 举报
温馨提示
一个超市管理信息系统,大家可以学习下,业务方面以及SSH 框架的学习
资源详情
资源评论
资源推荐
收起资源包目录
超市管理信息系统(SSH struts+spring+hibernate) (175个子文件)
WebServiceImpl.class 15KB
VendorUpdateAction.class 3KB
IncomeUpdateAction.class 3KB
DeptUpdateAction.class 3KB
IncomeAddAction.class 2KB
VendorAddAction.class 2KB
ShowBillPaymentAction.class 2KB
BillDaoImpl.class 2KB
DaoFactory.class 2KB
ShowVendorUpdateAction.class 2KB
VendorDaoImpl.class 2KB
LoginActin.class 2KB
Vendor.class 2KB
VendorMainAction.class 2KB
ShowIncomeUpdateAction.class 2KB
ShowDeptUpdateAction.class 2KB
IncomeDaoImpl.class 2KB
BillAddAction.class 2KB
Bill.class 2KB
IncomeMainAction.class 2KB
AppFactory.class 2KB
BillAddDepItemAction.class 2KB
BillShowVendorAction.class 2KB
IncomeShowDeptAction.class 2KB
BillUpdateAction.class 2KB
BillVo.class 2KB
Dept.class 2KB
DeptMainAction.class 2KB
HibernateUtil.class 2KB
DeptDaoImpl.class 2KB
DeptAddAction.class 2KB
VendorVo.class 2KB
Income.class 2KB
IncomeVo.class 2KB
WebService.class 1KB
BillItemDaoImpl.class 1KB
BillItem.class 1KB
UserDaoImpl.class 1KB
DeptVo.class 1KB
User.class 1KB
StartUpServlet.class 854B
EncodingServlet.class 825B
BillDao.class 592B
IncomeDao.class 576B
VendorDao.class 493B
DeptDao.class 483B
WEBException.class 447B
BillItemDao.class 376B
UserDao.class 376B
ConstantsUtil.class 344B
Dao.class 106B
Thumbs.db 9KB
depart3.gif 1001B
depart2.gif 1001B
depart1.gif 1001B
top_band.gif 360B
go_button.gif 237B
dot_clear.gif 43B
hibernate3.jar 2.08MB
struts.jar 537KB
c3p0-0.9.0.jar 476KB
antlr-2.7.6.jar 433KB
mysql-connector-java-3.1.10-bin.jar 409KB
dom4j-1.6.1.jar 307KB
cglib-2.1.3.jar 276KB
commons-beanutils.jar 184KB
commons-collections-2.1.1.jar 171KB
commons-digester.jar 164KB
commons-validator.jar 82KB
jakarta-oro.jar 64KB
commons-logging-1.0.4.jar 37KB
commons-logging.jar 37KB
asm.jar 26KB
commons-fileupload.jar 22KB
jta.jar 9KB
WebServiceImpl.java 19KB
WebService.java 4KB
Vendor.java 2KB
VendorUpdateAction.java 2KB
HibernateUtil.java 2KB
VendorVo.java 2KB
IncomeDao.java 2KB
BillDao.java 2KB
BillVo.java 2KB
Bill.java 2KB
VendorDao.java 2KB
DeptDao.java 2KB
VendorAddAction.java 2KB
AppFactory.java 1KB
DaoFactory.java 1KB
BillDaoImpl.java 1KB
IncomeVo.java 1KB
IncomeDaoImpl.java 1KB
IncomeUpdateAction.java 1KB
Dept.java 1KB
Income.java 1KB
IncomeAddAction.java 1KB
LoginActin.java 1KB
BillAddAction.java 1KB
VendorDaoImpl.java 1KB
共 175 条
- 1
- 2
wo4dazhu
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1