Exemplo n.º 1
0
 @ResponseBody
 @RequestMapping("/delete/exec")
 public Result<?> doDelete(HttpServletRequest request, Website website) {
   Result<?> result = new Result<Object>();
   if (null != website && null != website.getId()) {
     Map<String, Object> criteria = new HashMap<String, Object>();
     criteria.put("id", website.getId());
     this.websiteApplication.removeEntity(criteria);
     result.setResultCode(Constants.Common.DEFAULT_RESULT_CODE);
   }
   return result;
 }
Exemplo n.º 2
0
  @ResponseBody
  @RequestMapping("/list/exec")
  public Result<?> doList(HttpServletRequest request, Website website) {
    Result<List<Website>> result = new Result<List<Website>>();

    try {
      Map<String, Object> criteria = new HashMap<String, Object>();
      criteria.put("category", website.getCategory());
      criteria.put("siteName", website.getSiteName());
      List<Website> websites = websiteApplication.listEntities(criteria);
      result.setData(websites);
      result.setResultCode(Constants.Common.DEFAULT_RESULT_CODE);
    } catch (ServiceException e) {
      result.setResultCode(e.getErrorNo());
    }
    return result;
  }
Exemplo n.º 3
0
 @ResponseBody
 @RequestMapping("/validate/nameUnique")
 public boolean validateNameUnique(HttpServletRequest request, Website website) {
   if (null != website && !StringUtils.isEmpty(website.getSiteName())) {
     return this.websiteApplication.validateNameUnique(website);
   }
   return false;
 }
Exemplo n.º 4
0
  @RequestMapping("/list")
  public ModelAndView list(
      HttpServletRequest request, ModelAndView mv, Website website, Pagination pagination) {
    Map<String, Object> criteria = new HashMap<String, Object>();
    criteria.put("category", website.getCategory());
    criteria.put("siteName", website.getSiteName());
    pagination = websiteApplication.listEntities(criteria, pagination);

    mv.setViewName(Views.LIST_VIEW);
    mv.addObject(Keys.KEY_PARAM, website);
    mv.addObject(Keys.KEY_PAGE, pagination);
    if (null != pagination) {
      mv.addObject(Keys.KEY_PAGE_DATA, pagination.getDatas());
    }

    // 获取一级分类
    List<Category> categorys = this.categoryApplication.listEntities(new HashMap<String, Object>());
    mv.addObject("categorys", categorys);
    return mv;
  }
Exemplo n.º 5
0
  @RequestMapping("/edit")
  public ModelAndView edit(HttpServletRequest request, ModelAndView mv, Website website) {
    if (null == website || null == website.getId()) {
      throw new UnifyException(SystemErrorNo.DATA_NOT_EXIST_ERROR);
    }

    Map<String, Object> criteria = new HashMap<String, Object>();
    website = this.websiteApplication.findEntity(criteria);
    if (null == website) {
      throw new UnifyException(SystemErrorNo.DATA_NOT_EXIST_ERROR);
    }

    mv.setViewName(Views.EDIT_VIEW);
    mv.addObject(Keys.KEY_PARAM, website);
    return mv;
  }