管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-02-21 60a470582d8ddf5d45441d6f73bdac235ecfc40f
1
已修改6个文件
37 ■■■■■ 文件已修改
data/update.sql 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/data/DataCountController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/sys/ReportController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/mapper/sys/ReportMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/sys/ReportService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sys/ReportMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
data/update.sql
@@ -216,7 +216,8 @@
select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName
from lf.sys_meta a where a.dircode like (select code from lf.sys_dir where name='西气东输四线天然气管道工程(吐鲁番-中卫)(00116DT02)') || '%';
select * from lf.sys_report order by id
select * from lf.sys_report order by code
select * from lf.sys_layer
src/main/java/com/lf/server/controller/data/DataCountController.java
@@ -1,6 +1,7 @@
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;
@@ -28,7 +29,7 @@
@Api(tags = "数据管理\\数据统计")
@RestController
@RequestMapping("/dataCount")
public class DataCountController extends BaseQueryController {
public class DataCountController extends BaseController {
    @Autowired
    ReportService reportService;
@@ -42,22 +43,23 @@
    @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) {
src/main/java/com/lf/server/controller/sys/ReportController.java
@@ -53,12 +53,12 @@
                return fail("每页页数或分页数小于1", null);
            }
            int count = reportService.selectCount(name);
            int count = reportService.selectCount(name, null);
            if (count == 0) {
                return success(0, null);
            }
            List<ReportEntity> rs = reportService.selectByPage(name, pageSize, pageSize * (pageIndex - 1));
            List<ReportEntity> rs = reportService.selectByPage(name, null, pageSize, pageSize * (pageIndex - 1));
            return success(count, rs);
        } catch (Exception ex) {
src/main/java/com/lf/server/mapper/sys/ReportMapper.java
@@ -18,19 +18,21 @@
     * 查询记录数
     *
     * @param name 名称
     * @param code 编码
     * @return 记录数
     */
    public Integer selectCount(String name);
    public Integer selectCount(String name, String code);
    /**
     * 分页查询
     *
     * @param name   名称
     * @param code   编码
     * @param limit  记录数
     * @param offset 偏移量
     * @return 列表
     */
    public List<ReportEntity> selectByPage(String name, Integer limit, Integer offset);
    public List<ReportEntity> selectByPage(String name, String code, Integer limit, Integer offset);
    /**
     * 查询所有
src/main/java/com/lf/server/service/sys/ReportService.java
@@ -35,17 +35,17 @@
    DownloadService downloadService;
    @Override
    public Integer selectCount(String name) {
    public Integer selectCount(String name, String code) {
        name = StringHelper.getLikeStr(name);
        return reportMapper.selectCount(name);
        return reportMapper.selectCount(name, code);
    }
    @Override
    public List<ReportEntity> selectByPage(String name, Integer limit, Integer offset) {
    public List<ReportEntity> selectByPage(String name, String code, Integer limit, Integer offset) {
        name = StringHelper.getLikeStr(name);
        return reportMapper.selectByPage(name, limit, offset);
        return reportMapper.selectByPage(name, code, limit, offset);
    }
    @Override
src/main/resources/mapper/sys/ReportMapper.xml
@@ -7,6 +7,9 @@
            <if test="name != null">
                name like #{name}
            </if>
            <if test="code != null">
                code = #{code}
            </if>
        </where>
    </select>
@@ -16,6 +19,9 @@
            <if test="name != null">
                name like #{name}
            </if>
            <if test="code != null">
                code = #{code}
            </if>
        </where>
        order by a.id desc
        limit #{limit} offset #{offset}