コード例 #1
0
  @RequestMapping("/Subjectmajor/addlist")
  @ResponseBody
  public Map<String, Object> addSubjectMajorByids(HttpServletRequest request) {
    try {
      String ids = request.getParameter("ids");
      Long subjectId = Long.parseLong(request.getParameter("subjectId"));
      Subject subject = new Subject();
      subject.setSubjectId(subjectId);
      subject = subjectService.getSubjectBySubjectId(subject);
      if (ObjectUtils.isNull(subject.getParentId()) || subject.getParentId().intValue() == 0) {
        this.setJson(false, "subjectIdError", null);
        return json;
      }
      ids = ids.replace(",", " ").trim().replace(" ", ",");
      if (ObjectUtils.isNotNull(ids)) {
        String[] idsArray = ids.split(",");
        List<SubjectMajor> subList = new ArrayList<SubjectMajor>();
        for (int i = 0; i < idsArray.length; i++) {
          SubjectMajor subjectMajor = new SubjectMajor();

          subjectMajor.setMajorid(Long.parseLong(idsArray[i]));
          subjectMajor.setSubjectid(subjectId);
          subList.add(subjectMajor);
        }
        subjectMajorService.addSubjectMajorBatch(subList);

        this.setJson(true, "success", null);
      }

    } catch (Exception e) {
      this.setJson(false, "error", null);
      logger.info("MagorController------addSubjectMajorByids");
    }
    return json;
  }
コード例 #2
0
  @RequestMapping("/Subjectmajor/add/tz")
  public String addqueryMagorListByPgae(HttpServletRequest request, @ModelAttribute Major major) {
    try {
      List<Major> maList = majorService.queryMagorListByPgae(major);
      QuerySubject querySubject = new QuerySubject();
      List<Subject> subjectList = subjectService.getSubjectList(querySubject);
      request.setAttribute("subjectList", gson.toJson(subjectList));
      request.setAttribute("maList", maList);

    } catch (Exception e) {
      logger.info("SubjectMajorController------addqueryMagorListByPgae", e);
    }
    return addSubjectMajorByPage;
  }
コード例 #3
0
 /** 获取课程列表 * */
 @RequestMapping("/user/courseList")
 public ModelAndView toCourseForClass(
     @ModelAttribute("queryCourse") QueryCourse queryCourse,
     @ModelAttribute("page") PageEntity page) {
   ModelAndView modelAndView = new ModelAndView();
   modelAndView.setViewName(courseList);
   QuerySubject querySubject = new QuerySubject();
   try {
     this.setPage(page);
     // 搜索课程列表
     List<CourseDto> courseList = courseService.getCourseListPage(queryCourse, page);
     List<Subject> subjectList = subjectService.getSubjectList(querySubject);
     modelAndView.addObject("courseList", courseList);
     modelAndView.addObject("subjectList", gson.toJson(subjectList));
     modelAndView.addObject("page", page);
     modelAndView.addObject("userId", queryCourse.getUserId());
   } catch (Exception e) {
   }
   return modelAndView;
 }
コード例 #4
0
  @RequestMapping("/SubjectMajor/page")
  public String querySubjectMajorByPage(
      HttpServletRequest request,
      @ModelAttribute SubjectMajor subjectMajor,
      @ModelAttribute("page") PageEntity page) {

    try {
      this.setPage(page);
      this.getPage().setPageSize(10);
      QuerySubject querySubject = new QuerySubject();
      List<Subject> subjectList = subjectService.getSubjectList(querySubject);
      List<SubjectMajor> subjectMajorlist =
          subjectMajorService.querySubjectMajorByPage(subjectMajor, page);

      request.setAttribute("subjectMajorlist", subjectMajorlist);
      request.setAttribute("subjectList", gson.toJson(subjectList));
      request.setAttribute("subjectMajor", subjectMajor);
      request.setAttribute("page", getPage());
    } catch (Exception e) {
      logger.info("SubjectMajorController---------querySubjectMajorByPage", e);
    }

    return querySubjectMajorByPage;
  }