前端頁面:
<a title="評語" href="#"
th:onclick="layer_show('評語','/admin/studentPaper/userListAfter/'+[[${paper.papersId}]]+'/'+[[${paper.studentUserId}]],900,500)"
class="ml-5" style="text-decoration:none">評語</a>
後端Controller代碼:
@RequestMapping("userListAfter/{papersId}/{studentUserId}")
public String userListAfter(Model model,@PathVariable("papersId") Long papersId,@PathVariable("studentUserId") Long studentUserId){
//拿到當前用戶名對應的信息
SysUser currentUser=sysUserMapper.selectByUsername(Utility.getCurrentUsername());
List<PaperReply> paperReplies=paperReplyService.selectReplysBetweens(currentUser.getId(),studentUserId,papersId);
SysUser otherUser=sysUserMapper.selectByPrimaryKey(studentUserId);
model.addAttribute("currentUser",currentUser);
model.addAttribute("otherUser",otherUser);
model.addAttribute("paperReplies",paperReplies);
model.addAttribute("paperId",papersId);
return prefix1+"replyTeacher";
}
這裏的路徑要對應
路徑傳參需要用這個進行接收