예제 #1
0
 @Override
 public PlaceModel getPlaceById(String id) {
   // TODO Auto-generated method stub
   if (!StringUtils.isEmpty(id)) {
     return placeDao.get(id);
   }
   return null;
 }
예제 #2
0
 @Override
 public boolean deletePlace(String id) {
   // TODO Auto-generated method stub
   if (!StringUtils.isEmpty(id)) {
     PlaceModel model = placeDao.get(id);
     if (model == null) return false;
     placeDao.remove(model);
     return true;
   }
   return false;
 }
예제 #3
0
  @SuppressWarnings("unchecked")
  @Override
  public List<PlaceModel> getPlacesByCondition(
      String searchName,
      String searchType,
      String searchBuilding,
      Float areaBegin,
      Float areaEnd,
      Integer containBegin,
      Integer containEnd) {
    // System.out.println(searchName+";"+searchType+";"+searchBuilding+";"+areaBegin+";"+areaEnd+";"+containBegin+";"+containEnd);
    DetachedCriteria criteria = DetachedCriteria.forClass(PlaceModel.class);
    if (!StringUtils.isEmpty(searchName)) {
      //			criteria.add(Restrictions.eq("name", searchName));
      criteria.add(Restrictions.like("name", searchName, MatchMode.ANYWHERE));
    }
    if (!StringUtils.isEmpty(searchType)) {
      criteria.add(Restrictions.eq("type", searchType));
    }
    if (!StringUtils.isEmpty(searchBuilding)) {
      criteria.add(Restrictions.like("position", searchBuilding, MatchMode.START));
    }
    if (areaBegin != null) {
      criteria.add(Restrictions.ge("areaBegin", areaBegin));
    }
    if (areaEnd != null) {
      criteria.add(Restrictions.le("areaEnd", areaEnd));
    }
    if (containBegin != null) {
      criteria.add(Restrictions.ge("containBegin", containBegin));
    }
    if (containEnd != null) {
      criteria.add(Restrictions.le("containEnd", containEnd));
    }

    criteria.addOrder(Order.asc("symbol"));
    List<PlaceModel> result = placeDao.getListByCriteria(criteria);
    return result;
  }