LsDistrictController
/*** 查询地段列表*/@ApiOperation("查询地段列表")@GetMapping("/list")public TableDataInfo list(LsDistrict lsDistrict) {startPage();Map<String, List> map = lsDistrictService.selectLsDistrictList(lsDistrict);if (CollectionUtils.isEmpty(map)) {return getDataTable(Lists.newArrayList());}return getDataTableTwice(map.get("listVo"),map.get("list"));}
ILsDistrictService
/*** 查询地段列表* * @param lsDistrict 地段* @return 地段集合*/public Map<String, List> selectLsDistrictList(LsDistrict lsDistrict);
LsDistrictServiceImpl
/*** 查询地段列表* * @param lsDistrict 地段* @return 地段*/@Overridepublic Map<String, List> selectLsDistrictList(LsDistrict lsDistrict) {List<LsDistrict> lsDistricts = lsDistrictMapper.selectLsDistrictList(lsDistrict);if (CollectionUtils.isEmpty(lsDistricts)) {return Maps.newHashMap();}List<LsDistrictVo> lsDistrictVos = Lists.newArrayList();// TODOMap<String, List> map = Maps.newHashMap();map.put("listVo",lsDistrictVos);map.put("list",lsDistricts);return map;}
响应请求分页数据
/*** 响应请求分页数据 (二次)** @param listVo 封装数据* @param list 原数据* @return*/@SuppressWarnings({ "rawtypes", "unchecked" })protected TableDataInfo getDataTableTwice(List<?> listVo, List<?> list){TableDataInfo rspData = new TableDataInfo();rspData.setCode(HttpStatus.SUCCESS);rspData.setMsg("查询成功");// 二次封装后的数据rspData.setRows(listVo);// 数据库查询的数据rspData.setTotal(new PageInfo(list).getTotal());return rspData;}
最终数据显示