| | |
| | | /logs |
| | | /QGIS/.vs |
| | | /QGIS/render.png |
| | | /QGIS/*.png |
| | |
| | | <Layout printResolution="300" name="Template" units="mm" worldFileMap="{4e649c5d-cabe-431f-a385-d69809d87ebf}"> |
| | | <Layout printResolution="150" name="Template" units="mm" worldFileMap="{4e649c5d-cabe-431f-a385-d69809d87ebf}"> |
| | | <Snapper tolerance="5" snapToGuides="1" snapToGrid="0" snapToItems="1"/> |
| | | <Grid offsetX="0" offsetY="0" resolution="10" resUnits="mm" offsetUnits="mm"/> |
| | | <PageCollection> |
| | |
| | | </LayoutItem> |
| | | <GuideCollection visible="1"/> |
| | | </PageCollection> |
| | | <LayoutItem templateUuid="{13528ba9-5ea4-45e3-b56e-a975eb046d54}" background="false" position="212.337,195.29,mm" type="65641" labelText="中国石油天然气管道工程有限公司" id="" groupUuid="" zValue="8" uuid="{13528ba9-5ea4-45e3-b56e-a975eb046d54}" opacity="1" referencePoint="0" visibility="1" excludeFromExports="0" htmlState="0" size="76.0244,9.39831,mm" itemRotation="0" outlineWidthM="0.3,mm" valign="128" positionLock="true" halign="4" frame="false" frameJoinStyle="miter" blendMode="0" positionOnPage="212.337,195.29,mm" marginY="0" marginX="0"> |
| | | <LayoutItem anchorPoint="0" templateUuid="{6a1655ac-d65f-4163-9e89-5f98536a0c31}" background="false" mode="0" position="277.938,2.42978,mm" type="65640" svgFillColor="255,255,255,255" pictureRotation="0" northMode="0" id="指北针" groupUuid="" zValue="8" uuid="{6a1655ac-d65f-4163-9e89-5f98536a0c31}" opacity="1" referencePoint="0" visibility="1" file=":/images/north_arrows/layout_default_north_arrow.svg" mapUuid="{4e649c5d-cabe-431f-a385-d69809d87ebf}" resizeMode="0" excludeFromExports="0" svgBorderWidth="0.2" size="10.4237,11.1743,mm" itemRotation="0" svgBorderColor="0,0,0,255" outlineWidthM="0.3,mm" positionLock="true" frame="false" pictureWidth="8.85237" frameJoinStyle="miter" pictureHeight="11.1743" blendMode="0" positionOnPage="277.938,2.42978,mm" northOffset="0"> |
| | | <FrameColor blue="0" green="0" red="0" alpha="255"/> |
| | | <BackgroundColor blue="255" green="255" red="255" alpha="255"/> |
| | | <LayoutObject> |
| | | <dataDefinedProperties> |
| | | <Option type="Map"> |
| | | <Option type="QString" value="" name="name"/> |
| | | <Option name="properties"/> |
| | | <Option type="QString" value="collection" name="type"/> |
| | | </Option> |
| | | </dataDefinedProperties> |
| | | <customproperties/> |
| | | </LayoutObject> |
| | | </LayoutItem> |
| | | <LayoutItem templateUuid="{13528ba9-5ea4-45e3-b56e-a975eb046d54}" background="false" position="212.337,195.29,mm" type="65641" labelText="中国石油天然气管道工程有限公司" id="公司" groupUuid="" zValue="8" uuid="{13528ba9-5ea4-45e3-b56e-a975eb046d54}" opacity="1" referencePoint="0" visibility="1" excludeFromExports="0" htmlState="0" size="76.0244,9.39831,mm" itemRotation="0" outlineWidthM="0.3,mm" valign="128" positionLock="true" halign="4" frame="false" frameJoinStyle="miter" blendMode="0" positionOnPage="212.337,195.29,mm" marginY="0" marginX="0"> |
| | | <FrameColor blue="0" green="0" red="0" alpha="255"/> |
| | | <BackgroundColor blue="255" green="255" red="255" alpha="255"/> |
| | | <LayoutObject> |
| | |
| | | <LabelFont description="宋体,14,-1,5,50,0,0,0,0,0,常规" style="常规"/> |
| | | <FontColor blue="0" green="0" red="0" alpha="255"/> |
| | | </LayoutItem> |
| | | <LayoutItem anchorPoint="0" templateUuid="{6a1655ac-d65f-4163-9e89-5f98536a0c31}" background="false" mode="0" position="277.938,2.42978,mm" type="65640" svgFillColor="255,255,255,255" pictureRotation="0" northMode="0" id="指北针" groupUuid="" zValue="8" uuid="{6a1655ac-d65f-4163-9e89-5f98536a0c31}" opacity="1" referencePoint="0" visibility="1" file=":/images/north_arrows/layout_default_north_arrow.svg" mapUuid="{4e649c5d-cabe-431f-a385-d69809d87ebf}" resizeMode="0" excludeFromExports="0" svgBorderWidth="0.2" size="10.4237,11.1743,mm" itemRotation="0" svgBorderColor="0,0,0,255" outlineWidthM="0.3,mm" positionLock="true" frame="false" pictureWidth="8.85237" frameJoinStyle="miter" pictureHeight="11.1743" blendMode="0" positionOnPage="277.938,2.42978,mm" northOffset="0"> |
| | | <FrameColor blue="0" green="0" red="0" alpha="255"/> |
| | | <BackgroundColor blue="255" green="255" red="255" alpha="255"/> |
| | | <LayoutObject> |
| | | <dataDefinedProperties> |
| | | <Option type="Map"> |
| | | <Option type="QString" value="" name="name"/> |
| | | <Option name="properties"/> |
| | | <Option type="QString" value="collection" name="type"/> |
| | | </Option> |
| | | </dataDefinedProperties> |
| | | <customproperties/> |
| | | </LayoutObject> |
| | | </LayoutItem> |
| | | <LayoutItem anchorPoint="0" templateUuid="{29298722-a58a-42f7-85d1-04564ad9366d}" background="false" mode="1" position="200.5,194.948,mm" type="65640" svgFillColor="255,255,255,255" pictureRotation="0" northMode="0" id="" groupUuid="" zValue="7" uuid="{29298722-a58a-42f7-85d1-04564ad9366d}" opacity="1" referencePoint="0" visibility="1" file="../../../CPPE/CPPE/imgs/logo.png" mapUuid="" resizeMode="0" excludeFromExports="0" svgBorderWidth="0.2" size="11.6809,10.7409,mm" itemRotation="0" svgBorderColor="0,0,0,255" outlineWidthM="0.3,mm" positionLock="true" frame="false" pictureWidth="11.4207" frameJoinStyle="miter" pictureHeight="10.7409" blendMode="0" positionOnPage="200.5,194.948,mm" northOffset="0"> |
| | | <LayoutItem anchorPoint="0" templateUuid="{29298722-a58a-42f7-85d1-04564ad9366d}" background="false" mode="1" position="200.5,194.948,mm" type="65640" svgFillColor="255,255,255,255" pictureRotation="0" northMode="0" id="Logo" groupUuid="" zValue="7" uuid="{29298722-a58a-42f7-85d1-04564ad9366d}" opacity="1" referencePoint="0" visibility="1" file="../../../CPPE/CPPE/imgs/logo.png" mapUuid="" resizeMode="0" excludeFromExports="0" svgBorderWidth="0.2" size="11.6809,10.7409,mm" itemRotation="0" svgBorderColor="0,0,0,255" outlineWidthM="0.3,mm" positionLock="true" frame="false" pictureWidth="11.4207" frameJoinStyle="miter" pictureHeight="10.7409" blendMode="0" positionOnPage="200.5,194.948,mm" northOffset="0"> |
| | | <FrameColor blue="0" green="0" red="0" alpha="255"/> |
| | | <BackgroundColor blue="255" green="255" red="255" alpha="255"/> |
| | | <LayoutObject> |
| | |
| | | <customproperties/> |
| | | </LayoutObject> |
| | | </LayoutItem> |
| | | <LayoutItem templateUuid="{81ccb104-2767-491d-8296-cd4ccbebed3e}" background="false" position="84.816,2.42978,mm" type="65641" labelText="管道基础大数据平台(DW1-1)" id="" groupUuid="" zValue="4" uuid="{81ccb104-2767-491d-8296-cd4ccbebed3e}" opacity="1" referencePoint="0" visibility="1" excludeFromExports="0" htmlState="0" size="129.364,11.1743,mm" itemRotation="0" outlineWidthM="0.3,mm" valign="128" positionLock="true" halign="4" frame="false" frameJoinStyle="miter" blendMode="0" positionOnPage="84.816,2.42978,mm" marginY="0" marginX="0"> |
| | | <LayoutItem templateUuid="{81ccb104-2767-491d-8296-cd4ccbebed3e}" background="false" position="84.816,2.42978,mm" type="65641" labelText="管道基础大数据平台(DW1-1)" id="标题" groupUuid="" zValue="4" uuid="{81ccb104-2767-491d-8296-cd4ccbebed3e}" opacity="1" referencePoint="0" visibility="1" excludeFromExports="0" htmlState="0" size="129.364,11.1743,mm" itemRotation="0" outlineWidthM="0.3,mm" valign="128" positionLock="true" halign="4" frame="false" frameJoinStyle="miter" blendMode="0" positionOnPage="84.816,2.42978,mm" marginY="0" marginX="0"> |
| | | <FrameColor blue="0" green="0" red="0" alpha="255"/> |
| | | <BackgroundColor blue="255" green="255" red="255" alpha="255"/> |
| | | <LayoutObject> |
| | |
| | | <LabelFont description="微软雅黑,24,-1,5,75,0,0,0,0,0,Bold" style="Bold"/> |
| | | <FontColor blue="0" green="0" red="0" alpha="255"/> |
| | | </LayoutItem> |
| | | <LayoutItem zValue="3" title="" referencePoint="0" equalColumnWidth="0" symbolAlignment="1" groupUuid="" wmsLegendHeight="25" size="53.5144,32.8004,mm" map_uuid="{4e649c5d-cabe-431f-a385-d69809d87ebf}" symbolHeight="4" legendFilterByAtlas="0" maxSymbolSize="0" opacity="1" splitLayer="0" symbolWidth="7" id="" columnSpace="2" position="12.9877,153.857,mm" fontColor="#000000" titleAlignment="1" wrapChar="" resizeToContents="0" itemRotation="0" rasterBorderColor="0,0,0,255" positionLock="true" lineSpacing="1" frameJoinStyle="miter" visibility="1" outlineWidthM="0.3,mm" minSymbolSize="0" templateUuid="{52b0f928-714f-4672-bc0b-a13e401f8465}" rasterBorderWidth="0" blendMode="0" type="65642" excludeFromExports="0" uuid="{52b0f928-714f-4672-bc0b-a13e401f8465}" boxSpace="2" frame="false" columnCount="1" background="true" wmsLegendWidth="50" positionOnPage="12.9877,153.857,mm" rasterBorder="1"> |
| | | <LayoutItem zValue="3" title="" referencePoint="0" equalColumnWidth="0" symbolAlignment="1" groupUuid="" wmsLegendHeight="25" size="53.5144,32.8004,mm" map_uuid="{4e649c5d-cabe-431f-a385-d69809d87ebf}" symbolHeight="4" legendFilterByAtlas="0" maxSymbolSize="0" opacity="1" splitLayer="0" symbolWidth="7" id="图例" columnSpace="2" position="12.9877,153.857,mm" fontColor="#000000" titleAlignment="1" wrapChar="" resizeToContents="0" itemRotation="0" rasterBorderColor="0,0,0,255" positionLock="true" lineSpacing="1" frameJoinStyle="miter" visibility="1" outlineWidthM="0.3,mm" minSymbolSize="0" templateUuid="{52b0f928-714f-4672-bc0b-a13e401f8465}" rasterBorderWidth="0" blendMode="0" type="65642" excludeFromExports="0" uuid="{52b0f928-714f-4672-bc0b-a13e401f8465}" boxSpace="2" frame="false" columnCount="1" background="true" wmsLegendWidth="50" positionOnPage="12.9877,153.857,mm" rasterBorder="1"> |
| | | <FrameColor blue="0" green="0" red="0" alpha="255"/> |
| | | <BackgroundColor blue="255" green="255" red="255" alpha="255"/> |
| | | <LayoutObject> |
| | |
| | | <layer-tree-group expanded="1" name="管道基础大数据平台" checked="Qt::Checked"> |
| | | <customproperties/> |
| | | <layer-tree-layer source="../../../../data/13.cppe/shps/VALVEHOUSEPOINT.shp" expanded="1" patch_size="-1,-1" legend_split_behavior="0" id="VALVEHOUSEPOINT_5d566d73_8061_447a_a9e3_3e7adad17bd7" name="阀室" checked="Qt::Checked" providerKey="ogr" legend_exp=""> |
| | | <customproperties/> |
| | | <customproperties> |
| | | <property value="阀室" key="cached_name"/> |
| | | </customproperties> |
| | | </layer-tree-layer> |
| | | <layer-tree-layer source="../../../../data/13.cppe/shps/SITEPOINT.shp" expanded="1" patch_size="-1,-1" legend_split_behavior="0" id="SITEPOINT_484a52d0_7a8e_4f9e_9ad3_d940e10e24d3" name="站场" checked="Qt::Checked" providerKey="ogr" legend_exp=""> |
| | | <customproperties/> |
| | | <customproperties> |
| | | <property value="站场" key="cached_name"/> |
| | | </customproperties> |
| | | </layer-tree-layer> |
| | | <layer-tree-layer source="../../../../data/13.cppe/shps/STATIONSERIES.shp" expanded="1" patch_size="-1,-1" legend_split_behavior="0" id="STATIONSERIES_5bfe7f3c_86b2_4fda_bae4_c44a33ab33e0" name="管道中心线" checked="Qt::Checked" providerKey="ogr" legend_exp=""> |
| | | <customproperties/> |
| | | <customproperties> |
| | | <property value="管道中心线" key="cached_name"/> |
| | | </customproperties> |
| | | </layer-tree-layer> |
| | | </layer-tree-group> |
| | | <layer-tree-group expanded="1" name="底图" checked="Qt::Checked"> |
| | |
| | | </customproperties> |
| | | <layer-tree-layer source="crs=EPSG:3857&format&type=xyz&url=http://t0.tianditu.gov.cn/DataServer?T%3Dcva_w%26x%3D%7Bx%7D%26y%3D%7By%7D%26l%3D%7Bz%7D%26tk%3D94a34772eb88317fcbf8428e10448561&zmax=18&zmin=0" expanded="1" patch_size="-1,-1" legend_split_behavior="0" id="天地图矢量注记_09d423fe_381d_40e5_9a42_f9e97684e6aa" name="矢量注记" checked="Qt::Checked" providerKey="wms" legend_exp=""> |
| | | <customproperties> |
| | | <property value="矢量注记" key="cached_name"/> |
| | | <property value="hidden" key="legend/title-style"/> |
| | | </customproperties> |
| | | </layer-tree-layer> |
| | | <layer-tree-layer source="crs=EPSG:3857&format&type=xyz&url=http://t0.tianditu.gov.cn/DataServer?T%3Dvec_w%26x%3D%7Bx%7D%26y%3D%7By%7D%26l%3D%7Bz%7D%26tk%3D94a34772eb88317fcbf8428e10448561&zmax=18&zmin=0" expanded="1" patch_size="-1,-1" legend_split_behavior="0" id="天地图矢量_1e2a46b5_e669_4761_b0ed_ac33ac334236" name="矢量图" checked="Qt::Checked" providerKey="wms" legend_exp=""> |
| | | <customproperties> |
| | | <property value="矢量图" key="cached_name"/> |
| | | <property value="hidden" key="legend/title-style"/> |
| | | </customproperties> |
| | | </layer-tree-layer> |
| | |
| | | </customproperties> |
| | | <layer-tree-layer source="crs=EPSG:3857&format&type=xyz&url=http://t0.tianditu.gov.cn/DataServer?T%3Dcia_w%26x%3D%7Bx%7D%26y%3D%7By%7D%26l%3D%7Bz%7D%26tk%3D94a34772eb88317fcbf8428e10448561&zmax=18&zmin=0" expanded="1" patch_size="-1,-1" legend_split_behavior="0" id="天地图影像注记_2812ff17_7124_4466_987d_72379b47749c" name="影像注记" checked="Qt::Checked" providerKey="wms" legend_exp=""> |
| | | <customproperties> |
| | | <property value="影像注记" key="cached_name"/> |
| | | <property value="hidden" key="legend/title-style"/> |
| | | </customproperties> |
| | | </layer-tree-layer> |
| | | <layer-tree-layer source="crs=EPSG:3857&format&type=xyz&url=http://t0.tianditu.gov.cn/DataServer?T%3Dimg_w%26x%3D%7Bx%7D%26y%3D%7By%7D%26l%3D%7Bz%7D%26tk%3D94a34772eb88317fcbf8428e10448561&zmax=18&zmin=0" expanded="1" patch_size="-1,-1" legend_split_behavior="0" id="天地图影像_676a0cc6_1fe3_4db1_95df_22c16a8b51ea" name="影像图" checked="Qt::Checked" providerKey="wms" legend_exp=""> |
| | | <customproperties> |
| | | <property value="影像图" key="cached_name"/> |
| | | <property value="hidden" key="legend/title-style"/> |
| | | </customproperties> |
| | | </layer-tree-layer> |
| | |
| | | <property value="0" key="imageCropMarginLeft"/> |
| | | <property value="0" key="imageCropMarginRight"/> |
| | | <property value="0" key="imageCropMarginTop"/> |
| | | <property value="true" key="imageCropToContents"/> |
| | | <property value="false" key="imageCropToContents"/> |
| | | <property value="true" key="singleFile"/> |
| | | </customproperties> |
| | | <Atlas pageNameExpression="" coverageLayer="" sortFeatures="0" filenamePattern="'output_'||@atlas_featurenumber" hideCoverage="0" enabled="0" filterFeatures="0"/> |
| | |
| | | import os |
| | | import math |
| | | from qgis.core import * |
| | | from qgis.gui import * |
| | | from qgis.PyQt.QtGui import * |
| | |
| | | |
| | | # layout = QgsPrintLayout(project) |
| | | layout = QgsLayout(project) |
| | | layout.initializeDefaults() |
| | | # layout.initializeDefaults() |
| | | |
| | | with open(r"E:/terrait/TianJin/LFServer/QGIS/Template.qpt", 'r', encoding='utf-8') as f: |
| | | template_content = f.read() |
| | |
| | | doc.setContent(template_content) |
| | | layout.loadFromTemplate(doc, QgsReadWriteContext(), True) |
| | | |
| | | # map = QgsLayoutItemMap(layout) |
| | | # # map.zoomToExtent(layers[0].extent()) |
| | | # layout.addItem(map) |
| | | |
| | | collection = layout.pageCollection() |
| | | collection.deletePage(0) |
| | | page = QgsLayoutItemPage(layout) |
| | | page.setPageSize('A5', True) |
| | | collection.addPage(page) |
| | | collection.redraw() |
| | | |
| | | # collection = layout.pageCollection() |
| | | # page = collection.page(0) |
| | | # # QgsUnitTypes.LayoutCentimeters |
| | | # size = QgsLayoutSize(2480, 1748, QgsUnitTypes.LayoutPixels) |
| | | # page.setPageSize('A3', True) |
| | | |
| | | # imgSetting = QgsLayoutExporter.ImageExportSettings() |
| | | # imgSetting.imageSize.width = 4096 |
| | | # imgSetting.imageSize.heigth = 3507 |
| | | map = layout.itemById(r'地图') |
| | | print(math.ceil(map.scale())) |
| | | |
| | | exporter = QgsLayoutExporter(layout) |
| | | img_path = os.path.join(r"E:/terrait/TianJin/LFServer/QGIS", "render.png") |
| | |
| | | layoutView.setContentsMargins(0, 0, 0, 0) |
| | | layoutView.setCurrentLayout(layout) |
| | | |
| | | # project.layoutManager().addLayout(layout) |
| | | # map = QgsLayoutItemMap(layout) |
| | | # map.zoomToExtent(iface.mapCanvas().extent()) |
| | | # # map.zoomToExtent(layers[0].extent()) |
| | | # # map.attemptResize(QgsLayoutSize(2480, 1748, QgsUnitTypes.LayoutPixels)) |
| | | # layout.addItem(map) |
| | | |
| | | # collection = layout.pageCollection() |
| | | # collection.deletePage(0) |
| | | # page = QgsLayoutItemPage(layout) |
| | | # page.setPageSize('A5', True) |
| | | # collection.addPage(page) |
| | | # collection.redraw() |
| | | |
| | | # collection = layout.pageCollection() |
| | | # page = collection.page(0) |
| | | # # QgsUnitTypes.LayoutCentimeters |
| | | # # size = QgsLayoutSize(2480, 1748, QgsUnitTypes.LayoutPixels) |
| | | # page.setPageSize('A5', True) |
| | | |
| | | # imgSetting = QgsLayoutExporter.ImageExportSettings() |
| | | # imgSetting.imageSize.width = 4096 |
| | | # imgSetting.imageSize.heigth = 3507 |
| | | |
| | | # layout.updateBounds() |
| | | # layout.refresh() |
| | | # page.redraw() |
| | | # collection.redraw() |
| | | |
| | | exporter = QgsLayoutExporter(layout) |
| | | img_path = os.path.join("e:/", "render.png") |
| | |
| | | @ApiOperation(value = "查询记录数") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ns", value = "名称空间", dataType = "String", paramType = "query", example = "bd"), |
| | | @ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", example = "dlg_25w_aanp") |
| | | @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 ns, String tab) { |
| | | public ResponseMsg<Integer> selectCount(String ns, String tab, String code) { |
| | | try { |
| | | int count = domainService.selectCount(ns, tab); |
| | | int count = domainService.selectCount(ns, tab, code); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | @ApiImplicitParams({ |
| | | @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 ns, String tab, 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(ns, tab, pageSize, pageSize * (pageIndex - 1)); |
| | | List<DomainEntity> rs = domainService.selectByPage(ns, tab, code, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | |
| | | @ApiImplicitParams({ |
| | | @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 ns, String tab, 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(ns, tab); |
| | | int count = domainService.selectCount(ns, tab, code); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<DomainEntity> rs = domainService.selectByPage(ns, tab, pageSize, pageSize * (pageIndex - 1)); |
| | | List<DomainEntity> rs = domainService.selectByPage(ns, tab, code, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | |
| | | /** |
| | | * 查询记录数 |
| | | * |
| | | * @param ns 名称空间 |
| | | * @param tab 表名 |
| | | * @param ns 名称空间 |
| | | * @param tab 表名 |
| | | * @param code 编码 |
| | | * @return 记录数 |
| | | */ |
| | | public Integer selectCount(String ns, String tab); |
| | | public Integer selectCount(String ns, String tab, String code); |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param ns 名称空间 |
| | | * @param tab 表名 |
| | | * @param code 编码 |
| | | * @param limit 记录表 |
| | | * @param offset 偏移量 |
| | | * @return 列表 |
| | | */ |
| | | public List<DomainEntity> selectByPage(String ns, String tab, Integer limit, Integer offset); |
| | | public List<DomainEntity> selectByPage(String ns, String tab, String code, Integer limit, Integer offset); |
| | | |
| | | /** |
| | | * 查询所有 |
| | |
| | | DomainMapper domainMapper; |
| | | |
| | | @Override |
| | | public Integer selectCount(String ns, String tab) { |
| | | return domainMapper.selectCount(ns, tab); |
| | | public Integer selectCount(String ns, String tab, String code) { |
| | | code = StringHelper.getLikeStr(code); |
| | | |
| | | return domainMapper.selectCount(ns, tab, code); |
| | | } |
| | | |
| | | @Override |
| | | public List<DomainEntity> selectByPage(String ns, String tab, Integer limit, Integer offset) { |
| | | return domainMapper.selectByPage(ns, tab, limit, offset); |
| | | public List<DomainEntity> selectByPage(String ns, String tab, String code, Integer limit, Integer offset) { |
| | | code = StringHelper.getLikeStr(code); |
| | | |
| | | return domainMapper.selectByPage(ns, tab, code, limit, offset); |
| | | } |
| | | |
| | | @Override |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.lf.server.mapper.data.DomainMapper"> |
| | | <select id="selectCount" resultType="java.lang.Integer"> |
| | | select count(*) from lf.sys_domain a inner join lf.sys_dict b on a.dom_name = b.domain_na |
| | | where b.ns = #{ns} and b.tab = #{tab} and b.domain_na is not null |
| | | select count(a.*) from lf.sys_domain a |
| | | where exists (select * from lf.sys_dict b where b.ns = #{ns} |
| | | <if test="tab != null"> |
| | | and b.tab = #{tab} |
| | | </if> |
| | | ) |
| | | <if test="code != null"> |
| | | and a.dom_code like #{code} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectByPage" resultType="com.lf.server.entity.data.DomainEntity"> |
| | | select a.* from lf.sys_domain a inner join lf.sys_dict b on a.dom_name = b.domain_na |
| | | where b.ns = #{ns} and b.tab = #{tab} and b.domain_na is not null |
| | | select a.* from lf.sys_domain a |
| | | where exists (select * from lf.sys_dict b where b.ns = #{ns} |
| | | <if test="tab != null"> |
| | | and b.tab = #{tab} |
| | | </if> |
| | | ) |
| | | <if test="code != null"> |
| | | and a.dom_code like #{code} |
| | | </if> |
| | | order by a.id |
| | | limit #{limit} offset #{offset} |
| | | </select> |