@RequiresPermissions({"categoryWord-delete"})
  @RequestMapping(
      method = RequestMethod.POST,
      value = "/deleteCategoryWord",
      headers = "Accept=application/json")
  public @ResponseBody boolean deleteCategoryWord(@RequestBody List list) throws Exception {
    OperationLog operationLog = systemLogService.record("类别词", "批量删除", "类别词列表:");
    String logParams = "";

    for (int i = 0; i < list.size(); i++) {
      LinkedHashMap<String, String> map = (LinkedHashMap<String, String>) list.get(i);
      Set<String> keySet = map.keySet();
      String id = map.get("id");
      // 与元数据关联的不能删除
      String esglisgAb = map.get("esglisgAb");
      List<Metadata> metadatas = metadataService.findBy("categoryWordId", esglisgAb);
      if (metadatas.size() > 0) {
        return false;
      }
      categoryWordService.deleteById(id);
      logParams += esglisgAb + ",";
    }

    operationLog.setParams("类别词列表(英文缩写):" + logParams);
    systemLogService.updateResult(operationLog);
    return true;
  }
  @RequestMapping(value = "/classmates", method = RequestMethod.GET)
  public String getClassmates(Model model) {
    User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    model.addAttribute("current_user", user);
    Student currentStudent = studentService.getOne(user.getId());

    if (user.getRole().equals(Role.ROLE_STUDENT))
      model.addAttribute("homework", currentStudent.getGroup().getHomeworks());

    TreeMap<Double, String> studentsMap = new TreeMap<>(Collections.reverseOrder());
    currentStudent
        .getGroup()
        .getStudents()
        .forEach(
            student ->
                studentsMap.put(
                    studentService.getAverageScore(student.getId()), student.getFullName()));

    LinkedHashMap<String, String> studentsMapForFreemarker = new LinkedHashMap<>();

    studentsMap
        .entrySet()
        .forEach(
            entry ->
                studentsMapForFreemarker.put(String.valueOf(entry.getKey()), entry.getValue()));

    model.addAttribute("studentsMap", studentsMapForFreemarker);
    return "student/classmates";
  }
 @RequiresPermissions({"categoryWord-add"})
 @RequestMapping(
     method = RequestMethod.POST,
     value = "/saveCategoryWord/{type}",
     headers = "Accept=application/json")
 public @ResponseBody boolean saveCategoryWord(
     @RequestBody List list, @PathVariable String type) { // type 1 insert  2 update
   OperationLog operationLog = systemLogService.record("类别词", "批量保存", "类别词列表:");
   String logParams = "";
   for (int i = 0; i < list.size(); i++) {
     LinkedHashMap<String, String> map = (LinkedHashMap<String, String>) list.get(i);
     List<CategoryWord> list1 = categoryWordService.findBy("englishWord", map.get("esglisgAb"));
     List<CategoryWord> list2 = categoryWordService.findBy("chineseWord", map.get("chineseWord"));
     if ((list1.size() > 0 || list2.size() > 0) && type.equals("1")) {
       return false;
     }
     CategoryWord categoryWord = null;
     if (type.equals("1")) {
       categoryWord = new CategoryWord();
     } else if (type.equals("2")) {
       categoryWord = categoryWordService.getById(map.get("id"));
     }
     categoryWord.setId(map.get("id"));
     categoryWord.setChineseWord(map.get("chineseWord"));
     // TZB没有englishWord
     //            categoryWord.setEnglishWord(map.get("englishWord"));
     categoryWord.setEnglishWord(map.get("esglisgAb"));
     categoryWord.setEsglisgAb(map.get("esglisgAb"));
     categoryWord.setRemark(map.get("remark"));
     categoryWord.setOptDate(DateUtils.format(new Date()));
     categoryWord.setOptUser(SecurityUtils.getSubject().getPrincipal().toString());
     categoryWordService.save(categoryWord);
     logParams += categoryWord.getChineseWord() + ",";
   }
   operationLog.setParams("类别词列表:" + logParams);
   systemLogService.updateResult(operationLog);
   return true;
 }