コード例 #1
0
ファイル: NoticeController.java プロジェクト: mougang/campus
  @RequestMapping(value = Module.NEWS_MODULE + "/choose")
  public String choose(@RequestParam Map<String, Object> map, Map<String, Object> result) {

    String ntcId = (String) map.get("ntcId");
    String way = (String) map.get("way");
    RelNoticeUserKey key = new RelNoticeUserKey();
    key.setNtcId(ntcId);

    OrgRole role = new OrgRole();
    // 选择所有的角色进行显示
    List<OrgRole> roleList = orgRoleService.selectByOrgRole(role);

    // 从rel_notice_user表查询已匹配的角色,选出所有的roleId
    List<String> ntcUserKey = relNoticeUserMapper.selectSelective(key);
    if (roleList != null && ntcUserKey != null) {
      for (int i = 0; i < roleList.size(); i++) {
        for (int j = 0; j < ntcUserKey.size(); j++) {
          if (roleList.get(i).getRoleId().equals(ntcUserKey.get(j))) {
            roleList.get(i).setFlag((short) 1);
          }
        }
      }
    }
    result.put("roleList", roleList);
    result.put("map", map);

    return Module.NEWS_MODULE + "/noticeChoosePeople";
  }
コード例 #2
0
ファイル: NoticeController.java プロジェクト: mougang/campus
  @RequestMapping(value = Module.NEWS_MODULE + "/chooseTarget")
  public String chooseTarget(@RequestParam Map<String, Object> map, Map<String, Object> result) {

    String ntcId = (String) map.get("ntcId");
    String orgId = (String) map.get("orgId");
    String way = (String) map.get("way");

    RelNoticeUserKey key = new RelNoticeUserKey();
    key.setNtcId(ntcId);
    // way == 1 按照角色进行选择,way ==2 按照班级进行选择
    if ("1".equals(way)) {
      // 选择所有的角色进行显示
      OrgRole role = new OrgRole();
      List<OrgRole> roleList = orgRoleService.selectByOrgRole(role);

      // 从rel_notice_user表查询已匹配的角色,选出所有的roleId
      List<String> ntcUserKey = relNoticeUserMapper.selectSelective(key);

      if (roleList != null && ntcUserKey != null) {
        for (int i = 0; i < roleList.size(); i++) {
          for (int j = 0; j < ntcUserKey.size(); j++) {
            if (roleList.get(i).getRoleId().equals(ntcUserKey.get(j))) {
              roleList.get(i).setFlag((short) 1);
            }
          }
        }
      }
      result.put("roleList", roleList);

    } else if ("2".equals(way)) {
      // 选择所有的班级
      OrgUser orgUser = new OrgUser();
      orgUser.setOrgId(orgId);
      List<ClassInfo> classList = classInfoService.selectClassListByOrgId(orgUser);

      // 从rel_notice_user表查询已匹配的班级,选出所有的classId
      List<String> ntcUserKey = relNoticeUserMapper.selectSelectedClasses(key);

      if (classList != null && ntcUserKey != null) {
        for (int i = 0; i < classList.size(); i++) {
          for (int j = 0; j < ntcUserKey.size(); j++) {
            if (classList.get(i).getClassId().equals(ntcUserKey.get(j))) {
              classList.get(i).setStation("checked");
            }
          }
        }
      }
      result.put("classList", classList);
    }
    result.put("map", map);

    return Module.NEWS_MODULE + "/noticeChoosePeople";
  }