管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2022-12-01 dcfa1ebe1e5c7d5eaa4a92edd72156c2714176eb
1
已添加35个文件
4416 ■■■■■ 文件已修改
ExportMap/Sources/geo.qgz 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/Sources/geo.qpt 591 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/Sources/geo_render.py 127 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/App.config 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/BsTemplate/Entity.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/BsTemplate/GeoEntity.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/BsTemplate/GeoMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/BsTemplate/Mapper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/DLL/Mono.Security.dll 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/DLL/Npgsql.dll 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/FrmMain.Designer.cs 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/FrmMain.cs 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/FrmMain.resx 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/FrmMyBatisPlus.Designer.cs 284 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/FrmMyBatisPlus.cs 397 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/FrmMyBatisPlus.resx 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/FrmSys.Designer.cs 410 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/FrmSys.cs 678 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/FrmSys.resx 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/JavaCode.csproj 156 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/Program.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/Properties/AssemblyInfo.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/Properties/Resources.Designer.cs 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/Properties/Resources.resx 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/Properties/Settings.Designer.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/Properties/Settings.settings 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/SysTemplate/Controller.java 253 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/SysTemplate/Entity.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/SysTemplate/Mapper.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/SysTemplate/Mapper.xml 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/SysTemplate/Service.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/SysTemplate/pg.sql 153 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/cs/ModelHandler.cs 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/cs/PostgreHelper.cs 174 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/cs/TabInfo.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/Sources/geo.qgz
Binary files differ
ExportMap/Sources/geo.qpt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,591 @@
<Layout units="mm" printResolution="300" worldFileMap="{c2e7494b-f754-46a4-9d6d-51420fcf9f74}" name="geo">
 <Snapper snapToItems="1" tolerance="5" snapToGrid="0" snapToGuides="1"/>
 <Grid offsetY="0" resUnits="mm" resolution="10" offsetX="0" offsetUnits="mm"/>
 <PageCollection>
  <symbol force_rhr="0" name="" type="fill" alpha="1" clip_to_extent="1">
   <layer enabled="1" locked="0" pass="0" class="SimpleFill">
    <prop v="3x:0,0,0,0,0,0" k="border_width_map_unit_scale"/>
    <prop v="255,255,255,255" k="color"/>
    <prop v="miter" k="joinstyle"/>
    <prop v="0,0" k="offset"/>
    <prop v="3x:0,0,0,0,0,0" k="offset_map_unit_scale"/>
    <prop v="MM" k="offset_unit"/>
    <prop v="35,35,35,255" k="outline_color"/>
    <prop v="no" k="outline_style"/>
    <prop v="0.26" k="outline_width"/>
    <prop v="MM" k="outline_width_unit"/>
    <prop v="solid" k="style"/>
    <data_defined_properties>
     <Option type="Map">
      <Option value="" name="name" type="QString"/>
      <Option name="properties"/>
      <Option value="collection" name="type" type="QString"/>
     </Option>
    </data_defined_properties>
   </layer>
  </symbol>
  <LayoutItem groupUuid="" background="true" size="297,210,mm" templateUuid="{49cb9f24-a1ce-4551-a5ae-ba845af53892}" blendMode="0" opacity="1" visibility="1" referencePoint="0" type="65638" positionOnPage="0,0,mm" position="0,0,mm" zValue="0" positionLock="false" itemRotation="0" outlineWidthM="0.3,mm" frameJoinStyle="miter" frame="false" uuid="{49cb9f24-a1ce-4551-a5ae-ba845af53892}" excludeFromExports="0" id="">
   <FrameColor green="0" blue="0" red="0" alpha="255"/>
   <BackgroundColor green="255" blue="255" red="255" alpha="255"/>
   <LayoutObject>
    <dataDefinedProperties>
     <Option type="Map">
      <Option value="" name="name" type="QString"/>
      <Option name="properties"/>
      <Option value="collection" name="type" type="QString"/>
     </Option>
    </dataDefinedProperties>
    <customproperties/>
   </LayoutObject>
   <symbol force_rhr="0" name="" type="fill" alpha="1" clip_to_extent="1">
    <layer enabled="1" locked="0" pass="0" class="SimpleFill">
     <prop v="3x:0,0,0,0,0,0" k="border_width_map_unit_scale"/>
     <prop v="255,255,255,255" k="color"/>
     <prop v="miter" k="joinstyle"/>
     <prop v="0,0" k="offset"/>
     <prop v="3x:0,0,0,0,0,0" k="offset_map_unit_scale"/>
     <prop v="MM" k="offset_unit"/>
     <prop v="35,35,35,255" k="outline_color"/>
     <prop v="no" k="outline_style"/>
     <prop v="0.26" k="outline_width"/>
     <prop v="MM" k="outline_width_unit"/>
     <prop v="solid" k="style"/>
     <data_defined_properties>
      <Option type="Map">
       <Option value="" name="name" type="QString"/>
       <Option name="properties"/>
       <Option value="collection" name="type" type="QString"/>
      </Option>
     </data_defined_properties>
    </layer>
   </symbol>
  </LayoutItem>
  <GuideCollection visible="1"/>
 </PageCollection>
 <LayoutItem mapUuid="{c2e7494b-f754-46a4-9d6d-51420fcf9f74}" groupUuid="" background="false" size="10.4237,11.1743,mm" templateUuid="{dd28aede-d877-4fa9-9cc2-0de19e79f0da}" blendMode="0" opacity="1" pictureHeight="11.1743" pictureWidth="8.85237" northOffset="0" svgFillColor="255,255,255,255" visibility="1" file=":/images/north_arrows/layout_default_north_arrow.svg" referencePoint="0" type="65640" positionOnPage="277.938,2.42978,mm" position="277.938,2.42978,mm" pictureRotation="0" zValue="8" positionLock="true" svgBorderColor="0,0,0,255" northMode="0" itemRotation="0" outlineWidthM="0.3,mm" frameJoinStyle="miter" frame="false" resizeMode="0" svgBorderWidth="0.2" anchorPoint="0" uuid="{dd28aede-d877-4fa9-9cc2-0de19e79f0da}" excludeFromExports="0" mode="0" id="指北针">
  <FrameColor green="0" blue="0" red="0" alpha="255"/>
  <BackgroundColor green="255" blue="255" red="255" alpha="255"/>
  <LayoutObject>
   <dataDefinedProperties>
    <Option type="Map">
     <Option value="" name="name" type="QString"/>
     <Option name="properties"/>
     <Option value="collection" name="type" type="QString"/>
    </Option>
   </dataDefinedProperties>
   <customproperties/>
  </LayoutObject>
 </LayoutItem>
 <LayoutItem groupUuid="" background="false" size="76.0244,9.39831,mm" templateUuid="{132788e0-98d4-469f-af33-23ef305f0322}" blendMode="0" opacity="1" valign="128" visibility="1" referencePoint="0" type="65641" marginY="0" positionOnPage="212.337,195.29,mm" position="212.337,195.29,mm" zValue="8" labelText="中国石油天然气管道工程有限公司" positionLock="true" itemRotation="0" outlineWidthM="0.3,mm" frameJoinStyle="miter" frame="false" marginX="0" uuid="{132788e0-98d4-469f-af33-23ef305f0322}" excludeFromExports="0" id="公司" htmlState="0" halign="4">
  <FrameColor green="0" blue="0" red="0" alpha="255"/>
  <BackgroundColor green="255" blue="255" red="255" alpha="255"/>
  <LayoutObject>
   <dataDefinedProperties>
    <Option type="Map">
     <Option value="" name="name" type="QString"/>
     <Option name="properties"/>
     <Option value="collection" name="type" type="QString"/>
    </Option>
   </dataDefinedProperties>
   <customproperties/>
  </LayoutObject>
  <LabelFont style="常规" description="宋体,14,-1,5,50,0,0,0,0,0,常规"/>
  <FontColor green="0" blue="0" red="0" alpha="255"/>
 </LayoutItem>
 <LayoutItem mapUuid="" groupUuid="" background="false" size="11.6809,10.7409,mm" templateUuid="{8d8bcce4-d783-4e1f-b85d-50a2cde45228}" blendMode="0" opacity="1" pictureHeight="10.7409" pictureWidth="11.4207" northOffset="0" svgFillColor="255,255,255,255" visibility="1" file="./logo.png" referencePoint="0" type="65640" positionOnPage="200.5,194.948,mm" position="200.5,194.948,mm" pictureRotation="0" zValue="7" positionLock="true" svgBorderColor="0,0,0,255" northMode="0" itemRotation="0" outlineWidthM="0.3,mm" frameJoinStyle="miter" frame="false" resizeMode="0" svgBorderWidth="0.2" anchorPoint="0" uuid="{8d8bcce4-d783-4e1f-b85d-50a2cde45228}" excludeFromExports="0" mode="1" id="Logo">
  <FrameColor green="0" blue="0" red="0" alpha="255"/>
  <BackgroundColor green="255" blue="255" red="255" alpha="255"/>
  <LayoutObject>
   <dataDefinedProperties>
    <Option type="Map">
     <Option value="" name="name" type="QString"/>
     <Option name="properties"/>
     <Option value="collection" name="type" type="QString"/>
    </Option>
   </dataDefinedProperties>
   <customproperties/>
  </LayoutObject>
 </LayoutItem>
 <LayoutItem groupUuid="" hidePageIfEmpty="0" background="false" size="43.1968,25.6574,mm" templateUuid="{33d726d8-6169-4351-997b-1564c5e4a026}" multiFrameTemplateUuid="{3f590e9a-19b4-46d3-90bb-6a188b24aaa6}" blendMode="0" opacity="1" hideBackgroundIfEmpty="0" visibility="1" referencePoint="0" multiFrame="{3f590e9a-19b4-46d3-90bb-6a188b24aaa6}" type="65647" positionOnPage="242.194,161,mm" position="242.194,161,mm" zValue="6" positionLock="true" sectionX="0" itemRotation="0" outlineWidthM="0.3,mm" frameJoinStyle="miter" frame="false" sectionY="0" uuid="{33d726d8-6169-4351-997b-1564c5e4a026}" excludeFromExports="0" sectionHeight="25.6574" id="说明" sectionWidth="43.1968">
  <FrameColor green="0" blue="0" red="0" alpha="255"/>
  <BackgroundColor green="255" blue="255" red="255" alpha="255"/>
  <LayoutObject>
   <dataDefinedProperties>
    <Option type="Map">
     <Option value="" name="name" type="QString"/>
     <Option name="properties"/>
     <Option value="collection" name="type" type="QString"/>
    </Option>
   </dataDefinedProperties>
   <customproperties/>
  </LayoutObject>
 </LayoutItem>
 <LayoutItem groupUuid="" background="false" size="129.364,11.1743,mm" templateUuid="{c4396cf7-2960-43ac-b2a3-7753f581f9b3}" blendMode="0" opacity="1" valign="128" visibility="1" referencePoint="0" type="65641" marginY="0" positionOnPage="84.816,2.42978,mm" position="84.816,2.42978,mm" zValue="4" labelText="管道基础大数据平台(DW1-1)" positionLock="true" itemRotation="0" outlineWidthM="0.3,mm" frameJoinStyle="miter" frame="false" marginX="0" uuid="{c4396cf7-2960-43ac-b2a3-7753f581f9b3}" excludeFromExports="0" id="标题" htmlState="0" halign="4">
  <FrameColor green="0" blue="0" red="0" alpha="255"/>
  <BackgroundColor green="255" blue="255" red="255" alpha="255"/>
  <LayoutObject>
   <dataDefinedProperties>
    <Option type="Map">
     <Option value="" name="name" type="QString"/>
     <Option name="properties"/>
     <Option value="collection" name="type" type="QString"/>
    </Option>
   </dataDefinedProperties>
   <customproperties/>
  </LayoutObject>
  <LabelFont style="Bold" description="微软雅黑,24,-1,5,75,0,0,0,0,0,Bold"/>
  <FontColor green="0" blue="0" red="0" alpha="255"/>
 </LayoutItem>
 <LayoutItem columnCount="1" wmsLegendHeight="18" position="12.988,153.18,mm" maxSymbolSize="0" splitLayer="0" rasterBorderColor="0,0,0,255" uuid="{88fdb1df-998d-4a99-8607-f97bc16a111c}" visibility="1" id="图例" lineSpacing="1" frame="true" background="true" templateUuid="{88fdb1df-998d-4a99-8607-f97bc16a111c}" blendMode="11" referencePoint="0" excludeFromExports="0" groupUuid="" opacity="1" outlineWidthM="0.1,mm" title="" frameJoinStyle="round" wrapChar="" itemRotation="0" rasterBorder="0" boxSpace="2" wmsLegendWidth="25" symbolHeight="4" fontColor="#000000" legendFilterByAtlas="0" equalColumnWidth="0" map_uuid="{c2e7494b-f754-46a4-9d6d-51420fcf9f74}" type="65642" minSymbolSize="0" titleAlignment="1" resizeToContents="0" zValue="3" size="33.5479,31.4278,mm" positionLock="true" rasterBorderWidth="0" symbolAlignment="1" positionOnPage="12.988,153.18,mm" symbolWidth="7" columnSpace="2">
  <FrameColor green="0" blue="0" red="0" alpha="255"/>
  <BackgroundColor green="255" blue="255" red="255" alpha="255"/>
  <LayoutObject>
   <dataDefinedProperties>
    <Option type="Map">
     <Option value="" name="name" type="QString"/>
     <Option name="properties"/>
     <Option value="collection" name="type" type="QString"/>
    </Option>
   </dataDefinedProperties>
   <customproperties/>
  </LayoutObject>
  <styles>
   <style alignment="1" marginBottom="3.5" name="title">
    <styleFont style="" description="SimSun,16,-1,5,50,0,0,0,0,0"/>
   </style>
   <style marginTop="3" alignment="2" name="group">
    <styleFont style="" description="SimSun,14,-1,5,50,0,0,0,0,0"/>
   </style>
   <style marginTop="3" alignment="1" name="subgroup">
    <styleFont style="" description="SimSun,12,-1,5,50,0,0,0,0,0"/>
   </style>
   <style marginTop="2.5" alignment="1" name="symbol">
    <styleFont style="" description="SimSun,9,-1,5,50,0,0,0,0,0"/>
   </style>
   <style marginTop="2" alignment="1" marginLeft="2" name="symbolLabel">
    <styleFont style="" description="SimSun,12,-1,5,50,0,0,0,0,0"/>
   </style>
  </styles>
  <layer-tree-group>
   <customproperties/>
   <layer-tree-group expanded="1" checked="Qt::Checked" name="WMS服务">
    <customproperties>
     <property value="hidden" key="legend/title-style"/>
    </customproperties>
    <layer-tree-layer providerKey="wms" legend_split_behavior="0" id="USA_Population_c2b23a97_0d1f_4910_83e8_f9bd01abd348" expanded="1" checked="Qt::Checked" legend_exp="" name="USA Population" source="crs=EPSG:3857&amp;dpiMode=7&amp;format=image/png&amp;layers=states&amp;styles&amp;url=http://localhost:8088/geoserver/topp/wms?version%3D1.1.0%26layers%3Dtopp:states%26bbox%3D-124.73142200000001,24.955967,-66.969849,49.371735%26width%3D768%26height%3D330%26srs%3DEPSG:4326%26styles%3D" patch_size="-1,-1">
     <customproperties>
      <property value="USA Population" key="cached_name"/>
      <property value="subgroup" key="legend/title-style"/>
     </customproperties>
    </layer-tree-layer>
   </layer-tree-group>
   <layer-tree-group expanded="1" checked="Qt::Checked" name="底图">
    <customproperties>
     <property value="hidden" key="legend/title-style"/>
    </customproperties>
    <layer-tree-layer providerKey="wms" legend_split_behavior="0" id="高德影像注记_9ea6949f_b59c_45de_a3ff_afa8d0306594" expanded="1" checked="Qt::Checked" legend_exp="" name="高德影像注记" source="crs=EPSG:3857&amp;format&amp;type=xyz&amp;url=http://wprd01.is.autonavi.com/appmaptile?x%3D%7Bx%7D%26y%3D%7By%7D%26z%3D%7Bz%7D%26lang%3Dzh_cn%26size%3D1%26scl%3D1%26style%3D8&amp;zmax=18&amp;zmin=0" patch_size="-1,-1">
     <customproperties>
      <property value="高德影像注记" key="cached_name"/>
      <property value="hidden" key="legend/title-style"/>
     </customproperties>
    </layer-tree-layer>
    <layer-tree-layer providerKey="wms" legend_split_behavior="0" id="高德影像_f5a87826_d61b_4fb2_9e06_8ea294512074" expanded="1" checked="Qt::Checked" legend_exp="" name="高德影像" source="crs=EPSG:3857&amp;format&amp;type=xyz&amp;url=http://wprd01.is.autonavi.com/appmaptile?x%3D%7Bx%7D%26y%3D%7By%7D%26z%3D%7Bz%7D%26lang%3Dzh_cn%26size%3D1%26scl%3D1%26style%3D6&amp;zmax=18&amp;zmin=0" patch_size="-1,-1">
     <customproperties>
      <property value="高德影像" key="cached_name"/>
      <property value="hidden" key="legend/title-style"/>
     </customproperties>
    </layer-tree-layer>
   </layer-tree-group>
   <custom-order enabled="0"/>
  </layer-tree-group>
 </LayoutItem>
 <LayoutItem drawCanvasItems="false" labelMargin="0,mm" groupUuid="" mapRotation="0" background="true" size="280,170,mm" templateUuid="{c2e7494b-f754-46a4-9d6d-51420fcf9f74}" mapFlags="0" blendMode="0" opacity="1" isTemporal="0" visibility="1" referencePoint="0" followPreset="false" type="65639" positionOnPage="9,18,mm" position="9,18,mm" zValue="2" positionLock="true" itemRotation="0" outlineWidthM="4,px" frameJoinStyle="round" keepLayerSet="false" frame="true" uuid="{c2e7494b-f754-46a4-9d6d-51420fcf9f74}" excludeFromExports="0" id="地图" followPresetName="">
  <FrameColor green="0" blue="0" red="0" alpha="255"/>
  <BackgroundColor green="255" blue="255" red="255" alpha="255"/>
  <LayoutObject>
   <dataDefinedProperties>
    <Option type="Map">
     <Option value="" name="name" type="QString"/>
     <Option name="properties"/>
     <Option value="collection" name="type" type="QString"/>
    </Option>
   </dataDefinedProperties>
   <customproperties/>
  </LayoutObject>
  <Extent xmin="-152.0824520553960042" ymin="-0.47086700485009203" xmax="-37.3774889618590862" ymax="69.17143201622589288"/>
  <crs>
   <spatialrefsys>
    <wkt>GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["unknown"],AREA["World"],BBOX[-90,-180,90,180]],ID["EPSG",4326]]</wkt>
    <proj4>+proj=longlat +datum=WGS84 +no_defs</proj4>
    <srsid>3452</srsid>
    <srid>4326</srid>
    <authid>EPSG:4326</authid>
    <description>WGS 84</description>
    <projectionacronym>longlat</projectionacronym>
    <ellipsoidacronym>EPSG:7030</ellipsoidacronym>
    <geographicflag>true</geographicflag>
   </spatialrefsys>
  </crs>
  <LayerSet/>
  <ComposerMapGrid rotatedAnnotationsEnabled="0" topAnnotationDirection="0" show="1" rotatedAnnotationsLengthMode="0" position="3" rightAnnotationDisplay="0" rightAnnotationPosition="1" offsetX="0" annotationFormat="4" rightAnnotationDirection="2" leftFrameDivisions="0" uuid="{33b582a6-ae09-42c2-b50b-ae68c9d6d71a}" name="网格 1" leftAnnotationPosition="1" gridFrameMargin="0" bottomAnnotationDisplay="0" topFrameDivisions="0" gridFramePenColor="0,0,0,255" rotatedTicksLengthMode="0" frameFillColor2="0,0,0,255" minimumIntervalWidth="12" rotatedTicksMinimumAngle="0" blendMode="0" bottomAnnotationPosition="1" maximumIntervalWidth="10" rightFrameDivisions="0" annotationExpression="" topAnnotationPosition="1" annotationPrecision="3" unit="1" leftAnnotationDisplay="0" frameFillColor1="255,255,255,255" gridFrameWidth="2" gridFrameStyle="0" gridFrameSideFlags="15" rotatedTicksEnabled="0" bottomFrameDivisions="0" intervalX="30" rotatedAnnotationsMinimumAngle="0" gridStyle="3" rotatedAnnotationsMarginToCorner="0" bottomAnnotationDirection="0" topAnnotationDisplay="0" showAnnotation="1" crossLength="3" intervalY="30" frameAnnotationDistance="1" gridFramePenThickness="0.29999999999999999" offsetY="0" rotatedTicksMarginToCorner="0" leftAnnotationDirection="2">
   <lineStyle>
    <symbol force_rhr="0" name="" type="line" alpha="0.616" clip_to_extent="1">
     <layer enabled="1" locked="0" pass="0" class="SimpleLine">
      <prop v="0" k="align_dash_pattern"/>
      <prop v="round" k="capstyle"/>
      <prop v="0.66;2" k="customdash"/>
      <prop v="3x:0,0,0,0,0,0" k="customdash_map_unit_scale"/>
      <prop v="MM" k="customdash_unit"/>
      <prop v="0" k="dash_pattern_offset"/>
      <prop v="3x:0,0,0,0,0,0" k="dash_pattern_offset_map_unit_scale"/>
      <prop v="MM" k="dash_pattern_offset_unit"/>
      <prop v="0" k="draw_inside_polygon"/>
      <prop v="round" k="joinstyle"/>
      <prop v="0,0,0,255" k="line_color"/>
      <prop v="solid" k="line_style"/>
      <prop v="0.5" k="line_width"/>
      <prop v="MM" k="line_width_unit"/>
      <prop v="0" k="offset"/>
      <prop v="3x:0,0,0,0,0,0" k="offset_map_unit_scale"/>
      <prop v="MM" k="offset_unit"/>
      <prop v="0" k="ring_filter"/>
      <prop v="0" k="tweak_dash_pattern_on_corners"/>
      <prop v="1" k="use_custom_dash"/>
      <prop v="3x:0,0,0,0,0,0" k="width_map_unit_scale"/>
      <data_defined_properties>
       <Option type="Map">
        <Option value="" name="name" type="QString"/>
        <Option name="properties"/>
        <Option value="collection" name="type" type="QString"/>
       </Option>
      </data_defined_properties>
     </layer>
    </symbol>
   </lineStyle>
   <markerStyle>
    <symbol force_rhr="0" name="" type="marker" alpha="1" clip_to_extent="1">
     <layer enabled="1" locked="0" pass="0" class="SimpleMarker">
      <prop v="0" k="angle"/>
      <prop v="0,0,0,255" k="color"/>
      <prop v="1" k="horizontal_anchor_point"/>
      <prop v="bevel" k="joinstyle"/>
      <prop v="circle" k="name"/>
      <prop v="0,0" k="offset"/>
      <prop v="3x:0,0,0,0,0,0" k="offset_map_unit_scale"/>
      <prop v="MM" k="offset_unit"/>
      <prop v="35,35,35,255" k="outline_color"/>
      <prop v="solid" k="outline_style"/>
      <prop v="0" k="outline_width"/>
      <prop v="3x:0,0,0,0,0,0" k="outline_width_map_unit_scale"/>
      <prop v="MM" k="outline_width_unit"/>
      <prop v="diameter" k="scale_method"/>
      <prop v="2" k="size"/>
      <prop v="3x:0,0,0,0,0,0" k="size_map_unit_scale"/>
      <prop v="MM" k="size_unit"/>
      <prop v="1" k="vertical_anchor_point"/>
      <data_defined_properties>
       <Option type="Map">
        <Option value="" name="name" type="QString"/>
        <Option name="properties"/>
        <Option value="collection" name="type" type="QString"/>
       </Option>
      </data_defined_properties>
     </layer>
    </symbol>
   </markerStyle>
   <spatialrefsys>
    <wkt>GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["unknown"],AREA["World"],BBOX[-90,-180,90,180]],ID["EPSG",4326]]</wkt>
    <proj4>+proj=longlat +datum=WGS84 +no_defs</proj4>
    <srsid>3452</srsid>
    <srid>4326</srid>
    <authid>EPSG:4326</authid>
    <description>WGS 84</description>
    <projectionacronym>longlat</projectionacronym>
    <ellipsoidacronym>EPSG:7030</ellipsoidacronym>
    <geographicflag>true</geographicflag>
   </spatialrefsys>
   <text-style capitalization="0" namedStyle="" textOrientation="horizontal" textColor="0,0,0,255" blendMode="0" fontUnderline="0" fontItalic="0" fontStrikeout="0" fontSizeMapUnitScale="3x:0,0,0,0,0,0" fontWeight="50" fontSize="8" multilineHeight="1" previewBkgrdColor="255,255,255,255" fontKerning="1" allowHtml="0" textOpacity="1" fontWordSpacing="0" fontSizeUnit="Point" fontLetterSpacing="0" fontFamily="SimSun">
    <text-buffer bufferColor="255,255,255,255" bufferOpacity="1" bufferBlendMode="0" bufferSizeUnits="MM" bufferSize="1" bufferSizeMapUnitScale="3x:0,0,0,0,0,0" bufferNoFill="1" bufferDraw="0" bufferJoinStyle="128"/>
    <text-mask maskedSymbolLayers="" maskSize="1.5" maskSizeUnits="MM" maskType="0" maskSizeMapUnitScale="3x:0,0,0,0,0,0" maskOpacity="1" maskEnabled="0" maskJoinStyle="128"/>
    <background shapeRadiiMapUnitScale="3x:0,0,0,0,0,0" shapeBorderColor="128,128,128,255" shapeOpacity="1" shapeRotation="0" shapeDraw="0" shapeOffsetX="0" shapeBlendMode="0" shapeSizeType="0" shapeBorderWidthMapUnitScale="3x:0,0,0,0,0,0" shapeBorderWidth="0" shapeSizeMapUnitScale="3x:0,0,0,0,0,0" shapeOffsetUnit="MM" shapeSizeX="0" shapeBorderWidthUnit="MM" shapeSizeY="0" shapeJoinStyle="64" shapeRadiiX="0" shapeSizeUnit="MM" shapeOffsetY="0" shapeOffsetMapUnitScale="3x:0,0,0,0,0,0" shapeRadiiY="0" shapeRadiiUnit="MM" shapeType="0" shapeFillColor="255,255,255,255" shapeRotationType="0" shapeSVGFile="">
     <symbol force_rhr="0" name="markerSymbol" type="marker" alpha="1" clip_to_extent="1">
      <layer enabled="1" locked="0" pass="0" class="SimpleMarker">
       <prop v="0" k="angle"/>
       <prop v="231,113,72,255" k="color"/>
       <prop v="1" k="horizontal_anchor_point"/>
       <prop v="bevel" k="joinstyle"/>
       <prop v="circle" k="name"/>
       <prop v="0,0" k="offset"/>
       <prop v="3x:0,0,0,0,0,0" k="offset_map_unit_scale"/>
       <prop v="MM" k="offset_unit"/>
       <prop v="35,35,35,255" k="outline_color"/>
       <prop v="solid" k="outline_style"/>
       <prop v="0" k="outline_width"/>
       <prop v="3x:0,0,0,0,0,0" k="outline_width_map_unit_scale"/>
       <prop v="MM" k="outline_width_unit"/>
       <prop v="diameter" k="scale_method"/>
       <prop v="2" k="size"/>
       <prop v="3x:0,0,0,0,0,0" k="size_map_unit_scale"/>
       <prop v="MM" k="size_unit"/>
       <prop v="1" k="vertical_anchor_point"/>
       <data_defined_properties>
        <Option type="Map">
         <Option value="" name="name" type="QString"/>
         <Option name="properties"/>
         <Option value="collection" name="type" type="QString"/>
        </Option>
       </data_defined_properties>
      </layer>
     </symbol>
    </background>
    <shadow shadowRadius="1.5" shadowRadiusMapUnitScale="3x:0,0,0,0,0,0" shadowOpacity="0.7" shadowOffsetUnit="MM" shadowScale="100" shadowOffsetAngle="135" shadowRadiusUnit="MM" shadowOffsetMapUnitScale="3x:0,0,0,0,0,0" shadowOffsetGlobal="1" shadowRadiusAlphaOnly="0" shadowColor="0,0,0,255" shadowBlendMode="6" shadowOffsetDist="1" shadowUnder="0" shadowDraw="0"/>
    <dd_properties>
     <Option type="Map">
      <Option value="" name="name" type="QString"/>
      <Option name="properties"/>
      <Option value="collection" name="type" type="QString"/>
     </Option>
    </dd_properties>
   </text-style>
   <LayoutObject>
    <dataDefinedProperties>
     <Option type="Map">
      <Option value="" name="name" type="QString"/>
      <Option name="properties"/>
      <Option value="collection" name="type" type="QString"/>
     </Option>
    </dataDefinedProperties>
    <customproperties/>
   </LayoutObject>
  </ComposerMapGrid>
  <AtlasMap atlasDriven="0" scalingMode="2" margin="0.10000000000000001"/>
  <labelBlockingItems/>
  <atlasClippingSettings restrictLayers="0" enabled="0" forceLabelsInside="0" clippingType="1">
   <layersToClip/>
  </atlasClippingSettings>
  <itemClippingSettings enabled="0" forceLabelsInside="0" clipSource="" clippingType="1"/>
 </LayoutItem>
 <LayoutItem groupUuid="" background="false" size="292.354,205.447,mm" templateUuid="{e0b060ea-8dae-4b1b-a216-b36caed167c3}" blendMode="0" opacity="1" visibility="1" referencePoint="0" type="65643" positionOnPage="2.6816,2,mm" cornerRadiusMeasure="0,mm" position="2.6816,2,mm" zValue="1" positionLock="true" itemRotation="0" outlineWidthM="0.3,mm" frameJoinStyle="miter" frame="false" shapeType="1" uuid="{e0b060ea-8dae-4b1b-a216-b36caed167c3}" excludeFromExports="0" id="边框">
  <FrameColor green="0" blue="0" red="0" alpha="255"/>
  <BackgroundColor green="255" blue="255" red="255" alpha="255"/>
  <LayoutObject>
   <dataDefinedProperties>
    <Option type="Map">
     <Option value="" name="name" type="QString"/>
     <Option name="properties"/>
     <Option value="collection" name="type" type="QString"/>
    </Option>
   </dataDefinedProperties>
   <customproperties/>
  </LayoutObject>
  <symbol force_rhr="0" name="" type="fill" alpha="1" clip_to_extent="1">
   <layer enabled="1" locked="0" pass="0" class="SimpleLine">
    <prop v="0" k="align_dash_pattern"/>
    <prop v="square" k="capstyle"/>
    <prop v="5;2" k="customdash"/>
    <prop v="3x:0,0,0,0,0,0" k="customdash_map_unit_scale"/>
    <prop v="Pixel" k="customdash_unit"/>
    <prop v="0" k="dash_pattern_offset"/>
    <prop v="3x:0,0,0,0,0,0" k="dash_pattern_offset_map_unit_scale"/>
    <prop v="MM" k="dash_pattern_offset_unit"/>
    <prop v="0" k="draw_inside_polygon"/>
    <prop v="bevel" k="joinstyle"/>
    <prop v="53,121,177,255" k="line_color"/>
    <prop v="solid" k="line_style"/>
    <prop v="0.96" k="line_width"/>
    <prop v="Pixel" k="line_width_unit"/>
    <prop v="0" k="offset"/>
    <prop v="3x:0,0,0,0,0,0" k="offset_map_unit_scale"/>
    <prop v="Pixel" k="offset_unit"/>
    <prop v="0" k="ring_filter"/>
    <prop v="0" k="tweak_dash_pattern_on_corners"/>
    <prop v="0" k="use_custom_dash"/>
    <prop v="3x:0,0,0,0,0,0" k="width_map_unit_scale"/>
    <data_defined_properties>
     <Option type="Map">
      <Option value="" name="name" type="QString"/>
      <Option name="properties"/>
      <Option value="collection" name="type" type="QString"/>
     </Option>
    </data_defined_properties>
   </layer>
  </symbol>
 </LayoutItem>
 <LayoutMultiFrame gridColor="0,0,0,255" backgroundColor="255,255,255,255" templateUuid="{ac4d0d50-93b1-4429-be99-b888689f2d65}" emptyTableMode="0" wrapBehavior="0" verticalGrid="1" includeHeader="0" cellMargin="1" horizontalGrid="1" emptyTableMessage="" type="65652" headerMode="2" gridStrokeWidth="0.5" showEmptyRows="0" resizeMode="0" uuid="{ac4d0d50-93b1-4429-be99-b888689f2d65}" headerHAlignment="0" showGrid="0">
  <childFrame uuid="{33d726d8-6169-4351-997b-1564c5e4a026}" templateUuid="{33d726d8-6169-4351-997b-1564c5e4a026}"/>
  <LayoutObject>
   <dataDefinedProperties>
    <Option type="Map">
     <Option value="" name="name" type="QString"/>
     <Option name="properties"/>
     <Option value="collection" name="type" type="QString"/>
    </Option>
   </dataDefinedProperties>
   <customproperties/>
  </LayoutObject>
  <headerTextFormat>
   <text-style capitalization="0" namedStyle="" textOrientation="horizontal" textColor="0,0,0,255" blendMode="0" fontUnderline="0" fontItalic="0" fontStrikeout="0" fontSizeMapUnitScale="3x:0,0,0,0,0,0" fontWeight="50" fontSize="10" multilineHeight="1" previewBkgrdColor="255,255,255,255" fontKerning="1" allowHtml="0" textOpacity="1" fontWordSpacing="0" fontSizeUnit="Point" fontLetterSpacing="0" fontFamily="SimSun">
    <text-buffer bufferColor="255,255,255,255" bufferOpacity="1" bufferBlendMode="0" bufferSizeUnits="MM" bufferSize="1" bufferSizeMapUnitScale="3x:0,0,0,0,0,0" bufferNoFill="1" bufferDraw="0" bufferJoinStyle="128"/>
    <text-mask maskedSymbolLayers="" maskSize="1.5" maskSizeUnits="MM" maskType="0" maskSizeMapUnitScale="3x:0,0,0,0,0,0" maskOpacity="1" maskEnabled="0" maskJoinStyle="128"/>
    <background shapeRadiiMapUnitScale="3x:0,0,0,0,0,0" shapeBorderColor="128,128,128,255" shapeOpacity="1" shapeRotation="0" shapeDraw="0" shapeOffsetX="0" shapeBlendMode="0" shapeSizeType="0" shapeBorderWidthMapUnitScale="3x:0,0,0,0,0,0" shapeBorderWidth="0" shapeSizeMapUnitScale="3x:0,0,0,0,0,0" shapeOffsetUnit="MM" shapeSizeX="0" shapeBorderWidthUnit="MM" shapeSizeY="0" shapeJoinStyle="64" shapeRadiiX="0" shapeSizeUnit="MM" shapeOffsetY="0" shapeOffsetMapUnitScale="3x:0,0,0,0,0,0" shapeRadiiY="0" shapeRadiiUnit="MM" shapeType="0" shapeFillColor="255,255,255,255" shapeRotationType="0" shapeSVGFile=""/>
    <shadow shadowRadius="1.5" shadowRadiusMapUnitScale="3x:0,0,0,0,0,0" shadowOpacity="0.7" shadowOffsetUnit="MM" shadowScale="100" shadowOffsetAngle="135" shadowRadiusUnit="MM" shadowOffsetMapUnitScale="3x:0,0,0,0,0,0" shadowOffsetGlobal="1" shadowRadiusAlphaOnly="0" shadowColor="0,0,0,255" shadowBlendMode="6" shadowOffsetDist="1" shadowUnder="0" shadowDraw="0"/>
    <dd_properties>
     <Option type="Map">
      <Option value="" name="name" type="QString"/>
      <Option name="properties"/>
      <Option value="collection" name="type" type="QString"/>
     </Option>
    </dd_properties>
   </text-style>
  </headerTextFormat>
  <contentTextFormat>
   <text-style capitalization="0" namedStyle="" textOrientation="horizontal" textColor="0,0,0,255" blendMode="0" fontUnderline="0" fontItalic="0" fontStrikeout="0" fontSizeMapUnitScale="3x:0,0,0,0,0,0" fontWeight="50" fontSize="10" multilineHeight="1" previewBkgrdColor="255,255,255,255" fontKerning="1" allowHtml="0" textOpacity="1" fontWordSpacing="0" fontSizeUnit="Point" fontLetterSpacing="0" fontFamily="SimSun">
    <text-buffer bufferColor="255,255,255,255" bufferOpacity="1" bufferBlendMode="0" bufferSizeUnits="MM" bufferSize="1" bufferSizeMapUnitScale="3x:0,0,0,0,0,0" bufferNoFill="1" bufferDraw="0" bufferJoinStyle="128"/>
    <text-mask maskedSymbolLayers="" maskSize="1.5" maskSizeUnits="MM" maskType="0" maskSizeMapUnitScale="3x:0,0,0,0,0,0" maskOpacity="1" maskEnabled="0" maskJoinStyle="128"/>
    <background shapeRadiiMapUnitScale="3x:0,0,0,0,0,0" shapeBorderColor="128,128,128,255" shapeOpacity="1" shapeRotation="0" shapeDraw="0" shapeOffsetX="0" shapeBlendMode="0" shapeSizeType="0" shapeBorderWidthMapUnitScale="3x:0,0,0,0,0,0" shapeBorderWidth="0" shapeSizeMapUnitScale="3x:0,0,0,0,0,0" shapeOffsetUnit="MM" shapeSizeX="0" shapeBorderWidthUnit="MM" shapeSizeY="0" shapeJoinStyle="64" shapeRadiiX="0" shapeSizeUnit="MM" shapeOffsetY="0" shapeOffsetMapUnitScale="3x:0,0,0,0,0,0" shapeRadiiY="0" shapeRadiiUnit="MM" shapeType="0" shapeFillColor="255,255,255,255" shapeRotationType="0" shapeSVGFile=""/>
    <shadow shadowRadius="1.5" shadowRadiusMapUnitScale="3x:0,0,0,0,0,0" shadowOpacity="0.7" shadowOffsetUnit="MM" shadowScale="100" shadowOffsetAngle="135" shadowRadiusUnit="MM" shadowOffsetMapUnitScale="3x:0,0,0,0,0,0" shadowOffsetGlobal="1" shadowRadiusAlphaOnly="0" shadowColor="0,0,0,255" shadowBlendMode="6" shadowOffsetDist="1" shadowUnder="0" shadowDraw="0"/>
    <dd_properties>
     <Option type="Map">
      <Option value="" name="name" type="QString"/>
      <Option name="properties"/>
      <Option value="collection" name="type" type="QString"/>
     </Option>
    </dd_properties>
   </text-style>
  </contentTextFormat>
  <displayColumns>
   <column sortOrder="0" width="0" hAlignment="1" attribute="" vAlignment="128" heading="" sortByRank="0">
    <backgroundColor green="0" blue="0" red="0" alpha="0"/>
   </column>
   <column sortOrder="0" width="0" hAlignment="1" attribute="" vAlignment="128" heading="说明" sortByRank="0">
    <backgroundColor green="0" blue="0" red="0" alpha="0"/>
   </column>
  </displayColumns>
  <sortColumns/>
  <cellStyles>
   <oddColumns enabled="0" cellBackgroundColor="255,255,255,255"/>
   <evenColumns enabled="0" cellBackgroundColor="255,255,255,255"/>
   <oddRows enabled="0" cellBackgroundColor="255,255,255,255"/>
   <evenRows enabled="0" cellBackgroundColor="255,255,255,255"/>
   <firstColumn enabled="0" cellBackgroundColor="255,255,255,255"/>
   <lastColumn enabled="0" cellBackgroundColor="255,255,255,255"/>
   <headerRow enabled="0" cellBackgroundColor="255,255,255,255"/>
   <firstRow enabled="0" cellBackgroundColor="255,255,255,255"/>
   <lastRow enabled="0" cellBackgroundColor="255,255,255,255"/>
  </cellStyles>
  <headers>
   <header sortOrder="0" width="0" hAlignment="1" attribute="" vAlignment="128" heading="" sortByRank="0">
    <backgroundColor green="0" blue="0" red="0" alpha="0"/>
   </header>
   <header sortOrder="0" width="0" hAlignment="1" attribute="" vAlignment="128" heading="说明" sortByRank="0">
    <backgroundColor green="0" blue="0" red="0" alpha="0"/>
   </header>
  </headers>
  <contents>
   <row>
    <Option type="Map">
     <Option value="" name="background" type="color"/>
     <Option value="说" name="content" type="QString"/>
     <Option value="" name="foreground" type="color"/>
     <Option value="2" name="halign" type="int"/>
     <Option value="0" name="valign" type="int"/>
    </Option>
    <Option type="Map">
     <Option value="" name="background" type="color"/>
     <Option value="明" name="content" type="QString"/>
     <Option value="" name="foreground" type="color"/>
     <Option value="0" name="halign" type="int"/>
     <Option value="0" name="valign" type="int"/>
    </Option>
   </row>
   <row>
    <Option type="Map">
     <Option value="" name="background" type="color"/>
     <Option value="省份:" name="content" type="QString"/>
     <Option value="" name="foreground" type="color"/>
     <Option value="2" name="halign" type="int"/>
     <Option value="128" name="valign" type="int"/>
    </Option>
    <Option type="Map">
     <Option value="" name="background" type="color"/>
     <Option value="河北省" name="content" type="QString"/>
     <Option value="" name="foreground" type="color"/>
     <Option value="1" name="halign" type="int"/>
     <Option value="128" name="valign" type="int"/>
    </Option>
   </row>
   <row>
    <Option type="Map">
     <Option value="" name="background" type="color"/>
     <Option value="比例尺:" name="content" type="QString"/>
     <Option value="" name="foreground" type="color"/>
     <Option value="2" name="halign" type="int"/>
     <Option value="128" name="valign" type="int"/>
    </Option>
    <Option type="Map">
     <Option value="" name="background" type="color"/>
     <Option value="1:25万" name="content" type="QString"/>
     <Option value="" name="foreground" type="color"/>
     <Option value="1" name="halign" type="int"/>
     <Option value="128" name="valign" type="int"/>
    </Option>
   </row>
   <row>
    <Option type="Map">
     <Option value="" name="background" type="color"/>
     <Option value="影像分辨率:" name="content" type="QString"/>
     <Option value="" name="foreground" type="color"/>
     <Option value="0" name="halign" type="int"/>
     <Option value="0" name="valign" type="int"/>
    </Option>
    <Option type="Map">
     <Option value="" name="background" type="color"/>
     <Option value="20ç±³" name="content" type="QString"/>
     <Option value="" name="foreground" type="color"/>
     <Option value="0" name="halign" type="int"/>
     <Option value="0" name="valign" type="int"/>
    </Option>
   </row>
   <row>
    <Option type="Map">
     <Option value="" name="background" type="color"/>
     <Option value="制图时间:" name="content" type="QString"/>
     <Option value="" name="foreground" type="color"/>
     <Option value="2" name="halign" type="int"/>
     <Option value="0" name="valign" type="int"/>
    </Option>
    <Option type="Map">
     <Option value="" name="background" type="color"/>
     <Option value="2022.11.06" name="content" type="QString"/>
     <Option value="" name="foreground" type="color"/>
     <Option value="0" name="halign" type="int"/>
     <Option value="0" name="valign" type="int"/>
    </Option>
   </row>
  </contents>
  <rowHeights>
   <row height="0"/>
   <row height="0"/>
   <row height="0"/>
   <row height="0"/>
   <row height="0"/>
  </rowHeights>
  <columnWidths>
   <column width="0"/>
   <column width="0"/>
  </columnWidths>
 </LayoutMultiFrame>
 <customproperties>
  <property value="png" key="atlasRasterFormat"/>
  <property value="true" key="imageAntialias"/>
  <property value="0" key="imageCropMarginBottom"/>
  <property value="0" key="imageCropMarginLeft"/>
  <property value="0" key="imageCropMarginRight"/>
  <property value="0" key="imageCropMarginTop"/>
  <property value="false" key="imageCropToContents"/>
  <property value="true" key="singleFile"/>
  <property key="layers" value="USA Population,高德影像注记,高德影像"/>
  <property key="imgPath" value="E:/terrait/TianJin/ExportMap/ExportMap/Sources/geo.png"/>
 </customproperties>
 <Atlas enabled="0" filenamePattern="'output_'||@atlas_featurenumber" filterFeatures="0" coverageLayer="" pageNameExpression="" sortFeatures="0" hideCoverage="0"/>
</Layout>
ExportMap/Sources/geo_render.py
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,127 @@
#!/usr/bin/env
# -*- coding: utf-8 -*-
import os
import sys
import math
import argparse
from qgis.core import *
from qgis.gui import *
from qgis.PyQt.QtGui import *
from qgis.PyQt.QtCore import *
from qgis.PyQt.QtWidgets import *
from qgis.PyQt.QtXml import *
# èŽ·å–å®Œæ•´è·¯å¾„
def get_full_path():
    return os.path.split(sys.argv[0])[0]
# èŽ·å–å‚æ•°
def get_args():
    print("argv = ", sys.argv[1:])
    parser = argparse.ArgumentParser(description='ArgUtils')
    parser.add_argument("-src", type=str, default=get_full_path(), required=False)
    parser.add_argument("-qgz", type=str, default="geo.qgz", required=False)
    parser.add_argument("-qpt", type=str, default="geo.qpt", required=False)
    return parser.parse_args()
# è®¾ç½®å›¾å±‚可用性
def set_layers_valid(prj, show_layers):
    for layer in prj.mapLayers().values():
        flag = layer.name() in show_layers
        print(layer.name() + ": " + str(flag))
        # if not flag:
        # project.removeMapLayer(layer)
        layer.setValid(flag)
# è®¾ç½®å›¾å±‚可见性
def set_item_visibility(root_node, show_layers):
    print(root_node.name() + ': Group')
    for node in root_node.children():
        # QgsLayerTreeLayer
        if isinstance(node, QgsLayerTreeGroup):
            set_item_visibility(node, show_layers)
        # QgsRasterLayer, QgsVectorLayer
        else:
            name = node.layer().name()
            flag = name in showLayers
            print(name + ": " + str(flag))
            # if not flag:
            # root_node.removeLayer(node.layer())
            # node.layer().setValid(False)
            node.setItemVisibilityChecked(flag)
# åˆå§‹åŒ–
# QgsApplication.setPrefixPath(r"E:/terrait/TianJin/LFServer/QGIS/", True)
qgs = QgsApplication([], True)
qgs.initQgis()
# åŠ è½½å·¥ç¨‹
args = get_args()
project = QgsProject.instance()
# project.read(r'Test.qgz')
project.read(os.path.join(args.src, args.qgz))
print("FileName: " + project.fileName())
# layout = QgsPrintLayout(project)
layout = QgsLayout(project)
# layout.initializeDefaults()
# åŠ è½½æ¨¡æ¿
# with open(r'Test.qpt', 'r', encoding='utf-8') as f:
with open(os.path.join(args.src, args.qpt), 'r', encoding='utf-8') as f:
    template_content = f.read()
doc = QDomDocument()
doc.setContent(template_content)
layout.loadFromTemplate(doc, QgsReadWriteContext(), True)
# map = layout.itemById(r'地图')
map = layout.referenceMap()
map.zoomToExtent(map.extent())
print('1:' + str(math.ceil(map.scale())))
size = map.sizeWithUnits()
print('size: ' + str(size.width()) + " * " + str(size.height()) + " mm")
if size.width() > 280 or size.height() > 174:
    map.attemptResize(QgsLayoutSize(280, 174, QgsUnitTypes.LayoutMillimeters))
    print('size: ' + str(map.sizeWithUnits().width()) + " * " + str(map.sizeWithUnits().height()) + " mm")
# è®¾ç½®å›¾å±‚
# "阀室", "站场", "管道中心线", "矢量注记", "矢量图", "高德影像注记", "高德影像", "影像注记", "影像图"
# showLayers = ["阀室", "管道中心线", "矢量注记", "矢量图"]
showLayers = layout.customProperty("layers").split(',')
root = project.layerTreeRoot()
# set_layers_valid(project, showLayers)
set_item_visibility(root, showLayers)
# collection = layout.pageCollection()
# page = collection.page(0)
# page.refreshItemSize()
legend = layout.itemById(r'图例')
# legend.setLinkedMap(map)
# legend.setLegendFilterByMapEnabled(False)
# legend.setLegendFilterOutAtlas(True)
legend.updateFilterByMap(True)
legend.refreshFrame(True)
legend.updateLegend()
legend.refresh()
# åˆ·æ–°
map.refresh()
layout.updateBounds()
layout.refresh()
# å¯¼å‡º
exporter = QgsLayoutExporter(layout)
# img_path = os.path.join(r"E:/terrait/TianJin/LFServer/QGIS", "render.png")
img_path = layout.customProperty("imgPath")
exporter.exportToImage(img_path, QgsLayoutExporter.ImageExportSettings())
# é€€å‡º
qgs.exitQgis()
JavaCode/App.config
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <!-- 69701 -->
    <add key="pgConn" value="Server=127.0.0.1;Port=5432;Database=langfang;User Id=postgres;Password=postgres;"/>
    <!-- 20582 -->
    <!--<add key="pgConn" value="Server=192.168.20.39;Port=5433;Database=langfang;User Id=postgres;Password=postgres;"/>-->
  </appSettings>
  <startup>
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
  </startup>
</configuration>
JavaCode/BsTemplate/Entity.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package {entityNS};
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lf.server.entity.all.BaseEntity;
import lombok.*;
import java.math.BigDecimal;
import java.sql.Timestamp;
/**
 * {bak}
 * @author WWW
 */
@Data
@AllArgsConstructor
@TableName("{tabName}")
@EqualsAndHashCode(callSuper = false)
public class {entityName} extends BaseEntity {
    private static final long serialVersionUID = {uid}L;
JavaCode/BsTemplate/GeoEntity.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package {entityNS};
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lf.server.entity.all.BaseGeoEntity;
import lombok.*;
import java.math.BigDecimal;
import java.sql.Timestamp;
/**
 * {bak}
 * @author WWW
 */
@Data
@AllArgsConstructor
@TableName("{tabName}")
@EqualsAndHashCode(callSuper = false)
public class {entityName} extends BaseGeoEntity {
    private static final long serialVersionUID = {uid}L;
JavaCode/BsTemplate/GeoMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
package {mapperNS};
import {entityNS}.{entityName};
import com.lf.server.mapper.all.GeomBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
 * {bak}
 * @author WWW
 */
@Mapper
@Repository
public interface {mapperName} extends GeomBaseMapper<{entityName}> {
}
JavaCode/BsTemplate/Mapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
package {mapperNS};
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import {entityNS}.{entityName};
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
/**
 * {bak}
 * @author WWW
 */
@Mapper
@Repository
public interface {mapperName} extends BaseMapper<{entityName}> {
}
JavaCode/DLL/Mono.Security.dll
Binary files differ
JavaCode/DLL/Npgsql.dll
Binary files differ
JavaCode/FrmMain.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,76 @@
namespace JavaCode
{
    partial class FrmMain
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.btnSys = new System.Windows.Forms.Button();
            this.btnMybatis = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // btnSys
            //
            this.btnSys.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnSys.Location = new System.Drawing.Point(142, 63);
            this.btnSys.Name = "btnSys";
            this.btnSys.Size = new System.Drawing.Size(183, 25);
            this.btnSys.TabIndex = 13;
            this.btnSys.Text = "生 æˆ ç³» ç»Ÿ è¡¨";
            this.btnSys.UseVisualStyleBackColor = true;
            this.btnSys.Click += new System.EventHandler(this.btnSys_Click);
            //
            // btnMybatis
            //
            this.btnMybatis.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnMybatis.Location = new System.Drawing.Point(142, 134);
            this.btnMybatis.Name = "btnMybatis";
            this.btnMybatis.Size = new System.Drawing.Size(183, 25);
            this.btnMybatis.TabIndex = 14;
            this.btnMybatis.Text = "生 æˆ Mybatis Plus";
            this.btnMybatis.UseVisualStyleBackColor = true;
            this.btnMybatis.Click += new System.EventHandler(this.btnMybatis_Click);
            //
            // FrmMain
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(484, 261);
            this.Controls.Add(this.btnMybatis);
            this.Controls.Add(this.btnSys);
            this.Name = "FrmMain";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "FrmMain";
            this.ResumeLayout(false);
        }
        #endregion
        private System.Windows.Forms.Button btnSys;
        private System.Windows.Forms.Button btnMybatis;
    }
}
JavaCode/FrmMain.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace JavaCode
{
    public partial class FrmMain : Form
    {
        public FrmMain()
        {
            InitializeComponent();
        }
        private void btnSys_Click(object sender, EventArgs e)
        {
            FrmSys frmSys = new FrmSys();
            frmSys.Show();
        }
        private void btnMybatis_Click(object sender, EventArgs e)
        {
            FrmMyBatisPlus mybatis = new FrmMyBatisPlus();
            mybatis.Show();
        }
    }
}
JavaCode/FrmMain.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
</root>
JavaCode/FrmMyBatisPlus.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,284 @@
namespace JavaCode
{
    partial class FrmMyBatisPlus
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.txtNS = new System.Windows.Forms.TextBox();
            this.txtTabPre = new System.Windows.Forms.TextBox();
            this.btnReadTab = new System.Windows.Forms.Button();
            this.tabList = new System.Windows.Forms.ListBox();
            this.dgvTab = new System.Windows.Forms.DataGridView();
            this.txtEntityNS = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.txtMapperNS = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.btnGeneAll = new System.Windows.Forms.Button();
            this.btnAll = new System.Windows.Forms.Button();
            this.btnAnti = new System.Windows.Forms.Button();
            this.btnNone = new System.Windows.Forms.Button();
            this.btnGeneEntity = new System.Windows.Forms.Button();
            this.btnGeneMapper = new System.Windows.Forms.Button();
            this.txtTabNS = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            ((System.ComponentModel.ISupportInitialize)(this.dgvTab)).BeginInit();
            this.SuspendLayout();
            //
            // txtNS
            //
            this.txtNS.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtNS.Location = new System.Drawing.Point(12, 13);
            this.txtNS.Name = "txtNS";
            this.txtNS.Size = new System.Drawing.Size(104, 26);
            this.txtNS.TabIndex = 25;
            this.txtNS.Text = "163875";
            //
            // txtTabPre
            //
            this.txtTabPre.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtTabPre.Location = new System.Drawing.Point(136, 13);
            this.txtTabPre.Name = "txtTabPre";
            this.txtTabPre.Size = new System.Drawing.Size(98, 26);
            this.txtTabPre.TabIndex = 24;
            //
            // btnReadTab
            //
            this.btnReadTab.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnReadTab.Location = new System.Drawing.Point(247, 15);
            this.btnReadTab.Name = "btnReadTab";
            this.btnReadTab.Size = new System.Drawing.Size(118, 23);
            this.btnReadTab.TabIndex = 23;
            this.btnReadTab.Text = "读取数据库表";
            this.btnReadTab.UseVisualStyleBackColor = true;
            this.btnReadTab.Click += new System.EventHandler(this.btnReadTab_Click);
            //
            // tabList
            //
            this.tabList.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.tabList.FormattingEnabled = true;
            this.tabList.ItemHeight = 16;
            this.tabList.Location = new System.Drawing.Point(12, 86);
            this.tabList.Name = "tabList";
            this.tabList.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
            this.tabList.Size = new System.Drawing.Size(353, 212);
            this.tabList.TabIndex = 22;
            this.tabList.SelectedIndexChanged += new System.EventHandler(this.tabList_SelectedIndexChanged);
            //
            // dgvTab
            //
            this.dgvTab.AllowUserToAddRows = false;
            this.dgvTab.AllowUserToDeleteRows = false;
            this.dgvTab.BackgroundColor = System.Drawing.SystemColors.ButtonFace;
            this.dgvTab.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dgvTab.Location = new System.Drawing.Point(12, 312);
            this.dgvTab.Margin = new System.Windows.Forms.Padding(0);
            this.dgvTab.MultiSelect = false;
            this.dgvTab.Name = "dgvTab";
            this.dgvTab.ReadOnly = true;
            this.dgvTab.RowHeadersWidth = 40;
            this.dgvTab.RowTemplate.Height = 23;
            this.dgvTab.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.dgvTab.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            this.dgvTab.Size = new System.Drawing.Size(825, 300);
            this.dgvTab.TabIndex = 26;
            //
            // txtEntityNS
            //
            this.txtEntityNS.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtEntityNS.Location = new System.Drawing.Point(525, 89);
            this.txtEntityNS.Name = "txtEntityNS";
            this.txtEntityNS.Size = new System.Drawing.Size(312, 26);
            this.txtEntityNS.TabIndex = 30;
            this.txtEntityNS.Text = "com.lf.server.entity.bd";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label3.Location = new System.Drawing.Point(385, 94);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(136, 16);
            this.label3.TabIndex = 29;
            this.label3.Text = "Entity名称空间:";
            //
            // txtMapperNS
            //
            this.txtMapperNS.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtMapperNS.Location = new System.Drawing.Point(525, 53);
            this.txtMapperNS.Name = "txtMapperNS";
            this.txtMapperNS.Size = new System.Drawing.Size(312, 26);
            this.txtMapperNS.TabIndex = 32;
            this.txtMapperNS.Text = "com.lf.server.mapper.bd";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label2.Location = new System.Drawing.Point(385, 58);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(136, 16);
            this.label2.TabIndex = 31;
            this.label2.Text = "Mapper名称空间:";
            //
            // btnGeneAll
            //
            this.btnGeneAll.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnGeneAll.Location = new System.Drawing.Point(525, 208);
            this.btnGeneAll.Name = "btnGeneAll";
            this.btnGeneAll.Size = new System.Drawing.Size(312, 25);
            this.btnGeneAll.TabIndex = 33;
            this.btnGeneAll.Text = "生 æˆ æ‰€ æœ‰ æ–‡ ä»¶";
            this.btnGeneAll.UseVisualStyleBackColor = true;
            this.btnGeneAll.Click += new System.EventHandler(this.btnGeneAll_Click);
            //
            // btnAll
            //
            this.btnAll.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnAll.Location = new System.Drawing.Point(12, 53);
            this.btnAll.Name = "btnAll";
            this.btnAll.Size = new System.Drawing.Size(104, 23);
            this.btnAll.TabIndex = 34;
            this.btnAll.Text = "全 é€‰";
            this.btnAll.UseVisualStyleBackColor = true;
            this.btnAll.Click += new System.EventHandler(this.btnAll_Click);
            //
            // btnAnti
            //
            this.btnAnti.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnAnti.Location = new System.Drawing.Point(136, 52);
            this.btnAnti.Name = "btnAnti";
            this.btnAnti.Size = new System.Drawing.Size(98, 23);
            this.btnAnti.TabIndex = 35;
            this.btnAnti.Text = "反 é€‰";
            this.btnAnti.UseVisualStyleBackColor = true;
            this.btnAnti.Click += new System.EventHandler(this.btnAnti_Click);
            //
            // btnNone
            //
            this.btnNone.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnNone.Location = new System.Drawing.Point(247, 52);
            this.btnNone.Name = "btnNone";
            this.btnNone.Size = new System.Drawing.Size(118, 23);
            this.btnNone.TabIndex = 36;
            this.btnNone.Text = "全 ä¸ é€‰";
            this.btnNone.UseVisualStyleBackColor = true;
            this.btnNone.Click += new System.EventHandler(this.btnNone_Click);
            //
            // btnGeneEntity
            //
            this.btnGeneEntity.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnGeneEntity.Location = new System.Drawing.Point(525, 169);
            this.btnGeneEntity.Name = "btnGeneEntity";
            this.btnGeneEntity.Size = new System.Drawing.Size(312, 25);
            this.btnGeneEntity.TabIndex = 38;
            this.btnGeneEntity.Text = "生 æˆ Entity.java";
            this.btnGeneEntity.UseVisualStyleBackColor = true;
            this.btnGeneEntity.Click += new System.EventHandler(this.btnGeneEntity_Click);
            //
            // btnGeneMapper
            //
            this.btnGeneMapper.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnGeneMapper.Location = new System.Drawing.Point(525, 128);
            this.btnGeneMapper.Name = "btnGeneMapper";
            this.btnGeneMapper.Size = new System.Drawing.Size(312, 25);
            this.btnGeneMapper.TabIndex = 37;
            this.btnGeneMapper.Text = "生 æˆ Mapper.java";
            this.btnGeneMapper.UseVisualStyleBackColor = true;
            this.btnGeneMapper.Click += new System.EventHandler(this.btnGeneMapper_Click);
            //
            // txtTabNS
            //
            this.txtTabNS.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtTabNS.Location = new System.Drawing.Point(525, 15);
            this.txtTabNS.Name = "txtTabNS";
            this.txtTabNS.Size = new System.Drawing.Size(312, 26);
            this.txtTabNS.TabIndex = 40;
            this.txtTabNS.Text = "bd.";
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label1.Location = new System.Drawing.Point(433, 20);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(88, 16);
            this.label1.TabIndex = 39;
            this.label1.Text = "表名前缀:";
            //
            // FrmMyBatisPlus
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(852, 628);
            this.Controls.Add(this.txtTabNS);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.btnGeneEntity);
            this.Controls.Add(this.btnGeneMapper);
            this.Controls.Add(this.btnNone);
            this.Controls.Add(this.btnAnti);
            this.Controls.Add(this.btnAll);
            this.Controls.Add(this.btnGeneAll);
            this.Controls.Add(this.txtMapperNS);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.txtEntityNS);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.dgvTab);
            this.Controls.Add(this.txtNS);
            this.Controls.Add(this.txtTabPre);
            this.Controls.Add(this.btnReadTab);
            this.Controls.Add(this.tabList);
            this.Name = "FrmMyBatisPlus";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "FrmMyBatisPlus";
            this.Load += new System.EventHandler(this.FrmMyBatisPlus_Load);
            ((System.ComponentModel.ISupportInitialize)(this.dgvTab)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
        }
        #endregion
        private System.Windows.Forms.TextBox txtNS;
        private System.Windows.Forms.TextBox txtTabPre;
        private System.Windows.Forms.Button btnReadTab;
        private System.Windows.Forms.ListBox tabList;
        private System.Windows.Forms.DataGridView dgvTab;
        private System.Windows.Forms.TextBox txtEntityNS;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.TextBox txtMapperNS;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Button btnGeneAll;
        private System.Windows.Forms.Button btnAll;
        private System.Windows.Forms.Button btnAnti;
        private System.Windows.Forms.Button btnNone;
        private System.Windows.Forms.Button btnGeneEntity;
        private System.Windows.Forms.Button btnGeneMapper;
        private System.Windows.Forms.TextBox txtTabNS;
        private System.Windows.Forms.Label label1;
    }
}
JavaCode/FrmMyBatisPlus.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,397 @@
using JavaCode.cs;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace JavaCode
{
    public partial class FrmMyBatisPlus : Form
    {
        #region æˆå‘˜å˜é‡+构造函数
        private static List<string> excludes = new List<string>() { "gid", "objectid", "eventid", "dirid", "depid", "verid", "createtime", "createuser", "updateuser", "updatetime", "geom", "shape_leng", "shape_area" };
        string baseDir = AppDomain.CurrentDomain.BaseDirectory;
        private PostgreHelper _dbHelper;
        private List<TabInfo> _list;
        public FrmMyBatisPlus()
        {
            InitializeComponent();
        }
        private void FrmMyBatisPlus_Load(object sender, EventArgs e)
        {
            _dbHelper = new PostgreHelper(DbEnum.langfang);
        }
        #endregion
        #region æŸ¥è¯¢è¡¨ç»“构:163875,166056  29257,20582
        private void btnReadTab_Click(object sender, EventArgs e)
        {
            try
            {
                string tabName = this.txtTabPre.Text.Trim();
                string tabFilter = string.IsNullOrEmpty(tabName) ? "" : string.Format("and c.relname like '{0}%'", tabName);
                string sql = string.Format("select c.relname \"tab\", cast(obj_description(c.oid) as varchar) \"desc\", a.attnum \"num\", a.attname \"col\", t.typname \"type\", d.description \"bak\" from pg_attribute a left join pg_description d on d.objoid = a.attrelid and d.objsubid = a.attnum left join pg_class c on a.attrelid = c.oid left join pg_type t on a.atttypid = t.oid where a.attnum >= 0 and reltype>0 and relnamespace in ({0}) {1} order by c.relname desc, a.attnum asc", this.txtNS.Text.Trim(), tabFilter);
                DataTable dt = _dbHelper.GetDataTable(sql, null);
                _list = ModelHandler.FillModel<TabInfo>(dt);
                if (_list == null || _list.Count == 0)
                {
                    MessageBox.Show("没有查询到数据!");
                    return;
                }
                List<string> tabList = new List<string>();
                foreach (TabInfo ti in _list)
                {
                    if (!tabList.Contains(ti.tab))
                    {
                        tabList.Add(ti.tab);
                    }
                }
                this.tabList.DataSource = tabList;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void btnAll_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < this.tabList.Items.Count; i++)
            {
                this.tabList.SetSelected(i, true);
            }
        }
        private void btnAnti_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < this.tabList.Items.Count; i++)
            {
                bool flag = this.tabList.GetSelected(i);
                this.tabList.SetSelected(i, !flag);
            }
        }
        private void btnNone_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < this.tabList.Items.Count; i++)
            {
                this.tabList.SetSelected(i, false);
            }
        }
        private void tabList_SelectedIndexChanged(object sender, EventArgs e)
        {
            string tab = this.tabList.SelectedItem as string;
            List<TabInfo> tabs = (from p in _list where p.tab == tab orderby p.num select p).ToList<TabInfo>();
            this.dgvTab.DataSource = new BindingList<TabInfo>(tabs);
            if (tabs != null && tabs.Count > 1)
            {
                this.dgvTab.Rows[1].Selected = true;
                this.dgvTab.CurrentCell = this.dgvTab.Rows[1].Cells[0];
            }
        }
        #endregion
        #region æŒ‰é’®äº‹ä»¶
        private void btnGeneMapper_Click(object sender, EventArgs e)
        {
            try
            {
                string path = Path.Combine(baseDir, "BsGenerate\\Mapper");
                List<string> names = GetTabList();
                foreach (string name in names)
                {
                    List<TabInfo> tabs = GetTabInfo(name);
                    GenerateMapper(path, name, tabs);
                }
                OpenFolder(path);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void btnGeneEntity_Click(object sender, EventArgs e)
        {
            try
            {
                string path = Path.Combine(baseDir, "BsGenerate\\Entity");
                List<string> names = GetTabList();
                foreach (string name in names)
                {
                    List<TabInfo> tabs = GetTabInfo(name);
                    GenerateEntity(path, name, tabs);
                }
                OpenFolder(path);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void btnGeneAll_Click(object sender, EventArgs e)
        {
            try
            {
                string mapperPath = Path.Combine(baseDir, "BsGenerate\\Mapper");
                string entityPath = Path.Combine(baseDir, "BsGenerate\\Entity");
                List<string> names = GetTabList();
                foreach (string name in names)
                {
                    List<TabInfo> tabs = GetTabInfo(name);
                    GenerateMapper(mapperPath, name, tabs);
                    GenerateEntity(entityPath, name, tabs);
                }
                string path = Path.Combine(baseDir, "BsGenerate");
                OpenFolder(path);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        #endregion
        #region ç”Ÿæˆ Mapper
        private void GenerateMapper(string path, string name, List<TabInfo> tabs)
        {
            if (!Directory.Exists(path)) Directory.CreateDirectory(path);
            string tabName = this.txtTabNS.Text.Trim() + name;
            //string shortName = NameConvert(name, true);
            string shortName = GetEntityName(name, true);
            string mapperNS = this.txtMapperNS.Text.Trim();
            string mapperName = shortName + "Mapper";
            string entityNS = this.txtEntityNS.Text.Trim();
            string entityName = shortName + "Entity";
            string bak = string.IsNullOrWhiteSpace(tabs[0].desc) ? shortName : tabs[0].desc.Replace("表", "");
            string javaFile = this.HasGeom(tabs) ? "GeoMapper.java" : "Mapper.java";
            string xml = File.ReadAllText(Path.Combine(baseDir, "BsTemplate\\" + javaFile));
            xml = xml
                .Replace("{mapperNS}", mapperNS)
                .Replace("{mapperName}", mapperName)
                .Replace("{entityNS}", entityNS)
                .Replace("{entityName}", entityName)
                .Replace("{bak}", bak);
            string fileName = shortName + "Mapper.java";
            File.WriteAllText(Path.Combine(path, fileName), xml);
        }
        #endregion
        #region ç”Ÿæˆ Entity
        private void GenerateEntity(string path, string name, List<TabInfo> tabs)
        {
            if (!Directory.Exists(path)) Directory.CreateDirectory(path);
            string tabName = this.txtTabNS.Text.Trim() + name;
            //string shortName = NameConvert(name, true);
            string shortName = GetEntityName(name, true);
            string entityNS = this.txtEntityNS.Text.Trim();
            string entityName = shortName + "Entity";
            string bak = string.IsNullOrWhiteSpace(tabs[0].desc) ? shortName : tabs[0].desc.Replace("表", "");
            long uid = (long)Math.Floor((new Random()).NextDouble() * 1000000000000000000D);
            string javaFile = this.HasGeom(tabs) ? "GeoEntity.java" : "Entity.java";
            string xml = File.ReadAllText(Path.Combine(baseDir, "BsTemplate\\" + javaFile));
            xml = xml
                .Replace("{entityNS}", entityNS)
                .Replace("{entityName}", entityName)
                .Replace("{bak}", bak)
                .Replace("{tabName}", tabName)
                .Replace("{uid}", uid.ToString());
            StringBuilder sb = new StringBuilder();
            foreach (TabInfo ti in tabs)
            {
                string type = GetJavaType(ti);
                //if (ti.col == "gid") sb.Append("\r\n    @TableId(type = IdType.AUTO)");
                //if (ti.col == "geom" || ti.col == "shape_leng" || ti.col == "shape_area")
                //{
                //    sb.Append("\r\n    @TableField(select = false)");
                //}
                if (excludes.Contains(ti.col)) continue;
                if (ti.col == "class")
                {
                    //sb.Append("\r\n    @TableField(value = \"class\")");
                    //ti.col = "clazz";
                    //ti.col = "classes";
                    MessageBox.Show(ti.tab);
                    return;
                }
                string colName = NameConvert(ti.col, false);
                sb.Append("\r\n    private " + type + " " + colName + ";\r\n");
            }
            sb.Append("\r\n    public " + entityName + "() {\r\n    }\r\n");
            foreach (TabInfo ti in tabs)
            {
                if (excludes.Contains(ti.col)) continue;
                string type = GetJavaType(ti);
                string col1 = NameConvert(ti.col, true);
                string col2 = NameConvert(ti.col, false);
                sb.Append("\r\n    public " + type + " get" + col1 + "() {\r\n        return " + col2 + ";\r\n    }\r\n");
                sb.Append("\r\n    public void set" + col1 + "(" + type + " " + col2 + ") {\r\n        this." + col2 + " = " + col2 + ";\r\n    }\r\n");
            }
            sb.Append("}\r\n");
            sb.Insert(0, xml);
            string fileName = shortName + "Entity.java";
            File.WriteAllText(Path.Combine(path, fileName), sb.ToString());
        }
        #endregion
        #region å…¬å…±æ–¹æ³•
        private List<string> GetTabList()
        {
            List<string> list = new List<string>();
            for (int i = 0, c = this.tabList.SelectedItems.Count; i < c; i++)
            {
                string item = this.tabList.SelectedItems[i] as String;
                if (!string.IsNullOrEmpty(item))
                {
                    list.Add(item);
                }
            }
            return list;
        }
        private List<TabInfo> GetTabInfo(string name)
        {
            List<TabInfo> tabs = (from p in _list where p.tab == name orderby p.num select p).ToList<TabInfo>();
            return tabs;
        }
        private static string GetEntityName(string name, bool firstUpper)
        {
            return firstUpper ? ToUpperFirst(name.Replace("_", "")) : name.Replace("_", "");
        }
        private static string NameConvert(string name, bool firstUpper)
        {
            string[] strs = name.Split(new char[] { '_' });
            string str = "";
            for (int i = 0, c = strs.Length; i < c; i++)
            {
                if (i == 0 && !firstUpper)
                {
                    str += strs[i];
                    continue;
                }
                str += strs[i].Length == 1 ? strs[i] : ToUpperFirst(strs[i]);
            }
            return str;
        }
        public static string ToUpperFirst(string str)
        {
            return Regex.Replace(str, @"^\w", t => t.Value.ToUpper());
        }
        private string GetJavaType(TabInfo ti)
        {
            switch (ti.type)
            {
                case "timestamp":
                    return "Timestamp";
                case "float4": // float
                    return "Float";
                case "float8": // double
                    return "Double";
                case "bool": // boolean
                    return "Boolean";
                case "numeric":
                    return "BigDecimal";
                case "int8": // long
                    return "Long";
                case "int2":
                case "int4": // int
                    return "Integer";
                default:
                    return "String";
            }
        }
        private bool HasGeom(List<TabInfo> tabs)
        {
            foreach (TabInfo ti in tabs)
            {
                if (ti.col == "geom") return true;
            }
            return false;
        }
        private static void OpenFolder(string folderPath)
        {
            if (string.IsNullOrEmpty(folderPath)) return;
            Process process = new Process();
            ProcessStartInfo psi = new ProcessStartInfo("Explorer.exe");
            psi.Arguments = folderPath;
            process.StartInfo = psi;
            try
            {
                process.Start();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                process.Close();
            }
        }
        private String QueryPrimaryKey(string tab)
        {
            string sql = string.Format("select pg_attribute.attname as colname from pg_constraint inner join pg_class on pg_constraint.conrelid = pg_class.oid inner join pg_attribute on pg_attribute.attrelid = pg_class.oid and pg_attribute.attnum = pg_constraint.conkey[1] inner join pg_type on pg_type.oid = pg_attribute.atttypid where pg_class.relname = '{0}' and pg_constraint.contype='p'", tab);
            object obj = _dbHelper.GetScalar(sql, null);
            return obj == null ? null : obj.ToString();
        }
        #endregion
    }
}
JavaCode/FrmMyBatisPlus.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
</root>
JavaCode/FrmSys.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,410 @@
namespace JavaCode
{
    partial class FrmSys
    {
        /// <summary>
        /// å¿…需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;
        /// <summary>
        /// æ¸…理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
        #region Windows çª—体设计器生成的代码
        /// <summary>
        /// è®¾è®¡å™¨æ”¯æŒæ‰€éœ€çš„æ–¹æ³• - ä¸è¦
        /// ä½¿ç”¨ä»£ç ç¼–辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.tabList = new System.Windows.Forms.ListBox();
            this.btnReadTab = new System.Windows.Forms.Button();
            this.txtTabPre = new System.Windows.Forms.TextBox();
            this.txtMapperNS = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.txtEntityNS = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.button4 = new System.Windows.Forms.Button();
            this.dgvTab = new System.Windows.Forms.DataGridView();
            this.label4 = new System.Windows.Forms.Label();
            this.txtInsert = new System.Windows.Forms.TextBox();
            this.txtUpdate = new System.Windows.Forms.TextBox();
            this.label5 = new System.Windows.Forms.Label();
            this.button5 = new System.Windows.Forms.Button();
            this.button6 = new System.Windows.Forms.Button();
            this.button1 = new System.Windows.Forms.Button();
            this.txtNS = new System.Windows.Forms.TextBox();
            this.button2 = new System.Windows.Forms.Button();
            this.button3 = new System.Windows.Forms.Button();
            this.txtServiceNS = new System.Windows.Forms.TextBox();
            this.label6 = new System.Windows.Forms.Label();
            this.txtControllerNS = new System.Windows.Forms.TextBox();
            this.label7 = new System.Windows.Forms.Label();
            this.txtApiTag = new System.Windows.Forms.TextBox();
            this.label8 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.txtTabNS = new System.Windows.Forms.TextBox();
            ((System.ComponentModel.ISupportInitialize)(this.dgvTab)).BeginInit();
            this.SuspendLayout();
            //
            // tabList
            //
            this.tabList.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.tabList.FormattingEnabled = true;
            this.tabList.ItemHeight = 16;
            this.tabList.Location = new System.Drawing.Point(12, 49);
            this.tabList.Name = "tabList";
            this.tabList.Size = new System.Drawing.Size(353, 244);
            this.tabList.TabIndex = 0;
            this.tabList.SelectedIndexChanged += new System.EventHandler(this.tabList_SelectedIndexChanged);
            //
            // btnReadTab
            //
            this.btnReadTab.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnReadTab.Location = new System.Drawing.Point(247, 13);
            this.btnReadTab.Name = "btnReadTab";
            this.btnReadTab.Size = new System.Drawing.Size(118, 23);
            this.btnReadTab.TabIndex = 1;
            this.btnReadTab.Text = "读取数据库表";
            this.btnReadTab.UseVisualStyleBackColor = true;
            this.btnReadTab.Click += new System.EventHandler(this.btnReadTab_Click);
            //
            // txtTabPre
            //
            this.txtTabPre.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtTabPre.Location = new System.Drawing.Point(129, 10);
            this.txtTabPre.Name = "txtTabPre";
            this.txtTabPre.Size = new System.Drawing.Size(100, 26);
            this.txtTabPre.TabIndex = 2;
            this.txtTabPre.Text = "sys_";
            //
            // txtMapperNS
            //
            this.txtMapperNS.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtMapperNS.Location = new System.Drawing.Point(529, 51);
            this.txtMapperNS.Name = "txtMapperNS";
            this.txtMapperNS.Size = new System.Drawing.Size(339, 26);
            this.txtMapperNS.TabIndex = 9;
            this.txtMapperNS.Text = "com.lf.server.mapper.sys";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label2.Location = new System.Drawing.Point(389, 56);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(136, 16);
            this.label2.TabIndex = 8;
            this.label2.Text = "Mapper名称空间:";
            //
            // txtEntityNS
            //
            this.txtEntityNS.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtEntityNS.Location = new System.Drawing.Point(529, 88);
            this.txtEntityNS.Name = "txtEntityNS";
            this.txtEntityNS.Size = new System.Drawing.Size(339, 26);
            this.txtEntityNS.TabIndex = 11;
            this.txtEntityNS.Text = "com.lf.server.entity.sys";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label3.Location = new System.Drawing.Point(389, 93);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(136, 16);
            this.label3.TabIndex = 10;
            this.label3.Text = "Entity名称空间:";
            //
            // button4
            //
            this.button4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.button4.Location = new System.Drawing.Point(885, 202);
            this.button4.Name = "button4";
            this.button4.Size = new System.Drawing.Size(183, 25);
            this.button4.TabIndex = 12;
            this.button4.Text = "生 æˆ æ‰€ æœ‰ æ–‡ ä»¶";
            this.button4.UseVisualStyleBackColor = true;
            this.button4.Click += new System.EventHandler(this.generateAll_Click);
            //
            // dgvTab
            //
            this.dgvTab.AllowUserToAddRows = false;
            this.dgvTab.AllowUserToDeleteRows = false;
            this.dgvTab.BackgroundColor = System.Drawing.SystemColors.ButtonFace;
            this.dgvTab.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dgvTab.Location = new System.Drawing.Point(12, 312);
            this.dgvTab.Margin = new System.Windows.Forms.Padding(0);
            this.dgvTab.MultiSelect = false;
            this.dgvTab.Name = "dgvTab";
            this.dgvTab.ReadOnly = true;
            this.dgvTab.RowHeadersWidth = 40;
            this.dgvTab.RowTemplate.Height = 23;
            this.dgvTab.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.dgvTab.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            this.dgvTab.Size = new System.Drawing.Size(1056, 300);
            this.dgvTab.TabIndex = 13;
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label4.Location = new System.Drawing.Point(387, 241);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(136, 16);
            this.label4.TabIndex = 14;
            this.label4.Text = "插入时排除字段:";
            //
            // txtInsert
            //
            this.txtInsert.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtInsert.Location = new System.Drawing.Point(529, 236);
            this.txtInsert.Name = "txtInsert";
            this.txtInsert.Size = new System.Drawing.Size(339, 26);
            this.txtInsert.TabIndex = 15;
            this.txtInsert.Text = "id,update_user,update_time";
            //
            // txtUpdate
            //
            this.txtUpdate.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtUpdate.Location = new System.Drawing.Point(529, 271);
            this.txtUpdate.Name = "txtUpdate";
            this.txtUpdate.Size = new System.Drawing.Size(339, 26);
            this.txtUpdate.TabIndex = 17;
            this.txtUpdate.Text = "id,create_user,create_time";
            //
            // label5
            //
            this.label5.AutoSize = true;
            this.label5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label5.Location = new System.Drawing.Point(387, 276);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(136, 16);
            this.label5.TabIndex = 16;
            this.label5.Text = "更新时排除字段:";
            //
            // button5
            //
            this.button5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.button5.Location = new System.Drawing.Point(885, 14);
            this.button5.Name = "button5";
            this.button5.Size = new System.Drawing.Size(183, 25);
            this.button5.TabIndex = 18;
            this.button5.Text = "生 æˆ Mapper.xml";
            this.button5.UseVisualStyleBackColor = true;
            this.button5.Click += new System.EventHandler(this.mapperXml_Click);
            //
            // button6
            //
            this.button6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.button6.Location = new System.Drawing.Point(885, 52);
            this.button6.Name = "button6";
            this.button6.Size = new System.Drawing.Size(183, 25);
            this.button6.TabIndex = 19;
            this.button6.Text = "生 æˆ Mapper.java";
            this.button6.UseVisualStyleBackColor = true;
            this.button6.Click += new System.EventHandler(this.mapperJava_Click);
            //
            // button1
            //
            this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.button1.Location = new System.Drawing.Point(885, 89);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(183, 25);
            this.button1.TabIndex = 20;
            this.button1.Text = "生 æˆ Entity.java";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.entityJava_Click);
            //
            // txtNS
            //
            this.txtNS.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtNS.Location = new System.Drawing.Point(12, 10);
            this.txtNS.Name = "txtNS";
            this.txtNS.Size = new System.Drawing.Size(100, 26);
            this.txtNS.TabIndex = 21;
            this.txtNS.Text = "20582";
            //
            // button2
            //
            this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.button2.Location = new System.Drawing.Point(885, 127);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(183, 25);
            this.button2.TabIndex = 22;
            this.button2.Text = "生 æˆ Service.java";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.serviceJava_Click);
            //
            // button3
            //
            this.button3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.button3.Location = new System.Drawing.Point(885, 165);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(183, 25);
            this.button3.TabIndex = 23;
            this.button3.Text = "生成 Controller.java";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new System.EventHandler(this.controllerJava_Click);
            //
            // txtServiceNS
            //
            this.txtServiceNS.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtServiceNS.Location = new System.Drawing.Point(529, 126);
            this.txtServiceNS.Name = "txtServiceNS";
            this.txtServiceNS.Size = new System.Drawing.Size(339, 26);
            this.txtServiceNS.TabIndex = 25;
            this.txtServiceNS.Text = "com.lf.server.service.sys";
            //
            // label6
            //
            this.label6.AutoSize = true;
            this.label6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label6.Location = new System.Drawing.Point(381, 131);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(144, 16);
            this.label6.TabIndex = 24;
            this.label6.Text = "Service名称空间:";
            //
            // txtControllerNS
            //
            this.txtControllerNS.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtControllerNS.Location = new System.Drawing.Point(529, 164);
            this.txtControllerNS.Name = "txtControllerNS";
            this.txtControllerNS.Size = new System.Drawing.Size(339, 26);
            this.txtControllerNS.TabIndex = 27;
            this.txtControllerNS.Text = "com.lf.server.controller.sys";
            //
            // label7
            //
            this.label7.AutoSize = true;
            this.label7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label7.Location = new System.Drawing.Point(365, 169);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(160, 16);
            this.label7.TabIndex = 26;
            this.label7.Text = "Controller名称空间:";
            //
            // txtApiTag
            //
            this.txtApiTag.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtApiTag.Location = new System.Drawing.Point(529, 201);
            this.txtApiTag.Name = "txtApiTag";
            this.txtApiTag.Size = new System.Drawing.Size(339, 26);
            this.txtApiTag.TabIndex = 29;
            this.txtApiTag.Text = "运维管理\\\\{bak}";
            //
            // label8
            //
            this.label8.AutoSize = true;
            this.label8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label8.Location = new System.Drawing.Point(445, 206);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(80, 16);
            this.label8.TabIndex = 28;
            this.label8.Text = "Api标识:";
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label1.Location = new System.Drawing.Point(437, 18);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(88, 16);
            this.label1.TabIndex = 6;
            this.label1.Text = "表名前缀:";
            //
            // txtTabNS
            //
            this.txtTabNS.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtTabNS.Location = new System.Drawing.Point(529, 13);
            this.txtTabNS.Name = "txtTabNS";
            this.txtTabNS.Size = new System.Drawing.Size(339, 26);
            this.txtTabNS.TabIndex = 7;
            this.txtTabNS.Text = "lf.";
            //
            // FrmSys
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(1095, 630);
            this.Controls.Add(this.txtApiTag);
            this.Controls.Add(this.label8);
            this.Controls.Add(this.txtControllerNS);
            this.Controls.Add(this.label7);
            this.Controls.Add(this.txtServiceNS);
            this.Controls.Add(this.label6);
            this.Controls.Add(this.button3);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.txtNS);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.button6);
            this.Controls.Add(this.button5);
            this.Controls.Add(this.txtUpdate);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.txtInsert);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.dgvTab);
            this.Controls.Add(this.button4);
            this.Controls.Add(this.txtEntityNS);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.txtMapperNS);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.txtTabNS);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.txtTabPre);
            this.Controls.Add(this.btnReadTab);
            this.Controls.Add(this.tabList);
            this.Name = "FrmSys";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "FrmSys";
            this.Load += new System.EventHandler(this.FrmMain_Load);
            ((System.ComponentModel.ISupportInitialize)(this.dgvTab)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
        }
        #endregion
        private System.Windows.Forms.ListBox tabList;
        private System.Windows.Forms.Button btnReadTab;
        private System.Windows.Forms.TextBox txtTabPre;
        private System.Windows.Forms.TextBox txtMapperNS;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.TextBox txtEntityNS;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Button button4;
        private System.Windows.Forms.DataGridView dgvTab;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.TextBox txtInsert;
        private System.Windows.Forms.TextBox txtUpdate;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Button button5;
        private System.Windows.Forms.Button button6;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.TextBox txtNS;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.Button button3;
        private System.Windows.Forms.TextBox txtServiceNS;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.TextBox txtControllerNS;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.TextBox txtApiTag;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TextBox txtTabNS;
    }
}
JavaCode/FrmSys.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,678 @@
using JavaCode.cs;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace JavaCode
{
    public partial class FrmSys : Form
    {
        #region æˆå‘˜å˜é‡+构造函数
        string baseDir = AppDomain.CurrentDomain.BaseDirectory;
        private PostgreHelper _dbHelper;
        private List<TabInfo> _list;
        public FrmSys()
        {
            InitializeComponent();
        }
        private void FrmMain_Load(object sender, EventArgs e)
        {
            _dbHelper = new PostgreHelper(DbEnum.langfang);
        }
        #endregion
        #region æŸ¥è¯¢è¡¨ç»“æž„
        private void btnReadTab_Click(object sender, EventArgs e)
        {
            string txtTab = this.txtTabPre.Text.Trim();
            string sql = "select c.relname \"tab\", cast(obj_description(c.oid) as varchar) \"desc\", a.attnum \"num\", a.attname \"col\", t.typname \"type\", d.description \"bak\" from pg_attribute a left join pg_description d on d.objoid = a.attrelid and d.objsubid = a.attnum left join pg_class c on a.attrelid = c.oid left join pg_type t on a.atttypid = t.oid where a.attnum >= 0 and c.relname like '" + txtTab + "%' and obj_description(c.oid) is not null and relnamespace=" + this.txtNS.Text.Trim() + " order by c.relname desc, a.attnum asc";
            DataTable dt = _dbHelper.GetDataTable(sql, null);
            _list = ModelHandler.FillModel<TabInfo>(dt);
            if (_list == null || _list.Count == 0)
            {
                MessageBox.Show("没有查询到数据!");
                return;
            }
            List<string> tabList = new List<string>();
            foreach (TabInfo ti in _list)
            {
                if (!tabList.Contains(ti.tab))
                {
                    tabList.Add(ti.tab);
                }
            }
            this.tabList.DataSource = tabList;
        }
        private void tabList_SelectedIndexChanged(object sender, EventArgs e)
        {
            string tab = this.tabList.SelectedItem as string;
            List<TabInfo> tabs = (from p in _list where p.tab == tab orderby p.num select p).ToList<TabInfo>();
            this.dgvTab.DataSource = new BindingList<TabInfo>(tabs);
            if (tabs != null && tabs.Count > 1)
            {
                this.dgvTab.Rows[1].Selected = true;
                this.dgvTab.CurrentCell = this.dgvTab.Rows[1].Cells[0];
            }
        }
        #endregion
        #region ç”Ÿæˆ Mapper.Xml
        private void mapperXml_Click(object sender, EventArgs e)
        {
            try
            {
                string name = this.tabList.SelectedItem as string;
                List<TabInfo> tabs = (from p in _list where p.tab == name orderby p.num select p).ToList<TabInfo>();
                GenerateMapperXml(name, tabs);
                string path = Path.Combine(baseDir, "SysGenerate");
                OpenFolder(path);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void GenerateMapperXml(string name, List<TabInfo> tabs)
        {
            string tabName = this.txtTabNS.Text.Trim() + name;
            name = name.Replace(this.txtTabPre.Text, "");
            string shortName = NameConvert(name, true);
            string mapperNS = this.txtMapperNS.Text.Trim();
            string mapperName = shortName + "Mapper";
            string entityNS = this.txtEntityNS.Text.Trim();
            string entityName = shortName + "Entity";
            int idx = this.dgvTab.CurrentRow.Index;
            TabInfo selectTabInfo = tabs[idx];
            string colType = GetJavaType(selectTabInfo);
            string colName = NameConvert(selectTabInfo.col, false);
            string testExpr = colName + " != null";
            string testWhere = selectTabInfo.col + (colType == "String" ? " like " : " = ") + "#{" + colName + "}";
            string insertCols = GetInsertCols(tabs);
            string insertVal = GetInsertVal(tabs);
            string insertVals = GetInsertVals(tabs);
            string updateVal = GetUpdateVal(tabs);
            string updateVals = GetUpdateVals(tabs);
            string xml = File.ReadAllText(Path.Combine(baseDir, "SysTemplate\\Mapper.xml"));
            xml = xml
                .Replace("{mapperNS}", mapperNS)
                .Replace("{mapperName}", mapperName)
                .Replace("{tabName}", tabName)
                .Replace("{testExpr}", testExpr)
                .Replace("{testWhere}", testWhere)
                .Replace("{entityNS}", entityNS)
                .Replace("{entityName}", entityName)
                .Replace("{insertCols}", insertCols)
                .Replace("{insertVal}", insertVal)
                .Replace("{insertVals}", insertVals)
                .Replace("{updateVal}", updateVal)
                .Replace("{updateVals}", updateVals);
            string path = Path.Combine(baseDir, "SysGenerate");
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string fileName = shortName + "Mapper.xml";
            File.WriteAllText(Path.Combine(path, fileName), xml);
        }
        private static string NameConvert(string name, bool firstUpper)
        {
            string[] strs = name.Split(new char[] { '_' });
            string str = "";
            for (int i = 0, c = strs.Length; i < c; i++)
            {
                if (i == 0 && !firstUpper)
                {
                    str += strs[i];
                    continue;
                }
                str += ToUpperFirst(strs[i]);
            }
            return str;
        }
        public static string ToUpperFirst(string str)
        {
            return Regex.Replace(str, @"^\w", t => t.Value.ToUpper());
        }
        public string GetInsertCols(List<TabInfo> tabs)
        {
            List<string> excluds = this.txtInsert.Text.Trim().Split(new char[] { ',' }).ToList<string>();
            StringBuilder sb = new StringBuilder();
            foreach (TabInfo ti in tabs)
            {
                if (excluds.Contains(ti.col))
                {
                    continue;
                }
                sb.Append(ti.col + ",");
            }
            if (sb.Length > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }
            return sb.ToString();
        }
        public string GetInsertVal(List<TabInfo> tabs)
        {
            List<string> excluds = this.txtInsert.Text.Trim().Split(new char[] { ',' }).ToList<string>();
            StringBuilder sb = new StringBuilder();
            foreach (TabInfo ti in tabs)
            {
                if (excluds.Contains(ti.col))
                {
                    continue;
                }
                if (ti.type == "timestamp")
                {
                    sb.Append("now(),");
                    continue;
                }
                sb.Append("#{" + NameConvert(ti.col, false) + "},");
            }
            if (sb.Length > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }
            return sb.ToString();
        }
        public string GetInsertVals(List<TabInfo> tabs)
        {
            List<string> excluds = this.txtInsert.Text.Trim().Split(new char[] { ',' }).ToList<string>();
            StringBuilder sb = new StringBuilder();
            foreach (TabInfo ti in tabs)
            {
                if (excluds.Contains(ti.col))
                {
                    continue;
                }
                if (ti.type == "timestamp")
                {
                    sb.Append("now(),");
                    continue;
                }
                sb.Append("#{item." + NameConvert(ti.col, false) + "},");
            }
            if (sb.Length > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }
            return sb.ToString();
        }
        public string GetUpdateVal(List<TabInfo> tabs)
        {
            List<string> excluds = this.txtUpdate.Text.Trim().Split(new char[] { ',' }).ToList<string>();
            StringBuilder sb = new StringBuilder();
            foreach (TabInfo ti in tabs)
            {
                if (excluds.Contains(ti.col))
                {
                    continue;
                }
                if (ti.type == "timestamp")
                {
                    sb.Append(ti.col + "=now(),");
                    continue;
                }
                sb.Append(ti.col + "=#{" + NameConvert(ti.col, false) + "},");
            }
            if (sb.Length > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }
            return sb.ToString();
        }
        public string GetUpdateVals(List<TabInfo> tabs)
        {
            List<string> excluds = this.txtUpdate.Text.Trim().Split(new char[] { ',' }).ToList<string>();
            StringBuilder sb = new StringBuilder();
            foreach (TabInfo ti in tabs)
            {
                if (excluds.Contains(ti.col))
                {
                    continue;
                }
                if (ti.type == "timestamp")
                {
                    sb.Append(ti.col + "=now(),");
                    continue;
                }
                sb.Append(ti.col + "=#{item." + NameConvert(ti.col, false) + "},");
            }
            if (sb.Length > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }
            return sb.ToString();
        }
        private static void OpenFolder(string folderPath)
        {
            if (string.IsNullOrEmpty(folderPath)) return;
            Process process = new Process();
            ProcessStartInfo psi = new ProcessStartInfo("Explorer.exe");
            psi.Arguments = folderPath;
            process.StartInfo = psi;
            try
            {
                process.Start();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                process.Close();
            }
        }
        #endregion
        #region ç”Ÿæˆ Mapper.java
        private void mapperJava_Click(object sender, EventArgs e)
        {
            try
            {
                string name = this.tabList.SelectedItem as string;
                List<TabInfo> tabs = (from p in _list where p.tab == name orderby p.num select p).ToList<TabInfo>();
                GenerateMapperJava(name, tabs);
                string path = Path.Combine(baseDir, "SysGenerate");
                OpenFolder(path);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void GenerateMapperJava(string name, List<TabInfo> tabs)
        {
            name = name.Replace(this.txtTabPre.Text, "");
            string shortName = NameConvert(name, true);
            string mapperNS = this.txtMapperNS.Text.Trim();
            string entityNS = this.txtEntityNS.Text.Trim();
            string mapperName = shortName + "Mapper";
            string entityName = shortName + "Entity";
            string bak = tabs[0].desc.Replace("表", "");
            int idx = this.dgvTab.CurrentRow.Index;
            TabInfo selectTabInfo = tabs[idx];
            string colType  = GetJavaType(selectTabInfo);
            string colName = NameConvert(selectTabInfo.col, false);
            string queryCol = colType + " " + colName;
            string colBak = selectTabInfo.bak;
            string xml = File.ReadAllText(Path.Combine(baseDir, "SysTemplate\\Mapper.java"));
            xml = xml
                .Replace("{mapperNS}", mapperNS)
                .Replace("{mapperName}", mapperName)
                .Replace("{entityNS}", entityNS)
                .Replace("{entityName}", entityName)
                .Replace("{colName}", colName)
                .Replace("{colBak}", colBak)
                .Replace("{bak}", bak)
                .Replace("{queryCol}", queryCol);
            string path = Path.Combine(baseDir, "SysGenerate");
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string fileName = shortName + "Mapper.java";
            File.WriteAllText(Path.Combine(path, fileName), xml);
        }
        private string GetJavaType(TabInfo ti)
        {
            switch (ti.type)
            {
                case "timestamp":
                    return "Timestamp";
                case "float4": // float
                    return "Float";
                case "float8": // double
                    return "Double";
                case "bool": // boolean
                    return "Boolean";
                case "numeric":
                    return "BigDecimal";
                case "int8": // long
                    return "Long";
                case "int2":
                case "int4": // int
                    return "Integer";
                default:
                    return "String";
            }
        }
        private String GetType(TabInfo ti)
        {
            switch (ti.type)
            {
                case "timestamp":
                    return "Timestamp";
                case "float4":
                    return "float";
                case "float8":
                    return "double";
                case "bool":
                    return "boolean";
                case "numeric":
                    return "BigDecimal";
                case "int8":
                    return "long";
                case "int2":
                case "int4":
                    return "int";
                default:
                    return "String";
            }
        }
        #endregion
        #region ç”Ÿæˆ Entity.java
        private void entityJava_Click(object sender, EventArgs e)
        {
            try
            {
                string name = this.tabList.SelectedItem as string;
                List<TabInfo> tabs = (from p in _list where p.tab == name orderby p.num select p).ToList<TabInfo>();
                GenerateEntityJava(name, tabs);
                string path = Path.Combine(baseDir, "SysGenerate");
                OpenFolder(path);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void GenerateEntityJava(string name, List<TabInfo> tabs)
        {
            name = name.Replace(this.txtTabPre.Text, "");
            string shortName = NameConvert(name, true);
            string entityNS = this.txtEntityNS.Text.Trim();
            string entityName = shortName + "Entity";
            string bak = tabs[0].desc.Replace("表", "");
            long uid = (long)Math.Floor((new Random()).NextDouble() * 1000000000000000000D);
            int idx = this.dgvTab.CurrentRow.Index;
            TabInfo selectTabInfo = tabs[idx];
            string xml = File.ReadAllText(Path.Combine(baseDir, "SysTemplate\\Entity.java"));
            xml = xml
                .Replace("{entityNS}", entityNS)
                .Replace("{entityName}", entityName)
                .Replace("{bak}", bak)
                .Replace("{uid}", uid.ToString());
            StringBuilder sb = new StringBuilder();
            foreach (TabInfo ti in tabs)
            {
                string type = GetType(ti);
                string colName = NameConvert(ti.col, false);
                sb.Append("\r\n    private " + type + " " + colName + ";\r\n");
            }
            sb.Append("\r\n    public " + entityName + "() {\r\n    }\r\n");
            foreach (TabInfo ti in tabs)
            {
                string type = GetType(ti);
                string col1 = NameConvert(ti.col, true);
                string col2 = NameConvert(ti.col, false);
                sb.Append("\r\n    public " + type + " get" + col1 + "() {\r\n        return " + col2 + ";\r\n    }\r\n");
                sb.Append("\r\n    public void set" + col1 + "(" + type + " " + col2 + ") {\r\n        this." + col2 + " = " + col2 + ";\r\n    }\r\n");
            }
            sb.Append("}\r\n");
            string path = Path.Combine(baseDir, "SysGenerate");
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            sb.Insert(0, xml);
            string fileName = shortName + "Entity.java";
            File.WriteAllText(Path.Combine(path, fileName), sb.ToString());
        }
        #endregion
        #region ç”Ÿæˆ Service.java
        private void serviceJava_Click(object sender, EventArgs e)
        {
            try
            {
                string name = this.tabList.SelectedItem as string;
                List<TabInfo> tabs = (from p in _list where p.tab == name orderby p.num select p).ToList<TabInfo>();
                GenerateServiceJava(name, tabs);
                string path = Path.Combine(baseDir, "SysGenerate");
                OpenFolder(path);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void GenerateServiceJava(string name, List<TabInfo> tabs)
        {
            name = name.Replace(this.txtTabPre.Text, "");
            string shortName = NameConvert(name, true);
            string mapperNS = this.txtMapperNS.Text.Trim();
            string entityNS = this.txtEntityNS.Text.Trim();
            string serviceNS = this.txtServiceNS.Text.Trim();
            string mapperName = shortName + "Mapper";
            string minMapperName = NameConvert(name, false) + "Mapper";
            string entityName = shortName + "Entity";
            string serviceName = shortName + "Service";
            string bak = tabs[0].desc.Replace("表", "");
            int idx = this.dgvTab.CurrentRow.Index;
            TabInfo selectTabInfo = tabs[idx];
            string colType = GetJavaType(selectTabInfo);
            string colName = NameConvert(selectTabInfo.col, false);
            string queryCol = colType + " " + colName;
            //string where = isString ? "\r\n        " + colName + " = \"%\" + (StringHelper.isNull(" + colName + ") ? \"\" : " + colName + ".trim()) + \"%\";\r\n" : "";
            //string where = colType == "String" ? "\r\n        " + colName + " = StringHelper.isNull(" + colName + ") ? null : \"%\" + " + colName + ".trim() + \"%\";\r\n" : "";
            string where = colType == "String" ? "\r\n        " + colName + " = StringHelper.getLikeStr(" + colName + ");\r\n" : "";
            string xml = File.ReadAllText(Path.Combine(baseDir, "SysTemplate\\Service.java"));
            xml = xml
                .Replace("{mapperNS}", mapperNS)
                .Replace("{mapperName}", mapperName)
                .Replace("{minMapperName}", minMapperName)
                .Replace("{entityNS}", entityNS)
                .Replace("{entityName}", entityName)
                .Replace("{serviceNS}", serviceNS)
                .Replace("{serviceName}", serviceName)
                .Replace("{bak}", bak)
                .Replace("{queryCol}", queryCol)
                .Replace("{colName}", colName)
                .Replace("{where}", where);
            string path = Path.Combine(baseDir, "SysGenerate");
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string fileName = shortName + "Service.java";
            File.WriteAllText(Path.Combine(path, fileName), xml);
        }
        #endregion
        #region ç”Ÿæˆ Controller.java
        private void controllerJava_Click(object sender, EventArgs e)
        {
            try
            {
                string name = this.tabList.SelectedItem as string;
                List<TabInfo> tabs = (from p in _list where p.tab == name orderby p.num select p).ToList<TabInfo>();
                GenerateControllerJava(name, tabs);
                string path = Path.Combine(baseDir, "SysGenerate");
                OpenFolder(path);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void GenerateControllerJava(string name, List<TabInfo> tabs)
        {
            name = name.Replace(this.txtTabPre.Text, "");
            string shortName = NameConvert(name, true);
            string mapperNS = this.txtMapperNS.Text.Trim();
            string entityNS = this.txtEntityNS.Text.Trim();
            string serviceNS = this.txtServiceNS.Text.Trim();
            string controllerNS = this.txtControllerNS.Text.Trim();
            string apiTag = this.txtApiTag.Text.Trim();
            string mapperName = shortName + "Mapper";
            string entityName = shortName + "Entity";
            string serviceName = shortName + "Service";
            string minServiceName = NameConvert(name, false) + "Service";
            string controllerName = shortName + "Controller";
            string bak = tabs[0].desc.Replace("表", "");
            string apiName = NameConvert(name, false);
            int idx = this.dgvTab.CurrentRow.Index;
            TabInfo selectTabInfo = tabs[idx];
            string colType = GetJavaType(selectTabInfo);
            string colName = NameConvert(selectTabInfo.col, false);
            string queryCol = colType + " " + colName;
            string colBak = selectTabInfo.bak;
            string xml = File.ReadAllText(Path.Combine(baseDir, "SysTemplate\\Controller.java"));
            xml = xml
                .Replace("{mapperNS}", mapperNS)
                .Replace("{mapperName}", mapperName)
                .Replace("{entityNS}", entityNS)
                .Replace("{entityName}", entityName)
                .Replace("{serviceNS}", serviceNS)
                .Replace("{serviceName}", serviceName)
                .Replace("{controllerNS}", controllerNS)
                .Replace("{controllerName}", controllerName)
                .Replace("{minServiceName}", minServiceName)
                .Replace("{queryCol}", queryCol)
                .Replace("{colName}", colName)
                .Replace("{colBak}", colBak)
                .Replace("{colType}", colType)
                .Replace("{apiTag}", apiTag)
                .Replace("{apiName}", apiName)
                .Replace("{bak}", bak);
            string path = Path.Combine(baseDir, "SysGenerate");
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string fileName = shortName + "Controller.java";
            File.WriteAllText(Path.Combine(path, fileName), xml);
        }
        #endregion
        #region ç”Ÿæˆæ‰€æœ‰æ–‡ä»¶
        private void generateAll_Click(object sender, EventArgs e)
        {
            try
            {
                string name = this.tabList.SelectedItem as string;
                List<TabInfo> tabs = (from p in _list where p.tab == name orderby p.num select p).ToList<TabInfo>();
                GenerateMapperXml(name, tabs);
                GenerateMapperJava(name, tabs);
                GenerateEntityJava(name, tabs);
                GenerateServiceJava(name, tabs);
                GenerateControllerJava(name, tabs);
                string path = Path.Combine(baseDir, "SysGenerate");
                OpenFolder(path);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        #endregion
    }
}
JavaCode/FrmSys.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
</root>
JavaCode/JavaCode.csproj
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{49F2AA44-7BF5-46B7-B08F-40AA1455F089}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>JavaCode</RootNamespace>
    <AssemblyName>JavaCode</AssemblyName>
    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>DLL\Mono.Security.dll</HintPath>
    </Reference>
    <Reference Include="Npgsql, Version=2.2.3.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>DLL\Npgsql.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.configuration" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Deployment" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="cs\ModelHandler.cs" />
    <Compile Include="cs\PostgreHelper.cs" />
    <Compile Include="cs\TabInfo.cs" />
    <Compile Include="FrmMain.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="FrmMain.Designer.cs">
      <DependentUpon>FrmMain.cs</DependentUpon>
    </Compile>
    <Compile Include="FrmSys.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="FrmSys.Designer.cs">
      <DependentUpon>FrmSys.cs</DependentUpon>
    </Compile>
    <Compile Include="FrmMyBatisPlus.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="FrmMyBatisPlus.Designer.cs">
      <DependentUpon>FrmMyBatisPlus.cs</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <EmbeddedResource Include="FrmMain.resx">
      <DependentUpon>FrmMain.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <EmbeddedResource Include="FrmSys.resx">
      <DependentUpon>FrmSys.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <EmbeddedResource Include="FrmMyBatisPlus.resx">
      <DependentUpon>FrmMyBatisPlus.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config">
      <SubType>Designer</SubType>
    </None>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="BsTemplate\Entity.java">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </EmbeddedResource>
    <EmbeddedResource Include="BsTemplate\Mapper.java">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </EmbeddedResource>
    <EmbeddedResource Include="BsTemplate\GeoMapper.java">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </EmbeddedResource>
    <EmbeddedResource Include="BsTemplate\GeoEntity.java">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </EmbeddedResource>
    <Content Include="DLL\Mono.Security.dll" />
    <Content Include="DLL\Npgsql.dll" />
    <Content Include="SysTemplate\pg.sql" />
    <EmbeddedResource Include="SysTemplate\Controller.java">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </EmbeddedResource>
    <EmbeddedResource Include="SysTemplate\Entity.java">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </EmbeddedResource>
    <EmbeddedResource Include="SysTemplate\Service.java">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </EmbeddedResource>
    <EmbeddedResource Include="SysTemplate\Mapper.java">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </EmbeddedResource>
    <EmbeddedResource Include="SysTemplate\Mapper.xml">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup />
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
JavaCode/Program.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace JavaCode
{
    static class Program
    {
        /// <summary>
        /// åº”用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMain());
        }
    }
}
JavaCode/Properties/AssemblyInfo.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// æœ‰å…³ç¨‹åºé›†çš„常规信息通过以下
// ç‰¹æ€§é›†æŽ§åˆ¶ã€‚更改这些特性值可修改
// ä¸Žç¨‹åºé›†å…³è”的信息。
[assembly: AssemblyTitle("JavaCode")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP Inc.")]
[assembly: AssemblyProduct("JavaCode")]
[assembly: AssemblyCopyright("Copyright Â© HP Inc. 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// å°† ComVisible è®¾ç½®ä¸º false ä½¿æ­¤ç¨‹åºé›†ä¸­çš„类型
// å¯¹ COM ç»„件不可见。如果需要从 COM è®¿é—®æ­¤ç¨‹åºé›†ä¸­çš„类型,
// åˆ™å°†è¯¥ç±»åž‹ä¸Šçš„ ComVisible ç‰¹æ€§è®¾ç½®ä¸º true。
[assembly: ComVisible(false)]
// å¦‚果此项目向 COM å…¬å¼€ï¼Œåˆ™ä¸‹åˆ— GUID ç”¨äºŽç±»åž‹åº“çš„ ID
[assembly: Guid("bab5d8a8-948d-46c1-aa49-97e6bebeab0a")]
// ç¨‹åºé›†çš„版本信息由下面四个值组成:
//
//      ä¸»ç‰ˆæœ¬
//      æ¬¡ç‰ˆæœ¬
//      ç”Ÿæˆå·
//      ä¿®è®¢å·
//
// å¯ä»¥æŒ‡å®šæ‰€æœ‰è¿™äº›å€¼ï¼Œä¹Ÿå¯ä»¥ä½¿ç”¨â€œç”Ÿæˆå·â€å’Œâ€œä¿®è®¢å·â€çš„默认值,
// æ–¹æ³•是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
JavaCode/Properties/Resources.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
//     æ­¤ä»£ç ç”±å·¥å…·ç”Ÿæˆã€‚
//     è¿è¡Œæ—¶ç‰ˆæœ¬: 4.0.30319.42000
//
//     å¯¹æ­¤æ–‡ä»¶çš„æ›´æ”¹å¯èƒ½ä¼šå¯¼è‡´ä¸æ­£ç¡®çš„行为,并且如果
//     é‡æ–°ç”Ÿæˆä»£ç ï¼Œè¿™äº›æ›´æ”¹å°†ä¸¢å¤±ã€‚
// </auto-generated>
//------------------------------------------------------------------------------
namespace JavaCode.Properties
{
    /// <summary>
    ///   ä¸€ä¸ªå¼ºç±»åž‹çš„资源类,用于查找本地化的字符串等。
    /// </summary>
    // æ­¤ç±»æ˜¯ç”± StronglyTypedResourceBuilder
    // ç±»é€šè¿‡ç±»ä¼¼äºŽ ResGen æˆ– Visual Studio çš„工具自动生成的。
    // è‹¥è¦æ·»åŠ æˆ–ç§»é™¤æˆå‘˜ï¼Œè¯·ç¼–è¾‘ .ResX æ–‡ä»¶ï¼Œç„¶åŽé‡æ–°è¿è¡Œ ResGen
    // (以 /str ä½œä¸ºå‘½ä»¤é€‰é¡¹),或重新生成 VS é¡¹ç›®ã€‚
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Resources
    {
        private static global::System.Resources.ResourceManager resourceMan;
        private static global::System.Globalization.CultureInfo resourceCulture;
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources()
        {
        }
        /// <summary>
        ///   è¿”回此类使用的、缓存的 ResourceManager å®žä¾‹ã€‚
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager
        {
            get
            {
                if ((resourceMan == null))
                {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("JavaCode.Properties.Resources", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        /// <summary>
        ///   ä¸ºæ‰€æœ‰èµ„源查找重写当前线程的 CurrentUICulture å±žæ€§ï¼Œ
        ///   æ–¹æ³•是使用此强类型资源类。
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture
        {
            get
            {
                return resourceCulture;
            }
            set
            {
                resourceCulture = value;
            }
        }
    }
}
JavaCode/Properties/Resources.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
</root>
JavaCode/Properties/Settings.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace JavaCode.Properties
{
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
    {
        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
        public static Settings Default
        {
            get
            {
                return defaultInstance;
            }
        }
    }
}
JavaCode/Properties/Settings.settings
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
  <Profiles>
    <Profile Name="(Default)" />
  </Profiles>
  <Settings />
</SettingsFile>
JavaCode/SysTemplate/Controller.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,253 @@
package {controllerNS};
import com.lf.server.annotation.SysLog;
import com.lf.server.controller.all.BaseController;
import com.lf.server.entity.all.ResponseMsg;
import {entityNS}.{entityName};
import com.lf.server.entity.sys.UserEntity;
import {serviceNS}.{serviceName};
import com.lf.server.service.sys.TokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
 * {bak}
 * @author WWW
 */
@Api(tags = "{apiTag}")
@RestController
@RequestMapping("/{apiName}")
public class {controllerName} extends BaseController {
    @Autowired
    {serviceName} {minServiceName};
    @Autowired
    TokenService tokenService;
    @SysLog()
    @ApiOperation(value = "查询记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "{colName}", value = "{colBak}", dataType = "{colType}", paramType = "query", required = false, example = "")
    })
    @GetMapping({"/selectCount"})
    public ResponseMsg<Integer> selectCount({queryCol}) {
        try {
            int count = {minServiceName}.selectCount({colName});
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "{colName}", value = "{colBak}", dataType = "{colType}", paramType = "query", example = ""),
            @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<{entityName}>> selectByPage({queryCol}, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            List<{entityName}> rs = {minServiceName}.selectByPage({colName}, pageSize, pageSize * (pageIndex - 1));
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "{colName}", value = "{colBak}", dataType = "{colType}", paramType = "query", example = ""),
            @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<{entityName}>> selectByPageAndCount({queryCol}, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            int count = {minServiceName}.selectCount({colName});
            if (count == 0) {
                return success(0, null);
            }
            List<{entityName}> rs = {minServiceName}.selectByPage({colName}, pageSize, pageSize * (pageIndex - 1));
            return success(count, rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询所有")
    @GetMapping(value = "/selectAll")
    public ResponseMsg<List<{entityName}>> selectAll() {
        try {
            List<{entityName}> list = {minServiceName}.selectAll();
            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")
    })
    @GetMapping(value = "/selectById")
    public ResponseMsg<{entityName}> selectById(int id) {
        try {
            {entityName} entity = {minServiceName}.selectById(id);
            return success(entity);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "插入一条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "entity", value = "实体类", dataType = "{entityName}", paramType = "body")
    })
    @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> insert(@RequestBody {entityName} entity, HttpServletRequest req) {
        try {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                entity.setCreateUser(ue.getId());
            }
            int count = {minServiceName}.insert(entity);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "插入多条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "list", value = "实体类集合", dataType = "{entityName}", paramType = "body")
    })
    @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> inserts(@RequestBody List<{entityName}> list, HttpServletRequest req) {
        try {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                for ({entityName} entity : list) {
                    entity.setCreateUser(ue.getId());
                }
            }
            int count = {minServiceName}.inserts(list);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "删除一条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1")
    })
    @GetMapping(value = "/delete")
    public ResponseMsg<Integer> delete(int id) {
        try {
            int count = {minServiceName}.delete(id);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "删除多条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", value = "ID数组", dataType = "Integer", paramType = "query", example = "1,2")
    })
    @GetMapping(value = "/deletes")
    public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) {
        try {
            if (ids == null || ids.isEmpty()) {
                return fail("id数组不能为空", -1);
            }
            int count = {minServiceName}.deletes(ids);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "更新一条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "entity", value = "实体类", dataType = "{entityName}", paramType = "body")
    })
    @ResponseBody
    @PostMapping(value = "/update", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> update(@RequestBody {entityName} entity, HttpServletRequest req) {
        try {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                entity.setUpdateUser(ue.getId());
            }
            int count = {minServiceName}.update(entity);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "更新多条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "list", value = "实体类集合", dataType = "{entityName}", paramType = "body")
    })
    @ResponseBody
    @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> updates(@RequestBody List<{entityName}> list, HttpServletRequest req) {
        try {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                for ({entityName} entity : list) {
                    entity.setUpdateUser(ue.getId());
                }
            }
            int count = {minServiceName}.updates(list);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
}
JavaCode/SysTemplate/Entity.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
package {entityNS};
import java.io.Serializable;
import java.sql.Timestamp;
/**
 * {bak}
 * @author WWW
 */
public class {entityName} implements Serializable {
    private static final long serialVersionUID = -{uid}L;
JavaCode/SysTemplate/Mapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,96 @@
package {mapperNS};
import {entityNS}.{entityName};
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
 * {bak}
 * @author WWW
 */
@Mapper
@Repository
public interface {mapperName} {
    /**
     * æŸ¥è¯¢è®°å½•æ•°
     *
     * @param {colName} {colBak}
     * @return è®°å½•æ•°
     */
    public Integer selectCount({queryCol});
    /**
     * åˆ†é¡µæŸ¥è¯¢
     *
     * @param {colName}   {colBak}
     * @param limit  è®°å½•表
     * @param offset åç§»é‡
     * @return åˆ—表
     */
    public List<{entityName}> selectByPage({queryCol}, Integer limit, Integer offset);
    /**
     * æŸ¥è¯¢æ‰€æœ‰
     *
     * @return
     */
    public List<{entityName}> selectAll();
    /**
     * æ ¹æ®ID查询
     *
     * @param id
     * @return
     */
    public {entityName} selectById(int id);
    /**
     * æ’入一条
     *
     * @param entity
     * @return
     */
    public Integer insert({entityName} entity);
    /**
     * æ’入多条
     *
     * @param list
     * @return
     */
    public Integer inserts(List<{entityName}> list);
    /**
     * åˆ é™¤ä¸€æ¡
     *
     * @param id
     * @return
     */
    public Integer delete(int id);
    /**
     * åˆ é™¤å¤šæ¡
     *
     * @param ids
     * @return
     */
    public Integer deletes(List<Integer> ids);
    /**
     * æ›´æ–°ä¸€æ¡
     *
     * @param entity
     * @return
     */
    public Integer update({entityName} entity);
    /**
     * æ›´æ–°å¤šæ¡
     *
     * @param list
     * @return
     */
    public Integer updates(List<{entityName}> list);
}
JavaCode/SysTemplate/Mapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="{mapperNS}.{mapperName}">
    <select id="selectCount" resultType="java.lang.Integer">
        select count(*) from {tabName}
        <where>
            <if test="{testExpr}">
                {testWhere}
            </if>
        </where>
    </select>
    <select id="selectByPage" resultType="{entityNS}.{entityName}">
        select * from {tabName}
        <where>
            <if test="{testExpr}">
                {testWhere}
            </if>
        </where>
        order by id
        limit #{limit} offset #{offset}
    </select>
    <select id="selectAll" resultType="{entityNS}.{entityName}">
        select * from {tabName} order by id;
    </select>
    <select id="selectById" resultType="{entityNS}.{entityName}">
        select * from {tabName} where id = #{id}
    </select>
    <insert id="insert" parameterType="{entityNS}.{entityName}">
       insert into {tabName}
       ({insertCols})
       values
       ({insertVal})
    </insert>
    <insert id="inserts">
        insert into {tabName}
        ({insertCols})
        values
        <foreach collection="list" item="item" index="index" separator=",">
            ({insertVals})
        </foreach>
    </insert>
    <delete id="delete">
        delete from {tabName} where id = #{id}
    </delete>
    <delete id="deletes">
        delete from {tabName} where id in
        <foreach item="id" collection="ids" index="index" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <update id="update">
        update {tabName}
        set {updateVal}
        where id=#{id}
    </update>
    <update id="updates">
        <foreach collection="list" item="item" index="index" separator=";">
            update {tabName}
            <set>
                {updateVals}
            </set>
            where id = #{item.id}
        </foreach>
    </update>
</mapper>
JavaCode/SysTemplate/Service.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,69 @@
package {serviceNS};
import {entityNS}.{entityName};
import com.lf.server.helper.StringHelper;
import {mapperNS}.{mapperName};
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * {bak}
 * @author WWW
 */
@Service
public class {serviceName} implements {mapperName} {
    @Autowired
    {mapperName} {minMapperName};
    @Override
    public Integer selectCount({queryCol}) {{where}
        return {minMapperName}.selectCount({colName});
    }
    @Override
    public List<{entityName}> selectByPage({queryCol}, Integer limit, Integer offset) {{where}
        return {minMapperName}.selectByPage({colName}, limit, offset);
    }
    @Override
    public List<{entityName}> selectAll() {
        return {minMapperName}.selectAll();
    }
    @Override
    public {entityName} selectById(int id) {
        return {minMapperName}.selectById(id);
    }
    @Override
    public Integer insert({entityName} entity) {
        return {minMapperName}.insert(entity);
    }
    @Override
    public Integer inserts(List<{entityName}> list) {
        return {minMapperName}.inserts(list);
    }
    @Override
    public Integer delete(int id) {
        return {minMapperName}.delete(id);
    }
    @Override
    public Integer deletes(List<Integer> ids) {
        return {minMapperName}.deletes(ids);
    }
    @Override
    public Integer update({entityName} entity) {
        return {minMapperName}.update(entity);
    }
    @Override
    public Integer updates(List<{entityName}> list) {
        return {minMapperName}.updates(list);
    }
}
JavaCode/SysTemplate/pg.sql
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,153 @@
select * from stationseries;
select * from sitepoint order by gid;
update sitepoint set sitename='轮南首站' where gid=55;
------------------------------------------------------------------------------ SQL语句
select * from data_dir;
select * from meta_data;
select table_name as name from data_dictionary group by table_name;
update meta_data set create_time=CURRENT_TIMESTAMP,create_user='admin' where 1=1; -- CURRENT_TIME,CURRENT_DATE
select * from data_files;
select * from style_data;   commit;
delete from style_data where id > 22;
select * from data_dictionary order by id;
select *,queryLevel(path_id) as path from meta_data;
select queryLevel(2005);
select count(*) from meta_data where Upper(name) like '%A%';
select *,queryLevel(path_id) path from meta_data where Upper(name) like '%A%' order by id limit 2 offset 0;
alter table style_data add column path varchar(255); comment on column style_data.path is '存储路径';
alter table style_data add column img varchar(255); comment on column style_data.img is '预览图片';
INSERT INTO public.meta_data(
    name, path_id, create_time, create_user, type, format, up_unit, status, version, x_min, y_min, x_max, y_max, coor_sys, accuracy, operation, remarks, s_url)
    VALUES ('SITEPOINT.shp',2007, CURRENT_TIMESTAMP, 'admin', 'SHP', '.shp','设计院/勘察室','正常', 'v1.0', 0, 0, 0, 0, 'CGCS200', '1:2000', 'upload', '', '');
------------------------------------------------------------------------------ æ•°æ®ç›®å½•
DROP TABLE IF EXISTS public.data_dir;
CREATE TABLE public.data_dir
(
    id integer,
    name character varying(60),
    pid integer NOT NULL,
    oid integer DEFAULT 1,
    PRIMARY KEY (id)
);
COMMENT ON TABLE public.data_dir IS '数据目录';
COMMENT ON COLUMN public.data_dir.id IS 'ID';
COMMENT ON COLUMN public.data_dir.name IS '名称';
COMMENT ON COLUMN public.data_dir.pid IS '父节点';
COMMENT ON COLUMN public.data_dir.oid IS '序号';
SELECT COALESCE(MAX(id),1) FROM public.data_dir;
select * from public.data_dir;
DELETE FROM public.data_dir where id<1000;
SELECT id,name,pid,oid FROM public.data_dir order by id;
------------------------------------------------------------------------------ ä¸Šä¼ æ–‡ä»¶
DROP TABLE IF EXISTS public.data_files;
create table public.data_files
(
    id serial primary key,
    mid integer,
    guid varchar(40),
    name varchar(255),
    ext varchar(10),
    path varchar(1024),
    subs varchar(1024),
    remark varchar(1024)
);
COMMENT ON TABLE public.data_files IS '上传文件';
COMMENT ON COLUMN public.data_files.id IS 'ID';
COMMENT ON COLUMN public.data_files.mid IS '元数据ID';
COMMENT ON COLUMN public.data_files.guid IS 'GUID';
COMMENT ON COLUMN public.data_files.name IS '名称';
COMMENT ON COLUMN public.data_files.ext IS '扩展名';
COMMENT ON COLUMN public.data_files.path IS '路径';
COMMENT ON COLUMN public.data_files.subs IS '子文件';
COMMENT ON COLUMN public.data_files.remark IS '备注';
select * from data_files;
------------------------------------------------------------------------------ æŸ¥è¯¢å±‚级
with recursive rs as(
  select id,name,pid,oid from public.data_dir where id = 2005
  union
  select a.id,a.name,a.pid,a.oid from public.data_dir a, rs b where a.id=b.pid
) select id,name,pid,oid FROM rs order by id,oid;
CREATE OR REPLACE FUNCTION queryLevel(id INTEGER)
RETURNS VARCHAR as $$
  declare
    str varchar='';
    rec varchar; -- public.data_dir%ROWTYPE;
  begin
    for rec in execute 'with recursive rs as(' ||
      'select id,name,pid,oid from public.data_dir where id=' || id ||
      ' union select a.id,a.name,a.pid,a.oid from public.data_dir a, rs b where a.id=b.pid '||
      ') select name FROM rs order by id,oid'
    loop
      str = str || '\' || rec; -- rec.name;
    end loop;
    if (char_length(str) > 1) then
      str = SUBSTRING(str, 2);
    end if;
    return str;
  end;
$$ LANGUAGE PLPGSQL;
-- ä¸­ä¿„东线管道工程南段\勘察数据\基础地质\区域地质
select queryLevel(2005);
select id,name,pid,oid,queryLevel(id) from data_dir where 1=1 order by id limit 10;
------------------------------------------------------------------------------ æŸ¥è¯¢å±‚级ID
--drop function queryDir(id INTEGER);
CREATE OR REPLACE FUNCTION queryDir(id INTEGER)
RETURNS integer[] as $$
  declare
    ids integer[];
    sid integer;
  begin
    for sid in execute 'with recursive rs as(' ||
      'select id,pid from public.data_dir where id=' || id ||
      ' union select a.id,a.pid from public.data_dir a, rs b where a.pid=b.id '||
      ') select id FROM rs order by id'
    loop
      select array_append(ids, sid) into ids;
    end loop;
    return ids;
  end;
$$ LANGUAGE PLPGSQL;
-- {2003,2004,2005,2006,2007,2008,2009}
select queryDir(2003);
select * from data_dir order by id;
select * from meta_data where (path_id = ANY(array[2001,2002,2003,2005]));
select * from meta_data where (path_id = ANY((select queryDir(2005))::integer[])) order by id;
select * from meta_data where path_id=ANY(queryDir(2005)) order by id;
------------------------------------------------------------------------------
JavaCode/cs/ModelHandler.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace JavaCode.cs
{
    public class ModelHandler
    {
        /// <summary>
        /// å¡«å……对象列表
        /// </summary>
        public static List<T> FillModel<T>(DataTable dt) where T : new()
        {
            if (dt == null || dt.Rows.Count == 0)
            {
                return null;
            }
            List<T> list = new List<T>();
            BindingFlags flag = BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.Instance;
            PropertyInfo[] pis = typeof(T).GetProperties();
            foreach (DataRow dr in dt.Rows)
            {
                T t = new T();
                foreach (PropertyInfo pi in pis)
                {
                    object val = dr[pi.Name] == DBNull.Value ? null : dr[pi.Name];
                    t.GetType().GetProperty(pi.Name, flag).SetValue(t, val, null);
                }
                list.Add(t);
            }
            return list;
        }
        /// <summary>
        /// å¡«å……DataTable
        /// </summary>
        public static DataTable FillDataTable<T>(List<T> list) where T : new()
        {
            if (list == null || list.Count == 0)
            {
                return null;
            }
            DataTable dt = CreateDataTable<T>();
            PropertyInfo[] pis = typeof(T).GetProperties();
            foreach (T t in list)
            {
                DataRow dr = dt.NewRow();
                foreach (PropertyInfo pi in pis)
                {
                    dr[pi.Name] = pi.GetValue(t, null);
                }
            }
            return dt;
        }
        /// <summary>
        /// åˆ›å»ºDataTable
        /// </summary>
        public static DataTable CreateDataTable<T>() where T : new()
        {
            DataTable dt = new DataTable(typeof(T).Name);
            PropertyInfo[] pis = typeof(T).GetProperties();
            foreach (PropertyInfo pi in pis)
            {
                dt.Columns.Add(new DataColumn(pi.Name, pi.PropertyType));
            }
            return dt;
        }
    }
}
JavaCode/cs/PostgreHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,174 @@
using Npgsql;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace JavaCode.cs
{
    public enum DbEnum
    {
        langfang = 0,
        postgis = 1,
        postgres = 2
    }
    /// <summary>
    /// Postgre帮助类
    /// </summary>
    public class PostgreHelper
    {
        private const string StrRegex = @"<[^>]+?style=[\w]+?:expression\(|\b(alert|confirm|prompt)\b|^\+/v(8|9)|<[^>]*?=[^>]*?&#[^>]*?>|\b(and|or)\b.{1,6}?(=|>|<|\bin\b|\blike\b)|/\*.+?\*/|<\s*script\b|<\s*img\b|\bEXEC\b|UNION.+?SELECT|UPDATE.+?SET|INSERT\s+INTO.+?VALUES|(SELECT|DELETE).+?FROM|(CREATE|ALTER|DROP|TRUNCATE)\s+(TABLE|DATABASE)";
        private string conStr = null;
        public PostgreHelper(DbEnum db)
        {
            string str = ConfigurationManager.AppSettings["pgConn"];
            this.conStr = string.Format(str, db.ToString());
        }
        /// <summary>
        /// è¿žæŽ¥å­—符串
        /// </summary>
        public String ConStr
        {
            get
            {
                return this.conStr;
            }
        }
        /// <summary>
        /// èŽ·å–DataTable
        /// </summary>
        public DataTable GetDataTable(string sql, params DbParameter[] args)
        {
            using (NpgsqlConnection con = new NpgsqlConnection(ConStr))
            {
                if (con.State != ConnectionState.Open)
                {
                    con.Open();
                }
                using (NpgsqlCommand cmd = new NpgsqlCommand(sql, con))
                {
                    if (args != null)
                    {
                        foreach (DbParameter arg in args)
                        {
                            //arg.ParameterName = arg.ParameterName.Replace("@", ":");
                            cmd.Parameters.Add(arg);
                        }
                    }
                    using (NpgsqlDataAdapter adapter = new NpgsqlDataAdapter(cmd))
                    {
                        DataTable dt = new DataTable();
                        adapter.Fill(dt);
                        return dt;
                    }
                }
            }
        }
        /// <summary>
        /// èŽ·å–è®°å½•æ•°
        /// </summary>
        public int GetCount(string sql, params DbParameter[] args)
        {
            using (NpgsqlConnection con = new NpgsqlConnection(ConStr))
            {
                if (con.State != ConnectionState.Open)
                {
                    con.Open();
                }
                using (NpgsqlCommand cmd = new NpgsqlCommand(sql, con))
                {
                    if (args != null)
                    {
                        foreach (DbParameter arg in args)
                        {
                            //arg.ParameterName = arg.ParameterName.Replace("@", ":");
                            cmd.Parameters.Add(arg);
                        }
                    }
                    object obj = cmd.ExecuteScalar();
                    return obj == null ? 0 : Convert.ToInt32(obj);
                }
            }
        }
        public Object GetScalar(string sql, params DbParameter[] args)
        {
            using (NpgsqlConnection con = new NpgsqlConnection(ConStr))
            {
                if (con.State != ConnectionState.Open)
                {
                    con.Open();
                }
                using (NpgsqlCommand cmd = new NpgsqlCommand(sql, con))
                {
                    if (args != null)
                    {
                        foreach (DbParameter arg in args)
                        {
                            cmd.Parameters.Add(arg);
                        }
                    }
                    return cmd.ExecuteScalar();
                }
            }
        }
        /// <summary>
        /// æ‰§è¡ŒSQL,返回影响行数
        /// </summary>
        public int ExecuteNonQuery(string sql, params DbParameter[] args)
        {
            using (NpgsqlConnection con = new NpgsqlConnection(ConStr))
            {
                if (con.State != ConnectionState.Open)
                {
                    con.Open();
                }
                using (NpgsqlCommand cmd = new NpgsqlCommand(sql, con))
                {
                    if (args != null)
                    {
                        foreach (DbParameter arg in args)
                        {
                            //arg.ParameterName = arg.ParameterName.Replace("@", ":");
                            cmd.Parameters.Add(arg);
                        }
                    }
                    return cmd.ExecuteNonQuery();
                }
            }
        }
        /// <summary>
        /// æ£€æŸ¥å­—符串
        /// </summary>
        public static bool CheckStr(string input)
        {
            return Regex.IsMatch(input, StrRegex, RegexOptions.IgnoreCase);
        }
    }
}
JavaCode/cs/TabInfo.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JavaCode.cs
{
    public class TabInfo
    {
        public string tab { set; get; }
        public string desc { set; get; }
        public int num { set; get; }
        public string col { set; get; }
        public string type { set; get; }
        public string bak { set; get; }
    }
}