| | |
| | | package com.lf.server.controller.data; |
| | | |
| | | import com.lf.server.annotation.SysLog; |
| | | import com.lf.server.controller.all.BaseController; |
| | | import com.lf.server.controller.all.BaseQueryController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.ctrl.CountEntity; |
| | |
| | | @Api(tags = "数据管理\\数据统计") |
| | | @RestController |
| | | @RequestMapping("/dataCount") |
| | | public class DataCountController extends BaseQueryController { |
| | | public class DataCountController extends BaseController { |
| | | @Autowired |
| | | ReportService reportService; |
| | | |
| | |
| | | @ApiOperation(value = "分页查询并返回记录数") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "code", value = "编码", dataType = "String", paramType = "query", example = "countOperates"), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPageAndCount") |
| | | public ResponseMsg<List<ReportEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { |
| | | public ResponseMsg<List<ReportEntity>> selectByPageAndCount(String name, String code, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("每页页数或分页数小于1", null); |
| | | } |
| | | |
| | | int count = reportService.selectCount(name); |
| | | int count = reportService.selectCount(name, code); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<ReportEntity> rs = reportService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); |
| | | List<ReportEntity> rs = reportService.selectByPage(name, code, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |