/** *自動生成頁面----查看數據 */ @RequestMapping(value = "opinionsView") public String opinionsView(Model model ,String notesId){ List<Opinions> opinions = opinionsDao.getOpinionsByNotesId(notesId); model.addAttribute("opinions",opinions); return "modules/opinions/opinionsNotes"; }
/** * 新增頁面 */ //@RequiresPermissions("opinions:opinions:list") @RequestMapping(value = {"opinionsView", ""}) public String opinionsView(String notesId,Opinions opinions, HttpServletRequest request, HttpServletResponse response, Model model) { opinions.setNotesId(notesId);//傳入id Page<Opinions> page = opinionsService.findPage(new Page<Opinions>(request, response), opinions); model.addAttribute("page", page); return "modules/opinions/opinionsNotes"; }
<!-- jsp頁面分頁代碼 --> <table:page page="${page}"></table:page>
<!--jsp頁面傳入參數--> <a href="#" onclick="openDialogView('查看錶單', '${ctx}/opinions/opinions/form?id=${opinions.id}','800px', '500px')" class="btn btn-info btn-xs" ><i class="fa fa-search-plus"></i> 查看</a>
<!--根據條件獲取相應的值--> <select id="findList" resultType="Opinions" > SELECT <include refid="opinionsColumns"/> FROM opinions a <include refid="opinionsJoins"/> <where> a.del_flag = #{DEL_FLAG_NORMAL} <if test="notesId != null and notesId != ''"> AND a.notes_id = #{notesId } </if> </where> <choose> <when test="page !=null and page.orderBy != null and page.orderBy != ''"> ORDER BY ${page.orderBy} </when> <otherwise> ORDER BY a.update_date DESC </otherwise> </choose> </select>