首页>代码>ssh+mysql+jsp开发自动补货后台管理系统>/Replenishment/src/com/shop/Manager/Impl/GoodsManagerImpl.java
package com.shop.Manager.Impl;

import com.shop.Manager.GoodsManager;
import com.shop.Model.Goods;
import com.shop.Util.Pager.PagerManager;
import com.shop.Util.Pager.PagerModel;

public class GoodsManagerImpl extends PagerManager implements GoodsManager {

	public void addGoods(Goods goods) {
		this.getHibernateTemplate().save(goods);

	}

	public void delGoods(int id) {
		this.getHibernateTemplate().delete(this.getGoodsById(id));

	}

	public Goods getGoodsById(int id) {
		
		return (Goods)this.getHibernateTemplate().get(Goods.class, id);
	}

	public PagerModel searchGoods(Goods goods) {
		String where = "";
		if(goods.getCode()!=null && goods.getCode()!=""){
			where = where+" and g.code = '"+goods.getCode()+"'";
		}
		if(goods.getName()!=null && goods.getName()!=""){
			where = where+" and g.name = '"+goods.getName()+"'";
		}
		
		String hql = "select g from Goods g where 1=1 "+where;
		return this.searchPaginated(hql);
	}

	public void updateGoods(Goods goods) {
		this.getHibernateTemplate().update(goods);

	}
	public Goods getGoodsByCode(String code){
		String hql = "select g from Goods g where g.code = '"+code+"'";
		return (Goods)this.getSession().createQuery(hql).uniqueResult();
	}
}
最近下载更多
weilaizhisheng  LV21 2023年1月7日
lwp011  LV27 2020年7月7日
caochengbo  LV6 2020年6月22日
ASDZXZCDGSDFHUJD  LV9 2020年5月12日
xuchi123  LV7 2020年4月26日
onepiecebabylon  LV13 2020年4月17日
fangoqz  LV6 2020年4月10日
lironggang  LV38 2020年1月10日
c879244324  LV8 2019年7月15日
范德桑德  LV9 2019年7月1日
最近浏览更多
fellowfun  LV12 3月7日
yangyangyangyangzzzz  LV1 1月3日
17693282606  LV11 2023年12月26日
WBelong  LV7 2023年12月11日
2036495585  LV9 2023年9月25日
yemmmm666  LV1 2023年6月12日
jiyun2021  LV9 2023年2月1日
weilaizhisheng  LV21 2023年1月7日
ming_123_9715  LV23 2022年12月15日
jiangxiaoyu  LV17 2022年11月21日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友