public class ClazzController { @Autowired private GradeService gradeService; @Autowired private ClazzService clazzService; /** * 班级列表页 * @param model * @return */ @RequestMapping(value="/list",method=RequestMethod.GET) public ModelAndView list(ModelAndView model){ model.setViewName("clazz/clazz_list"); List<Grade> findAll = gradeService.findAll(); model.addObject("gradeList",findAll ); model.addObject("gradeListJson",JSONArray.fromObject(findAll)); return model; }给这段代码加上注释
时间: 2024-03-03 22:53:30 浏览: 141
```
public class ClazzController {
@Autowired
private GradeService gradeService; // 注入年级服务
@Autowired
private ClazzService clazzService; // 注入班级服务
/**
* 班级列表页
* @param model
* @return
*/
@RequestMapping(value="/list",method=RequestMethod.GET)
public ModelAndView list(ModelAndView model){
model.setViewName("clazz/clazz_list"); // 设置视图名称为 clazz/clazz_list
List<Grade> findAll = gradeService.findAll(); // 获取所有年级信息
model.addObject("gradeList",findAll ); // 将年级信息添加到视图中
model.addObject("gradeListJson",JSONArray.fromObject(findAll)); // 将年级信息转换为 JSON 字符串并添加到视图中
return model; // 返回视图模型
}
}
```
注释已经添加在代码中。
阅读全文