管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-10-27 5f6c5567bca385e0574c300537a2ef76db7e0b66
src/main/java/com/lf/server/controller/data/DataQueryController.java
@@ -7,8 +7,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.helper.AesHelper;
import com.lf.server.helper.ClassHelper;
import com.lf.server.helper.StringHelper;
import com.lf.server.mapper.all.GeomBaseMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -86,4 +88,34 @@
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "根据ID查询WKT")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "映射名称", dataType = "String", paramType = "query", example = "dlgAgnp"),
            @ApiImplicitParam(name = "gid", value = "GID", dataType = "Integer", paramType = "query", example = "1")
    })
    @GetMapping(value = "/selectWktById")
    public ResponseMsg<String> selectWktById(String name, Integer gid) {
        try {
            if (StringHelper.isEmpty(name)) {
                return fail("名称空间和实体名称不能为空", null);
            }
            Object obj = ClassHelper.getBean(name.trim() + "Mapper");
            if (!(obj instanceof GeomBaseMapper)) {
                return fail("查询对象不存在", null);
            }
            GeomBaseMapper baseMapper = (GeomBaseMapper) obj;
            String wkt = baseMapper.selectWktById(gid);
            if (!StringHelper.isEmpty(wkt)) {
                wkt = AesHelper.encrypt(wkt);
            }
            return success(wkt);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
}