Record a small problem, paging query on course
Reception obtain background data alert pop-up prompts undefined data through asynchronous request axios
Here are three bean
PageResult
/ **
* Package Object tab results * / public class PageResult the implements the Serializable { // total number of records Private Long Total; // this page results Private List rows;
// GET, SET method omits
....
}
QueryPageBean
/** * Packaging query * / Public class QueryPageBean the implements Serializable { // Page Private Integer currentPage; // records per page Private Integer pageSize; // query Private String queryString; // GET, SET method omits
.... }
Result
/** * Packaging return result * / Public class the Result the implements Serializable { // execution result, true for the successful implementation of false failure to implement the Private boolean Flag; // returns the result information, mainly for the page message Private String the Message; // return data Private Object the Data;
/ / GET, SET method omits
....
}
Controller layer
// returns to the foreground is a Result object @RequestMapping ( "/ findSetmeal" ) public Result findSetmeal (@RequestBody QueryPageBean queryPageBean) { the try { // -Service layer returns the object is a PageResult PageResult Page = setmealService.findPage (queryPageBean); return new new the Result ( to true , MessageConstant.QUERY_SETMEALLIST_SUCCESS, Page); } catch (Exception e) { return new Result(false, MessageConstant.QUERY_SETMEALLIST_FAIL); } }
Reception, obtaining background data alert prompts undefined, Code Red is an example of an error , due to the return of the object is a Result, Result has been packaged for PageResult
// paging query FindPage () { // set parameters var param = { currentPage: this.pagination.currentPage, pageSize: this.pagination.pageSize, queryString: this.pagination.queryString, }; axios.post("/setMeal/findPage.do", param).then((response) => { // alert(response.data.flag); // alert(response.data.total); // alert(response.data.rows); this.dataList = response.data.rows; this.pagination.total = response.data.total; this.dataList = response.data.data.rows; this.pagination.total = response.data.data.total; }) },