예제 #1
0
 @Override
 public Map<String, Object> queryStoreDatas(int bid) {
   Session se = session();
   List<RetailStore> list =
       se.createQuery("from RetailStore where base_id=:bid and opening_state<>8")
           .setParameter("bid", bid)
           .list();
   if (NullCheck.notNullList(list)) {
     Map<String, Object> reMap = new HashMap<String, Object>();
     reMap.put("count", list.size());
     List<Integer> ids = new ArrayList<Integer>();
     Map<String, List<RetailStore>> dataMap = new HashMap<String, List<RetailStore>>();
     for (RetailStore retailStore : list) {
       if (!ids.contains(retailStore.getCity_id())) {
         ids.add(retailStore.getCity_id());
       }
     }
     for (Integer i : ids) {
       List<RetailStore> l = new ArrayList<RetailStore>();
       for (RetailStore ol : list) {
         if (i == ol.getCity_id()) {
           l.add(ol);
         }
       }
       if (NullCheck.notNullList(l)) {
         dataMap.put(DatasCache.AREAS_ID_NAME.get(i), l);
       }
     }
     reMap.put("datas", dataMap);
     return reMap;
   }
   return null;
 }
예제 #2
0
파일: BaseDao.java 프로젝트: kingchang/shop
 @Override
 public int queryTotal(List<RetailStore> rsList) {
   if (NullCheck.notNullList(rsList)) {
     List<Integer> l = new ArrayList<Integer>();
     for (RetailStore r : rsList) {
       l.add(r.getId());
     }
     String hql = "select count(*) from " + clazz.getSimpleName() + " where belongs_id in :bid";
     return Integer.valueOf(
         getSession().createQuery(hql).setParameterList("bid", l).list().get(0).toString());
   }
   return 0;
 }
예제 #3
0
파일: BaseDao.java 프로젝트: kingchang/shop
 @Override
 public List<T> queryDatasList(List<RetailStore> rsList, int current, int nums) {
   if (NullCheck.notNullList(rsList)) {
     List<Integer> l = new ArrayList<Integer>();
     for (RetailStore r : rsList) {
       l.add(r.getId());
     }
     String hql = "from " + clazz.getSimpleName() + " where belongs_id in :bid and stat<>8";
     return getSession()
         .createQuery(hql)
         .setParameterList("bid", l)
         .setFirstResult((current - 1) * nums)
         .setMaxResults(nums)
         .list();
   }
   return null;
 }