管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-11-07 d8ce4e1d7fe96410a5fab96f46649280024ab2d9
src/main/java/com/lf/server/controller/data/DomainController.java
@@ -3,8 +3,10 @@
import com.lf.server.aspect.SysLog;
import com.lf.server.controller.all.BaseController;
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.ctrl.TabEntity;
import com.lf.server.entity.data.DomainEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.service.all.BaseQueryService;
import com.lf.server.service.data.DomainService;
import com.lf.server.service.sys.TokenService;
import io.swagger.annotations.Api;
@@ -31,15 +33,20 @@
    @Autowired
    TokenService tokenService;
    @Autowired
    BaseQueryService baseQueryService;
    @SysLog()
    @ApiOperation(value = "查询记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "domName", value = "值域表名", dataType = "String", paramType = "query", required = false, example = "")
            @ApiImplicitParam(name = "ns", value = "名称空间", dataType = "String", paramType = "query", example = "bd"),
            @ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", example = "dlg_25w_aanp"),
            @ApiImplicitParam(name = "code", value = "编码", dataType = "String", paramType = "query", example = "210")
    })
    @GetMapping({"/selectCount"})
    public ResponseMsg<Integer> selectCount(String domName) {
    public ResponseMsg<Integer> selectCount(String ns, String tab, String code) {
        try {
            int count = domainService.selectCount(domName);
            int count = domainService.selectCount(ns, tab, code);
            return success(count);
        } catch (Exception ex) {
@@ -50,18 +57,20 @@
    @SysLog()
    @ApiOperation(value = "分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "domName", value = "值域表名", dataType = "String", paramType = "query", example = ""),
            @ApiImplicitParam(name = "ns", value = "名称空间", dataType = "String", paramType = "query", example = "bd"),
            @ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", example = "dlg_25w_aanp"),
            @ApiImplicitParam(name = "code", value = "编码", dataType = "String", paramType = "query", example = "210"),
            @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"),
            @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1")
    })
    @GetMapping(value = "/selectByPage")
    public ResponseMsg<List<DomainEntity>> selectByPage(String domName, Integer pageSize, Integer pageIndex) {
    public ResponseMsg<List<DomainEntity>> selectByPage(String ns, String tab, String code, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            List<DomainEntity> rs = domainService.selectByPage(domName, pageSize, pageSize * (pageIndex - 1));
            List<DomainEntity> rs = domainService.selectByPage(ns, tab, code, pageSize, pageSize * (pageIndex - 1));
            return success(rs);
        } catch (Exception ex) {
@@ -72,23 +81,25 @@
    @SysLog()
    @ApiOperation(value = "分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "domName", value = "值域表名", dataType = "String", paramType = "query", example = ""),
            @ApiImplicitParam(name = "ns", value = "名称空间", dataType = "String", paramType = "query", example = "bd"),
            @ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", example = "dlg_25w_aanp"),
            @ApiImplicitParam(name = "code", value = "编码", dataType = "String", paramType = "query", example = "210"),
            @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<DomainEntity>> selectByPageAndCount(String domName, Integer pageSize, Integer pageIndex) {
    public ResponseMsg<List<DomainEntity>> selectByPageAndCount(String ns, String tab, String code, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            int count = domainService.selectCount(domName);
            int count = domainService.selectCount(ns, tab, code);
            if (count == 0) {
                return success(0, null);
            }
            List<DomainEntity> rs = domainService.selectByPage(domName, pageSize, pageSize * (pageIndex - 1));
            List<DomainEntity> rs = domainService.selectByPage(ns, tab, code, pageSize, pageSize * (pageIndex - 1));
            return success(count, rs);
        } catch (Exception ex) {
@@ -110,6 +121,19 @@
    }
    @SysLog()
    @ApiOperation(value = "查询所有表")
    @GetMapping(value = "/selectTabs")
    public ResponseMsg<List<TabEntity>> selectTabs() {
        try {
            List<TabEntity> list = baseQueryService.selectTabs();
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "根据ID查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1")