コード例 #1
0
  @RequestMapping(value = "/projectPageOne")
  public String projectPageOne(
      @ModelAttribute("projectGroup") ProjectGroup projectGroup, ModelMap modelMap) {

    if (projectGroup.getId() != null && !projectGroup.getId().equals("NONE")) {
      ProjectPageOne projectPageOne = projectPageOneService.getProjectPageOne(projectGroup.getId());
      if (projectPageOne == null) {
        projectPageOne = new ProjectPageOne();
        projectPageOne.setId(projectGroup.getId());
      }

      if (projectPageOne.getProjectGroup() == null)
        projectPageOne.setProjectGroup(projectGroupService.getProjectGroup(projectGroup.getId()));
      modelMap.addAttribute("projectGroupName", projectPageOne.getProjectGroup().getName());
      modelMap.addAttribute("projectPageOne", projectPageOne);
    } else {
      modelMap.addAttribute("projectPageOne", new ProjectPageOne());
    }

    return "/projectPageOne";
  }
コード例 #2
0
  @RequestMapping(value = "/projectGroupInsertSubmit")
  public String projectGroupInsertSubmit(
      @ModelAttribute("projectGroup") ProjectGroup projectGroup, ModelMap modelMap) {

    int mailNum = projectGroup.getMailNum();
    List<MailConfig> mailConfigList = new ArrayList<MailConfig>();
    for (int i = 1; i <= mailNum; i++) {
      MailConfig mailConfig = new MailConfig();
      mailConfig.setProjectGroup(projectGroup);
      mailConfig.setMailOrderNum(i);
      mailConfig.setName("第" + i + "封");
      mailConfig.setSubject("第" + i + "封");
      mailConfig.setText("尚未設定內容");
      //			mailConfigService.insertMailConfig(mailConfig);
      mailConfigList.add(mailConfig);

      //			projectGroupService.updateProjectGroup(projectGroup);
    }
    projectGroup.setMailConfigList(mailConfigList);
    projectGroupService.saveProjectGroup(projectGroup);

    return "forward:/projectGroupList.html";
  }