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日

yanguobin LV7
3月18日
zhengguangshun LV4
2024年8月25日
微信网友_7000012089643008 LV4
2024年5月26日
泓鼎168 LV20
2024年5月15日
misw01
2024年5月9日
暂无贡献等级
fellowfun LV12
2024年3月7日
yangyangyangyangzzzz LV1
2024年1月3日
17693282606 LV12
2023年12月26日
WBelong LV8
2023年12月11日
2036495585 LV9
2023年9月25日