Пример #1
0
 /**
  * 搜索宠物
  *
  * @param response
  * @param phone
  * @throws IOException
  */
 @RequestMapping(value = "/searchpets")
 public void searchPetInfo(
     HttpServletResponse response, @RequestParam(value = "phone") String phone)
     throws IOException {
   PetInfos petInfos = new PetInfos();
   if (StringUtil.isNullOrEmpty(phone)) {
     petInfos.setResult("1"); // phone is empty
   } else {
     petInfos = petInfoDao.searchPetInfos(phone);
     petInfos.setResult("0");
   }
   String json = JSONUtil.toString(petInfos);
   response.getWriter().print(json);
 }
Пример #2
0
 /**
  * 获取宠物列表
  *
  * @param response
  * @param userName
  * @throws IOException
  */
 @RequestMapping(value = "/getpets")
 public void getPetInfoList(
     HttpServletResponse response, @RequestParam(value = "username") String userName)
     throws IOException {
   PetInfos petInfos = petInfoDao.getPetInfos(userName);
   petInfos.setResult("0");
   String json = JSONUtil.toString(petInfos);
   response.getWriter().print(json);
 }