Example #1
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;
 }
Example #2
0
 @Override
 public PlaceModel placeUpdate(PlaceModel place) {
   // TODO Auto-generated method stub
   place.setModifiedDate(new Date());
   placeDao.saveOrUpdate(place);
   return place;
 }
Example #3
0
 @Override
 public PlaceModel getPlaceById(String id) {
   // TODO Auto-generated method stub
   if (!StringUtils.isEmpty(id)) {
     return placeDao.get(id);
   }
   return null;
 }
Example #4
0
 @SuppressWarnings("unchecked")
 @Override
 public List<PlaceModel> getAllPlaces() {
   // TODO Auto-generated method stub
   DetachedCriteria criteria = DetachedCriteria.forClass(PlaceModel.class);
   List<PlaceModel> result = placeDao.getListByCriteria(criteria);
   return result;
 }
Example #5
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;
  }