package com.shop.Manager.Impl; import java.util.List; import com.shop.Manager.OrderManager; import com.shop.Model.Items; import com.shop.Model.ShopOrder; import com.shop.Model.Store; import com.shop.Util.Pager.PagerManager; import com.shop.Util.Pager.PagerModel; public class OrderManagerImpl extends PagerManager implements OrderManager { public void addOrder(ShopOrder order) { this.getHibernateTemplate().save(order); } public void addItem(Items items){ this.getHibernateTemplate().save(items); } public ShopOrder getOrderById(int id) { return (ShopOrder)this.getHibernateTemplate().get(ShopOrder.class, id); } public void addStore(Store store, int shopId) { String hql = "select s from Store s where s.shop.id = ? and s.code = ?"; Store s = (Store)this.getSession().createQuery(hql).setParameter(0, shopId).setParameter(1, store.getCode()).uniqueResult(); if(s != null){ int a = s.getAccount()+store.getAccount(); s.setAccount(a); this.getHibernateTemplate().update(s); return; } this.getHibernateTemplate().save(store); } public PagerModel searchOrders(ShopOrder order,String oid,String supId,String shopId,String strState,String start,String end) { String where = ""; if(oid!=null && oid != ""){ where = where+" and o.id = "+Integer.parseInt(oid); } if(supId!=null && supId != ""){ where = where+" and o.supplier.id = "+Integer.parseInt(supId); } if(shopId!=null && shopId != ""){ where = where+" and o.shop.id = "+Integer.parseInt(shopId); } if(order.getType()!=0){ where = where+" and o.type = "+order.getType(); } if(strState!=null && strState != ""){ where = where+" and o.state = "+Integer.parseInt(strState); } if(start!=null && start!=""){ where = where+" and o.repDate >= '"+start+"'"; } if(end!=null && end!=""){ where = where+" and o.repDate <= '"+end+"'"; } String hql = "select o from ShopOrder o where 1=1 "+where+" order by o.id desc"; return this.searchPaginated(hql); } public PagerModel searchSupCaiOrders(ShopOrder order,String oid,String supId,String shopId,String strState,String start,String end){ String where = ""; if(oid!=null && oid != ""){ where = where+" and o.id = "+Integer.parseInt(oid); } if(supId!=null && supId != ""){ where = where+" and o.supplier.id = "+Integer.parseInt(supId); } if(shopId!=null && shopId != ""){ where = where+" and o.shop.id = "+Integer.parseInt(shopId); } if(order.getType()!=0){ where = where+" and o.type = "+order.getType(); } if(strState!=null && strState != ""){ where = where+" and o.state = "+Integer.parseInt(strState); }else{ where = where+" and o.state != 0"; } if(start!=null && start!=""){ where = where+" and o.repDate >= '"+start+"'"; } if(end!=null && end!=""){ where = where+" and o.repDate <= '"+end+"'"; } String hql = "select o from ShopOrder o where 1=1 "+where+" order by o.id desc"; System.out.println("#############"+hql); return this.searchPaginated(hql); } public void updateOrder(int state,int id) { String hql="update ShopOrder o set o.state = "+state+" where o.id = "+id; this.getSession().createQuery(hql).executeUpdate(); } public List searchLines(int oid){ String hql = "select i from Items i where i.order.id = "+oid; return this.getSession().createQuery(hql).list(); } }

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日