Beispiel #1
0
  /**
   * @Description: 保存分供方车型信息
   *
   * @return String 跳转的页面
   * @throws
   */
  @RequestMapping(value = "/save", method = RequestMethod.POST)
  @ResponseBody
  public Map<String, Object> save(HttpServletRequest request, TSubCarStyle tSubCarStyle) {
    try {
      /** 验证重复性 */
      TUser user = (TUser) request.getSession().getAttribute("user");
      String subno = subService.get(user.getiArchive()).getVcSubno();
      String[] properties = {"vcCarStyle", "NEnable", "vcSubno"};
      Object[] values = {tSubCarStyle.getVcCarStyle(), 0, subno};
      List<TSubCarStyle> tSubCarStyles = subCarStyleService.findByProperties(properties, values);
      if (tSubCarStyles != null && tSubCarStyles.size() > 0) {
        return AjaxUtil.getMap(false, "商品车【" + tSubCarStyle.getVcCarStyle() + "】重复!");
      }

      if (tSubCarStyle.getId() == null) {

        tSubCarStyle.setVcSubno(subno);
        subCarStyleService.save(tSubCarStyle);
        return AjaxUtil.getMap(true, "成功!");
      } else {
        subCarStyleService.update(tSubCarStyle);
        return AjaxUtil.getMap(true, "成功!");
      }

    } catch (Exception e) {
      return AjaxUtil.getMapByException(e);
    }
  }
Beispiel #2
0
 /**
  * @Description: 获取该分供方所有的车型信息
  *
  * @return String 跳转的页面
  * @throws
  */
 @RequestMapping(value = "/getAllSubCarStyle", method = RequestMethod.POST)
 @ResponseBody
 public Map<String, Object> getAllSubCarStyle(HttpServletRequest request) {
   HttpSession session = request.getSession();
   TUser user = (TUser) session.getAttribute("user");
   int archid = user.getIArchiveType();
   String subno = subService.get(user.getiArchive()).getVcSubno();
   Page page = ServiceUtil.getcurrPage(request);
   HqlHelper hql = new HqlHelper(TSubCarStyle.class);
   hql.addEqual("vcSubno", subno);
   // hql.addEqual( "NEnable" , SystemConstants.SYS_ENABLE );
   hql.setQueryPage(page);
   Map<String, Object> resultMap = null;
   // 该用户类型等于分供方
   if (archid == SystemConstants.SYS_TARCHIVE_SUB) {
     try {
       resultMap = subCarStyleService.findAllByHql(hql);
       return resultMap;
     } catch (Exception e) {
       return AjaxUtil.getMapByException(e);
     }
   }
   return resultMap;
 }