예제 #1
0
  /**
   * ************** by stt
   *
   * @param map
   * @param result
   * @return
   */
  @Transactional
  @RequestMapping(value = Module.NEWS_MODULE + "/saveNoticeInfo")
  public String saveNoticeInfo(@RequestParam Map<String, Object> map, Map<String, Object> result) {
    int flag = -1;

    Notice notice = new Notice();

    String ntcId = (String) map.get("ntcId");
    String ntcTitle = (String) map.get("ntcTitle");
    String ntcContent = (String) map.get("ntcContent");
    String ntcDate = (String) map.get("ntcDate");
    String orgId = (String) map.get("orgId");
    String userId = (String) map.get("userId");

    notice.setNtcTitle(ntcTitle);
    notice.setNtcContent(ntcContent);
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    Date date = null;
    try {
      date = sdf.parse(ntcDate);
    } catch (ParseException e) {
      e.printStackTrace();
    }
    notice.setNtcDate(date);
    notice.setOrgId(orgId);
    notice.setUserId(userId);

    // ID, 插入
    if (ntcId != null && !"".equals(ntcId) && !"null".equals(ntcId)) {

      notice.setNtcId(ntcId);
      flag = noticeService.updateByPrimaryKeySelective(notice);
      if (flag == 1) {
        result.put("status", "更新成功!");
      } else {
        result.put("status", "更新失败!");
      }
    } else { // 新增
      ntcId = BaseUtil.createId();
      notice.setNtcId(ntcId);
      flag = noticeService.insertSelective(notice);

      if (flag == 1) {
        result.put("status", "新增成功!");
      } else {
        result.put("status", "新增失败!");
      }
    }

    return "redirect:selectNoticeList.action";
  }
예제 #2
0
  @RequestMapping(value = Module.NEWS_MODULE + "/insertNoticeInfo")
  public String insertNoticeInfo(
      HttpServletRequest request,
      HttpServletResponse response,
      @RequestParam Map<String, Object> map,
      Map<String, Object> result)
      throws IOException {
    Notice notice = new Notice();
    String noticeId = (String) map.get("ntcId");
    String orgId = (String) map.get("orgId");

    if (noticeId == null || noticeId.equals("") || noticeId.equals("null")) {
      notice.setOrgId(orgId);
      result.put("notice", notice);
    } else {
      notice = noticeService.selectOneByPrimaryKey(noticeId);
      result.put("notice", notice);
    }
    return Module.NEWS_MODULE + "/noticeEdit";
  }