コード例 #1
1
 @RequestMapping(value = "/search")
 public ModelAndView search(
     HttpServletRequest request,
     @PathVariable String orgi,
     @ModelAttribute("data") SinoLocation data) {
   String key = "%" + data.getProvince() + "%";
   ResponseData responseData = new ResponseData("/pages/manage/sinosig/location/list");
   String pro = request.getParameter("result");
   if (pro == null || "".equals(pro) || "0".equals(pro)) {
     responseData.setDataList(
         super.getService()
             .findPageByCriteria(
                 DetachedCriteria.forClass(SinoLocation.class)
                     .add(
                         Restrictions.and(
                             Restrictions.eq("orgi", orgi),
                             Restrictions.eq("type", data.getType())))
                     .add(
                         Restrictions.or(
                             Restrictions.or(
                                 Restrictions.like("province", key),
                                 Restrictions.like("city", key)),
                             Restrictions.or(
                                 Restrictions.like("address", key),
                                 Restrictions.like("dept", key))))));
   } else {
     responseData.setDataList(
         super.getService()
             .findPageByCriteria(
                 DetachedCriteria.forClass(SinoLocation.class)
                     .add(
                         Restrictions.and(
                             Restrictions.and(
                                 Restrictions.eq("orgi", orgi), Restrictions.eq("province", pro)),
                             Restrictions.eq("type", data.getType())))
                     .add(
                         Restrictions.or(
                             Restrictions.or(
                                 Restrictions.like("province", key),
                                 Restrictions.like("city", key)),
                             Restrictions.or(
                                 Restrictions.like("address", key),
                                 Restrictions.like("dept", key))))));
   }
   return request(responseData, orgi, null);
 }
コード例 #2
0
 @RequestMapping(value = "/rm/{id}")
 public ModelAndView rm(
     HttpServletRequest request,
     @PathVariable String orgi,
     @PathVariable String id,
     @ModelAttribute("data") SinoLocation data) {
   data.setId(id);
   data.setStatus("3"); // 删除
   super.getService().deleteIObject(data);
   // 发消息给GW,在GW更新百度信息
   APIContext.getRpcServer()
       .sendMessageToServer(
           new Message(
               EapDataContext.HANDLER,
               JSON.toJSONString(
                   new SystemMessage(SINOSIG_LOCATION, data), SerializerFeature.WriteClassName)));
   ResponseData responseData = new ResponseData("/pages/manage/sinosig/location/list");
   responseData.setDataList(
       super.getService()
           .findPageByCriteria(
               DetachedCriteria.forClass(SinoLocation.class)
                   .add(
                       Restrictions.and(
                           Restrictions.eq("orgi", orgi),
                           Restrictions.and(
                               Restrictions.eq("type", data.getType()),
                               Restrictions.eq("province", data.getProvince()))))));
   return request(responseData, orgi, null);
 }