添加关联表业务表

This commit is contained in:
dftre 2025-02-19 19:04:36 +08:00
parent d5a9dec0a1
commit 7d2629075d
15 changed files with 689 additions and 552 deletions

View File

@ -1,86 +1,310 @@
<mxfile host="65bd71144e">
<diagram id="xy79Wy17eWdTJqY27ViR" name="第 1 页">
<mxGraphModel dx="892" dy="563" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<mxGraphModel dx="1674" dy="779" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="7" value="" style="edgeStyle=none;html=1;" edge="1" parent="1" source="2" target="6">
<mxCell id="7" value="" style="edgeStyle=none;html=1;" parent="1" source="2" target="6" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="2" value="代码生成" style="html=1;" vertex="1" parent="1">
<mxCell id="2" value="代码生成" style="html=1;" parent="1" vertex="1">
<mxGeometry x="205" y="20" width="110" height="50" as="geometry"/>
</mxCell>
<mxCell id="9" value="" style="edgeStyle=none;html=1;" edge="1" parent="1" source="3" target="8">
<mxCell id="9" value="" style="edgeStyle=none;html=1;" parent="1" source="3" target="8" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="3" value="预览代码" style="html=1;" vertex="1" parent="1">
<mxCell id="3" value="预览代码" style="html=1;" parent="1" vertex="1">
<mxGeometry x="525" y="20" width="110" height="50" as="geometry"/>
</mxCell>
<mxCell id="13" value="" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="6" target="12">
<mxCell id="13" value="" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="6" target="12" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="6" value="GenTableServiceImpl.previewCode" style="html=1;" vertex="1" parent="1">
<mxCell id="6" value="GenTableServiceImpl.previewCode" style="html=1;" parent="1" vertex="1">
<mxGeometry x="150" y="120" width="220" height="50" as="geometry"/>
</mxCell>
<mxCell id="11" value="" style="edgeStyle=none;html=1;" edge="1" parent="1" source="8" target="10">
<mxCell id="11" value="" style="edgeStyle=none;html=1;" parent="1" source="8" target="10" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="8" value="GenTableServiceImpl.downloadCode" style="html=1;" vertex="1" parent="1">
<mxCell id="8" value="GenTableServiceImpl.downloadCode" style="html=1;" parent="1" vertex="1">
<mxGeometry x="460" y="100" width="240" height="50" as="geometry"/>
</mxCell>
<mxCell id="14" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="10" target="12">
<mxCell id="14" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="10" target="12" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="10" value="GenTableServiceImpl.generatorCode" style="html=1;" vertex="1" parent="1">
<mxCell id="10" value="GenTableServiceImpl.generatorCode" style="html=1;" parent="1" vertex="1">
<mxGeometry x="460" y="190" width="240" height="50" as="geometry"/>
</mxCell>
<mxCell id="16" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="12" target="17">
<mxCell id="16" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="12" target="17" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="360" y="580" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="12" value="GenTableMapper.selectGenTableById&amp;nbsp; &amp;nbsp;查询表信息" style="html=1;" vertex="1" parent="1">
<mxCell id="12" value="GenTableMapper.selectGenTableById&amp;nbsp; &amp;nbsp;查询表信息" style="html=1;" parent="1" vertex="1">
<mxGeometry x="230" y="330" width="310" height="50" as="geometry"/>
</mxCell>
<mxCell id="19" value="" style="edgeStyle=none;html=1;" edge="1" parent="1" source="17" target="18">
<mxCell id="19" value="" style="edgeStyle=none;html=1;" parent="1" source="17" target="18" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="17" value="GenTableServiceImpl.setSubTable&amp;nbsp; 设置主子表信息" style="html=1;" vertex="1" parent="1">
<mxCell id="17" value="GenTableServiceImpl.setSubTable&amp;nbsp; 设置主子表信息" style="html=1;" parent="1" vertex="1">
<mxGeometry x="237.5" y="420" width="297.5" height="50" as="geometry"/>
</mxCell>
<mxCell id="21" value="" style="edgeStyle=none;html=1;" edge="1" parent="1" source="18" target="20">
<mxCell id="21" value="" style="edgeStyle=none;html=1;" parent="1" source="18" target="20" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="18" value="GenTableServiceImpl.setPkColumn&amp;nbsp; 设置主键列信息" style="html=1;" vertex="1" parent="1">
<mxCell id="18" value="GenTableServiceImpl.setPkColumn&amp;nbsp; 设置主键列信息" style="html=1;" parent="1" vertex="1">
<mxGeometry x="232.5" y="515" width="307.5" height="50" as="geometry"/>
</mxCell>
<mxCell id="23" value="" style="edgeStyle=none;html=1;" edge="1" parent="1" source="20" target="22">
<mxCell id="23" value="" style="edgeStyle=none;html=1;" parent="1" source="20" target="22" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="20" value="VelocityInitializer.initVelocity&amp;nbsp; &amp;nbsp;初始化vm方法" style="html=1;" vertex="1" parent="1">
<mxCell id="20" value="VelocityInitializer.initVelocity&amp;nbsp; &amp;nbsp;初始化vm方法" style="html=1;" parent="1" vertex="1">
<mxGeometry x="242.5" y="595" width="287.5" height="50" as="geometry"/>
</mxCell>
<mxCell id="25" value="" style="edgeStyle=none;html=1;" edge="1" parent="1" source="22" target="24">
<mxCell id="25" value="" style="edgeStyle=none;html=1;" parent="1" source="22" target="24" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="22" value="VelocityUtils.prepareContext&amp;nbsp; &lt;font color=&quot;#ff0000&quot;&gt;设置模板变量信息&lt;/font&gt;" style="html=1;" vertex="1" parent="1">
<mxCell id="22" value="VelocityUtils.prepareContext&amp;nbsp; &lt;font color=&quot;#ff0000&quot;&gt;设置模板变量信息&lt;/font&gt;" style="html=1;" parent="1" vertex="1">
<mxGeometry x="242.5" y="685" width="287.5" height="50" as="geometry"/>
</mxCell>
<mxCell id="27" value="" style="edgeStyle=none;html=1;" edge="1" parent="1" source="24" target="26">
<mxCell id="27" value="" style="edgeStyle=none;html=1;" parent="1" source="24" target="26" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="24" value="VelocityUtils.getTemplateList&amp;nbsp; &lt;font color=&quot;#ff0000&quot;&gt;获取模板列表&lt;/font&gt;" style="html=1;" vertex="1" parent="1">
<mxCell id="24" value="VelocityUtils.getTemplateList&amp;nbsp; &lt;font color=&quot;#ff0000&quot;&gt;获取模板列表&lt;/font&gt;" style="html=1;" parent="1" vertex="1">
<mxGeometry x="242.5" y="770" width="287.5" height="50" as="geometry"/>
</mxCell>
<mxCell id="30" value="" style="edgeStyle=none;html=1;" edge="1" parent="1" source="26" target="29">
<mxCell id="30" value="" style="edgeStyle=none;html=1;" parent="1" source="26" target="29" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="26" value="Velocity.getTemplate 渲染模板" style="html=1;" vertex="1" parent="1">
<mxCell id="26" value="Velocity.getTemplate 渲染模板" style="html=1;" parent="1" vertex="1">
<mxGeometry x="242.5" y="860" width="287.5" height="50" as="geometry"/>
</mxCell>
<mxCell id="29" value="预览代码 -&amp;gt; 结果储存到dataMap中&lt;br&gt;自定义路径 -&amp;gt; 通过FileUtils写入到指定位置&lt;br&gt;下载代码 -&amp;gt; 将生抽的信息添加到zip然后下载" style="html=1;" vertex="1" parent="1">
<mxCell id="29" value="预览代码 -&amp;gt; 结果储存到dataMap中&lt;br&gt;自定义路径 -&amp;gt; 通过FileUtils写入到指定位置&lt;br&gt;下载代码 -&amp;gt; 将生抽的信息添加到zip然后下载" style="html=1;" parent="1" vertex="1">
<mxGeometry x="242.5" y="950" width="287.5" height="50" as="geometry"/>
</mxCell>
<mxCell id="31" value="&lt;div style=&quot;color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space-collapse: preserve;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;GenTable&lt;/span&gt;&lt;/div&gt;" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;html=1;" vertex="1" parent="1">
<mxGeometry x="910" y="20" width="180" height="540" as="geometry"/>
</mxCell>
<mxCell id="32" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" vertex="1" parent="31">
<mxGeometry y="30" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="33" value="PK" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="32">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="34" value="&lt;div style=&quot;color: #000000;background-color: #ffffff;font-family: Consolas, &#39;Courier New&#39;, monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;&quot;&gt;&lt;span style=&quot;color: #880088;font-weight: bold;&quot;&gt;tableId&lt;/span&gt;&lt;/div&gt;" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;fontStyle=5;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="32">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="35" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="31">
<mxGeometry y="60" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="36" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="35">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="37" value="&lt;div style=&quot;color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;span style=&quot;color: #880088;font-weight: bold;&quot;&gt;tableName&lt;/span&gt;&lt;/div&gt;" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="35">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="38" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="31">
<mxGeometry y="90" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="39" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="38">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="40" value="&lt;div style=&quot;color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;span style=&quot;color: #880088;font-weight: bold;&quot;&gt;tableAlias&lt;/span&gt;&lt;/div&gt;" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="38">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="41" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="31">
<mxGeometry y="120" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="42" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="41">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="43" value="&lt;div style=&quot;color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;span style=&quot;color: #880088;font-weight: bold;&quot;&gt;tableComment&lt;/span&gt;&lt;/div&gt;" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="41">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="44" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="31">
<mxGeometry y="150" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="45" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;" vertex="1" parent="44">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="46" value="subTableName" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;" vertex="1" parent="44">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="47" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="31">
<mxGeometry y="180" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="48" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;" vertex="1" parent="47">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="49" value="subTableFkName" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;" vertex="1" parent="47">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="50" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="31">
<mxGeometry y="210" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="51" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;" vertex="1" parent="50">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="52" value="className" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;" vertex="1" parent="50">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="57" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="31">
<mxGeometry y="240" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="58" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;" vertex="1" parent="57">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="59" value="tplCategory" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;" vertex="1" parent="57">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="60" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="31">
<mxGeometry y="270" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="61" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;" vertex="1" parent="60">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="62" value="tplWebType" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;" vertex="1" parent="60">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="63" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="31">
<mxGeometry y="300" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="64" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;" vertex="1" parent="63">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="65" value="moduleName" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;" vertex="1" parent="63">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="66" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="31">
<mxGeometry y="330" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="67" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;" vertex="1" parent="66">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="68" value="businessName" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;" vertex="1" parent="66">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="69" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="31">
<mxGeometry y="360" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="70" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;" vertex="1" parent="69">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="71" value="functionName" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;" vertex="1" parent="69">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="72" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="31">
<mxGeometry y="390" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="73" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;" vertex="1" parent="72">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="74" value="functionAuthor" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;" vertex="1" parent="72">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="75" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="31">
<mxGeometry y="420" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="76" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;" vertex="1" parent="75">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="77" value="genType" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;" vertex="1" parent="75">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="78" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="31">
<mxGeometry y="450" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="79" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;" vertex="1" parent="78">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="80" value="genPath" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;" vertex="1" parent="78">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="84" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="31">
<mxGeometry y="480" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="85" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;" vertex="1" parent="84">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="86" value="pkColumn" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;" vertex="1" parent="84">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="87" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="31">
<mxGeometry y="510" width="180" height="30" as="geometry"/>
</mxCell>
<mxCell id="88" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;" vertex="1" parent="87">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="89" value="subTable" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;" vertex="1" parent="87">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>

View File

@ -19,7 +19,6 @@
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<spring-boot.version>3.4.2</spring-boot.version>
<druid.version>1.2.24</druid.version>
<dynamic.version>4.3.1</dynamic.version>
<jta.version>1.1</jta.version>
<bitwalker.version>1.21</bitwalker.version>
<swagger.version>3.0.0</swagger.version>
@ -108,13 +107,6 @@
<version>${druid.version}</version>
</dependency>
<!-- 动态数据源 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>${dynamic.version}</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>

View File

@ -52,12 +52,6 @@
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<!-- 动态数据源 -->
<!-- <dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
</dependency> -->
<!-- 阿里JSON解析器 -->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>

View File

@ -2,7 +2,6 @@ package com.ruoyi.generator.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -32,8 +31,11 @@ import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.sql.SqlUtil;
import com.ruoyi.generator.domain.GenJoinTable;
import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.domain.GenTableColumn;
import com.ruoyi.generator.domain.vo.GenTableVo;
import com.ruoyi.generator.service.IGenJoinTableService;
import com.ruoyi.generator.service.IGenTableColumnService;
import com.ruoyi.generator.service.IGenTableService;
@ -53,6 +55,9 @@ public class GenController extends BaseController {
@Autowired
private IGenTableColumnService genTableColumnService;
@Autowired
private IGenJoinTableService genJoinTableService;
/**
* 查询代码生成列表
*/
@ -71,13 +76,27 @@ public class GenController extends BaseController {
@GetMapping(value = "/{tableId}")
public AjaxResult getInfo(@PathVariable(name = "tableId") Long tableId) {
GenTable table = genTableService.selectGenTableById(tableId);
List<GenTable> tables = genTableService.selectGenTableAll();
List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
Map<String, Object> map = new HashMap<String, Object>();
map.put("info", table);
map.put("rows", list);
map.put("tables", tables);
return success(map);
GenTableVo genTableVo = new GenTableVo();
genTableVo.setTable(table);
genTableVo.setColumns(table.getColumns());
GenJoinTable genJoinTable = new GenJoinTable();
genJoinTable.setTableId(tableId);
List<GenJoinTable> selectGenJoinTableList = genJoinTableService.selectGenJoinTableList(genJoinTable);
genTableVo.setJoins(selectGenJoinTableList);
List<GenTable> joinTables = new ArrayList<>();
selectGenJoinTableList.forEach(i -> {
GenTable joinTable = genTableService.selectGenTableById(i.getJoinTableId());
joinTables.add(joinTable);
});
genTableVo.setJoinTables(joinTables);
// List<GenTable> tables = genTableService.selectGenTableAll();
// List<GenTableColumn> list =
// genTableColumnService.selectGenTableColumnListByTableId(tableId);
// Map<String, Object> map = new HashMap<String, Object>();
// map.put("info", table);
// map.put("rows", list);
// map.put("tables", tables);
return success(genTableVo);
}
/**
@ -118,54 +137,51 @@ public class GenController extends BaseController {
return success();
}
/**
/**
* 创建表结构保存
*/
@PreAuthorize("@ss.hasRole('admin')")
@Log(title = "创建表", businessType = BusinessType.OTHER)
@PostMapping("/createTable")
public AjaxResult createTableSave(String sql)
{
try
{
public AjaxResult createTableSave(String sql) {
try {
SqlUtil.filterKeyword(sql);
List<SQLStatement> sqlStatements = SQLUtils.parseStatements(sql, DbType.mysql);
List<String> tableNames = new ArrayList<>();
for (SQLStatement sqlStatement : sqlStatements)
{
if (sqlStatement instanceof MySqlCreateTableStatement)
{
for (SQLStatement sqlStatement : sqlStatements) {
if (sqlStatement instanceof MySqlCreateTableStatement) {
MySqlCreateTableStatement createTableStatement = (MySqlCreateTableStatement) sqlStatement;
if (genTableService.createTable(createTableStatement.toString()))
{
if (genTableService.createTable(createTableStatement.toString())) {
String tableName = createTableStatement.getTableName().replaceAll("`", "");
tableNames.add(tableName);
}
}
}
List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames.toArray(new String[tableNames.size()]));
List<GenTable> tableList = genTableService
.selectDbTableListByNames(tableNames.toArray(new String[tableNames.size()]));
String operName = SecurityUtils.getUsername();
genTableService.importGenTable(tableList, operName);
return AjaxResult.success();
}
catch (Exception e)
{
} catch (Exception e) {
logger.error(e.getMessage(), e);
return AjaxResult.error("创建表结构异常");
}
}
/**
* 修改保存代码生成业务
*/
@PreAuthorize("@ss.hasPermi('tool:gen:edit')")
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult editSave(@Validated @RequestBody GenTable genTable) {
public AjaxResult editSave(@Validated @RequestBody GenTableVo genTableVo) {
GenTable genTable = genTableVo.getTable();
genTableService.validateEdit(genTable);
genTableService.updateGenTable(genTable);
genJoinTableService.deleteGenJoinTableByTableId(genTable.getTableId());
genTableVo.getJoins().forEach(i -> {
genJoinTableService.insertGenJoinTable(i);
});
return success();
}

View File

@ -0,0 +1,32 @@
package com.ruoyi.generator.domain;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
public class GenJoinTable extends BaseEntity {
/** 表编号 */
private Long tableId;
private Long mainTableId;
/** 关联表编号 */
private Long joinTableId;
/** 主表别名 */
private String mainTableAlias;
/** 关联表别名 */
private String joinTableAlias;
/** 主表外键 */
private String mainTableFk;
/** 关联表外键 */
private String joinTableFk;
}

View File

@ -0,0 +1,24 @@
package com.ruoyi.generator.domain;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
public class GenJoinTableColumn extends BaseEntity {
/** 归属表编号 */
private Long tableId;
/** 关联表编号 */
private Long joinTableId;
/** 编号 */
private Long columnId;
/** 关联表别名 */
private String joinTableAlias;
}

View File

@ -10,12 +10,16 @@ import com.ruoyi.generator.constant.GenConstants;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 业务表 gen_table
*
* @author ruoyi
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class GenTable extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -26,6 +30,9 @@ public class GenTable extends BaseEntity {
@NotBlank(message = "表名称不能为空")
private String tableName;
/** 表别名 */
private String tableAlias;
/** 表描述 */
@NotBlank(message = "表描述不能为空")
private String tableComment;
@ -100,210 +107,9 @@ public class GenTable extends BaseEntity {
/** 上级菜单名称字段 */
private String parentMenuName;
/** 是否含有关联字段 */
private String haveSubColumn;
public String getHaveSubColumn() {
return haveSubColumn;
}
public void setHaveSubColumn(String haveSubColumn) {
this.haveSubColumn = haveSubColumn;
}
public Long getTableId() {
return tableId;
}
public void setTableId(Long tableId) {
this.tableId = tableId;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getTableComment() {
return tableComment;
}
public void setTableComment(String tableComment) {
this.tableComment = tableComment;
}
public String getSubTableName() {
return subTableName;
}
public void setSubTableName(String subTableName) {
this.subTableName = subTableName;
}
public String getSubTableFkName() {
return subTableFkName;
}
public void setSubTableFkName(String subTableFkName) {
this.subTableFkName = subTableFkName;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public String getTplCategory() {
return tplCategory;
}
public void setTplCategory(String tplCategory) {
this.tplCategory = tplCategory;
}
public String getTplWebType() {
return tplWebType;
}
public void setTplWebType(String tplWebType) {
this.tplWebType = tplWebType;
}
public String getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String getModuleName() {
return moduleName;
}
public void setModuleName(String moduleName) {
this.moduleName = moduleName;
}
public String getBusinessName() {
return businessName;
}
public void setBusinessName(String businessName) {
this.businessName = businessName;
}
public String getFunctionName() {
return functionName;
}
public void setFunctionName(String functionName) {
this.functionName = functionName;
}
public String getFunctionAuthor() {
return functionAuthor;
}
public void setFunctionAuthor(String functionAuthor) {
this.functionAuthor = functionAuthor;
}
public String getGenType() {
return genType;
}
public void setGenType(String genType) {
this.genType = genType;
}
public String getGenPath() {
return genPath;
}
public void setGenPath(String genPath) {
this.genPath = genPath;
}
public GenTableColumn getPkColumn() {
return pkColumn;
}
public void setPkColumn(GenTableColumn pkColumn) {
this.pkColumn = pkColumn;
}
public GenTable getSubTable() {
return subTable;
}
public void setSubTable(GenTable subTable) {
this.subTable = subTable;
}
public List<GenTableColumn> getColumns() {
return columns;
}
public void setColumns(List<GenTableColumn> columns) {
this.columns = columns;
}
public String getOptions() {
return options;
}
public void setOptions(String options) {
this.options = options;
}
public String getTreeCode() {
return treeCode;
}
public void setTreeCode(String treeCode) {
this.treeCode = treeCode;
}
public String getTreeParentCode() {
return treeParentCode;
}
public void setTreeParentCode(String treeParentCode) {
this.treeParentCode = treeParentCode;
}
public String getTreeName() {
return treeName;
}
public void setTreeName(String treeName) {
this.treeName = treeName;
}
public String getParentMenuId() {
return parentMenuId;
}
public void setParentMenuId(String parentMenuId) {
this.parentMenuId = parentMenuId;
}
public String getParentMenuName() {
return parentMenuName;
}
public void setParentMenuName(String parentMenuName) {
this.parentMenuName = parentMenuName;
}
public boolean isSub() {
return isSub(this.tplCategory);
}

View File

@ -4,14 +4,17 @@ import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.utils.StringUtils;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 代码生成业务字段表 gen_table_column
*
* @author ruoyi
*/
public class GenTableColumn extends BaseEntity
{
@Data
@EqualsAndHashCode(callSuper = true)
public class GenTableColumn extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 编号 */
@ -60,7 +63,9 @@ public class GenTableColumn extends BaseEntity
/** 查询方式EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围 */
private String queryType;
/** 显示类型input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、image图片上传控件、upload文件上传控件、editor富文本控件 */
/**
* 显示类型input文本框textarea文本域select下拉框checkbox复选框radio单选框datetime日期控件image图片上传控件upload文件上传控件editor富文本控件
*/
private String htmlType;
/** 字典类型 */
@ -85,312 +90,67 @@ public class GenTableColumn extends BaseEntity
/** 映射字段Java类型 */
private String subColumnJavaType;
public String getSubColumnJavaField() {
return subColumnJavaField;
}
public void setSubColumnJavaField(String subColumnJavaField) {
this.subColumnJavaField = subColumnJavaField;
}
public String getSubColumnJavaType() {
return subColumnJavaType;
}
public void setSubColumnJavaType(String subColumnJavaType) {
this.subColumnJavaType = subColumnJavaType;
}
public String getSubColumnTableName() {
return subColumnTableName;
}
public void setSubColumnTableName(String subColumnTableName) {
this.subColumnTableName = subColumnTableName;
}
public String getSubColumnFkName() {
return subColumnFkName;
}
public String getSubColumnFkJavaField(){
return StringUtils.toCamelCase(this.subColumnFkName);
}
public void setSubColumnFkName(String subColumnFkName) {
this.subColumnFkName = subColumnFkName;
}
public String getSubColumnName() {
return subColumnName;
}
public void setSubColumnName(String subColumnName) {
this.subColumnName = subColumnName;
}
public void setColumnId(Long columnId)
{
this.columnId = columnId;
}
public Long getColumnId()
{
return columnId;
}
public void setTableId(Long tableId)
{
this.tableId = tableId;
}
public Long getTableId()
{
return tableId;
}
public void setColumnName(String columnName)
{
this.columnName = columnName;
}
public String getColumnName()
{
return columnName;
}
public void setColumnComment(String columnComment)
{
this.columnComment = columnComment;
}
public String getColumnComment()
{
return columnComment;
}
public void setColumnType(String columnType)
{
this.columnType = columnType;
}
public String getColumnType()
{
return columnType;
}
public void setJavaType(String javaType)
{
this.javaType = javaType;
}
public String getJavaType()
{
return javaType;
}
public void setJavaField(String javaField)
{
this.javaField = javaField;
}
public String getJavaField()
{
return javaField;
}
public String getCapJavaField()
{
return StringUtils.capitalize(javaField);
}
public void setIsPk(String isPk)
{
this.isPk = isPk;
}
public String getIsPk()
{
return isPk;
}
public boolean isPk()
{
public boolean isPk() {
return isPk(this.isPk);
}
public boolean isPk(String isPk)
{
public boolean isPk(String isPk) {
return isPk != null && StringUtils.equals("1", isPk);
}
public String getIsIncrement()
{
return isIncrement;
}
public void setIsIncrement(String isIncrement)
{
this.isIncrement = isIncrement;
}
public boolean isIncrement()
{
public boolean isIncrement() {
return isIncrement(this.isIncrement);
}
public boolean isIncrement(String isIncrement)
{
public boolean isIncrement(String isIncrement) {
return isIncrement != null && StringUtils.equals("1", isIncrement);
}
public void setIsRequired(String isRequired)
{
this.isRequired = isRequired;
}
public String getIsRequired()
{
return isRequired;
}
public boolean isRequired()
{
public boolean isRequired() {
return isRequired(this.isRequired);
}
public boolean isRequired(String isRequired)
{
public boolean isRequired(String isRequired) {
return isRequired != null && StringUtils.equals("1", isRequired);
}
public void setIsInsert(String isInsert)
{
this.isInsert = isInsert;
}
public String getIsInsert()
{
return isInsert;
}
public boolean isInsert()
{
public boolean isInsert() {
return isInsert(this.isInsert);
}
public boolean isInsert(String isInsert)
{
public boolean isInsert(String isInsert) {
return isInsert != null && StringUtils.equals("1", isInsert);
}
public void setIsEdit(String isEdit)
{
this.isEdit = isEdit;
}
public String getIsEdit()
{
return isEdit;
}
public boolean isEdit()
{
public boolean isEdit() {
return isInsert(this.isEdit);
}
public boolean isEdit(String isEdit)
{
public boolean isEdit(String isEdit) {
return isEdit != null && StringUtils.equals("1", isEdit);
}
public void setIsList(String isList)
{
this.isList = isList;
}
public String getIsList()
{
return isList;
}
public boolean isList()
{
public boolean isList() {
return isList(this.isList);
}
public boolean isList(String isList)
{
public boolean isList(String isList) {
return isList != null && StringUtils.equals("1", isList);
}
public void setIsQuery(String isQuery)
{
this.isQuery = isQuery;
}
public String getIsQuery()
{
return isQuery;
}
public boolean isQuery()
{
public boolean isQuery() {
return isQuery(this.isQuery);
}
public boolean isQuery(String isQuery)
{
public boolean isQuery(String isQuery) {
return isQuery != null && StringUtils.equals("1", isQuery);
}
public void setQueryType(String queryType)
{
this.queryType = queryType;
}
public String getQueryType()
{
return queryType;
}
public String getHtmlType()
{
return htmlType;
}
public void setHtmlType(String htmlType)
{
this.htmlType = htmlType;
}
public void setDictType(String dictType)
{
this.dictType = dictType;
}
public String getDictType()
{
return dictType;
}
public void setSort(Integer sort)
{
this.sort = sort;
}
public Integer getSort()
{
return sort;
}
public boolean isSuperColumn()
{
public boolean isSuperColumn() {
return isSuperColumn(this.javaField);
}
public static boolean isSuperColumn(String javaField)
{
public static boolean isSuperColumn(String javaField) {
return StringUtils.equalsAnyIgnoreCase(javaField,
// BaseEntity
"createBy", "createTime", "updateBy", "updateTime", "remark",
@ -398,36 +158,28 @@ public class GenTableColumn extends BaseEntity
"parentName", "parentId", "orderNum", "ancestors");
}
public boolean isUsableColumn()
{
public boolean isUsableColumn() {
return isUsableColumn(javaField);
}
public static boolean isUsableColumn(String javaField)
{
public static boolean isUsableColumn(String javaField) {
// isSuperColumn()中的名单用于避免生成多余Domain属性若某些属性在生成页面时需要用到不能忽略则放在此处白名单
return StringUtils.equalsAnyIgnoreCase(javaField, "parentId", "orderNum", "remark");
}
public String readConverterExp()
{
public String readConverterExp() {
String remarks = StringUtils.substringBetween(this.columnComment, "", "");
StringBuffer sb = new StringBuffer();
if (StringUtils.isNotEmpty(remarks))
{
for (String value : remarks.split(" "))
{
if (StringUtils.isNotEmpty(value))
{
if (StringUtils.isNotEmpty(remarks)) {
for (String value : remarks.split(" ")) {
if (StringUtils.isNotEmpty(value)) {
Object startStr = value.subSequence(0, 1);
String endStr = value.substring(1);
sb.append("").append(startStr).append("=").append(endStr).append(",");
}
}
return sb.deleteCharAt(sb.length() - 1).toString();
}
else
{
} else {
return this.columnComment;
}
}

View File

@ -0,0 +1,38 @@
package com.ruoyi.generator.domain.vo;
import java.util.List;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.generator.domain.GenJoinTable;
import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.domain.GenTableColumn;
import jakarta.validation.Valid;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Setter;
/**
* 业务表 gen_table
*
* @author ruoyi
*/
@Data
@Setter
@EqualsAndHashCode(callSuper = true)
public class GenTableVo extends BaseEntity {
private static final long serialVersionUID = 1L;
private GenTable table;
private List<GenTableColumn> columns;
private List<GenJoinTable> joins;
@Valid
private List<GenTable> joinTables;
@Valid
private List<GenTableColumn> joinColumns;
}

View File

@ -0,0 +1,40 @@
package com.ruoyi.generator.mapper;
import java.util.List;
import com.ruoyi.generator.domain.GenJoinTable;
/**
* 代码生成关联字段Mapper接口
*
* @author ruoyi
* @date 2025-02-19
*/
public interface GenJoinTableMapper {
/**
* 查询代码生成关联字段列表
*
* @param genJoinTable 代码生成关联字段
* @return 代码生成关联字段集合
*/
public List<GenJoinTable> selectGenJoinTableList(GenJoinTable genJoinTable);
/**
* 新增代码生成关联字段
*
* @param genJoinTable 代码生成关联字段
* @return 结果
*/
public int insertGenJoinTable(GenJoinTable genJoinTable);
/**
* 修改代码生成关联字段
*
* @param genJoinTable 代码生成关联字段
* @return 结果
*/
public int updateGenJoinTable(GenJoinTable genJoinTable);
public int deleteGenJoinTableByTableId(Long tableId);
}

View File

@ -0,0 +1,65 @@
package com.ruoyi.generator.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.generator.domain.GenJoinTable;
import com.ruoyi.generator.mapper.GenJoinTableMapper;
/**
* 代码生成关联字段Service业务层处理
*
* @author ruoyi
* @date 2025-02-19
*/
@Service
public class GenJoinTableServiceImpl implements IGenJoinTableService {
@Autowired
private GenJoinTableMapper genJoinTableMapper;
/**
* 查询代码生成关联字段列表
*
* @param genJoinTable 代码生成关联字段
* @return 代码生成关联字段
*/
@Override
public List<GenJoinTable> selectGenJoinTableList(GenJoinTable genJoinTable) {
return genJoinTableMapper.selectGenJoinTableList(genJoinTable);
}
/**
* 新增代码生成关联字段
*
* @param genJoinTable 代码生成关联字段
* @return 结果
*/
@Override
public int insertGenJoinTable(GenJoinTable genJoinTable) {
genJoinTable.setCreateTime(DateUtils.getNowDate());
return genJoinTableMapper.insertGenJoinTable(genJoinTable);
}
/**
* 修改代码生成关联字段
*
* @param genJoinTable 代码生成关联字段
* @return 结果
*/
@Override
public int updateGenJoinTable(GenJoinTable genJoinTable) {
genJoinTable.setUpdateTime(DateUtils.getNowDate());
return genJoinTableMapper.updateGenJoinTable(genJoinTable);
}
/**
* 根据tableId删除字段关联
*/
public int deleteGenJoinTableByTableId(Long tableId){
return genJoinTableMapper.deleteGenJoinTableByTableId(tableId);
}
}

View File

@ -0,0 +1,42 @@
package com.ruoyi.generator.service;
import java.util.List;
import com.ruoyi.generator.domain.GenJoinTable;
/**
* 代码生成关联字段Service接口
*
* @author ruoyi
* @date 2025-02-19
*/
public interface IGenJoinTableService {
/**
* 查询代码生成关联字段列表
*
* @param genJoinTable 代码生成关联字段
* @return 代码生成关联字段集合
*/
public List<GenJoinTable> selectGenJoinTableList(GenJoinTable genJoinTable);
/**
* 新增代码生成关联字段
*
* @param genJoinTable 代码生成关联字段
* @return 结果
*/
public int insertGenJoinTable(GenJoinTable genJoinTable);
/**
* 修改代码生成关联字段
*
* @param genJoinTable 代码生成关联字段
* @return 结果
*/
public int updateGenJoinTable(GenJoinTable genJoinTable);
/**
* 根据tableId删除字段关联
*/
public int deleteGenJoinTableByTableId(Long tableId);
}

View File

@ -0,0 +1,90 @@
<?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="com.ruoyi.generator.mapper.GenJoinTableMapper">
<resultMap type="GenJoinTable" id="GenJoinTableResult">
<result property="tableId" column="table_id" />
<result property="mainTableId" column="main_table_id" />
<result property="joinTableId" column="join_table_id" />
<result property="mainTableAlias" column="main_table_alias" />
<result property="joinTableAlias" column="join_table_alias" />
<result property="mainTableFk" column="main_table_fk" />
<result property="joinTableFk" column="join_table_fk" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectGenJoinTableVo">
select table_id, main_table_id, join_table_id, main_table_alias, join_table_alias, main_table_fk,join_table_fk,create_by, create_time, update_by, update_time from gen_join_table
</sql>
<select id="selectGenJoinTableList" parameterType="GenJoinTable" resultMap="GenJoinTableResult">
<include refid="selectGenJoinTableVo"/>
<where>
<if test="tableId != null"> and table_id = #{tableId}</if>
<if test="mainTableId != null"> and main_table_id = #{mainTableId}</if>
<if test="joinTableId != null"> and join_table_id = #{joinTableId}</if>
<if test="mainTableFk != null"> and main_table_fk = #{mainTableFk}</if>
<if test="joinTableFk != null"> and join_table_fk = #{joinTableFk}</if>
<if test="mainTableAlias != null and mainTableAlias != ''"> and main_table_alias = #{mainTableAlias}</if>
<if test="joinTableAlias != null and joinTableAlias != ''"> and join_table_alias = #{joinTableAlias}</if>
</where>
</select>
<insert id="insertGenJoinTable" parameterType="GenJoinTable">
insert into gen_join_table
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tableId != null">table_id,</if>
<if test="mainTableId != null">main_table_id,</if>
<if test="joinTableId != null">join_table_id,</if>
<if test="mainTableAlias != null and mainTableAlias != ''">main_table_alias,</if>
<if test="joinTableAlias != null and joinTableAlias != ''">join_table_alias,</if>
<if test="mainTableFk != null"> main_table_fk,</if>
<if test="joinTableFk != null"> join_table_fk,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tableId != null">#{tableId},</if>
<if test="mainTableId != null">#{mainTableId},</if>
<if test="joinTableId != null">#{joinTableId},</if>
<if test="mainTableAlias != null and mainTableAlias != ''">#{mainTableAlias},</if>
<if test="joinTableAlias != null and joinTableAlias != ''">#{joinTableAlias},</if>
<if test="mainTableFk != null">#{mainTableFk},</if>
<if test="joinTableFk != null">#{joinTableFk},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateGenJoinTable" parameterType="GenJoinTable">
update gen_join_table
<trim prefix="SET" suffixOverrides=",">
<if test="mainTableId != null">main_table_id = #{mainTableId},</if>
<if test="joinTableId != null">join_table_id = #{joinTableId},</if>
<if test="mainTableAlias != null and mainTableAlias != ''">main_table_alias = #{mainTableAlias},</if>
<if test="joinTableAlias != null and joinTableAlias != ''">join_table_alias = #{joinTableAlias},</if>
<if test="mainTableFk != null"> main_table_fk = #{mainTableFk},</if>
<if test="joinTableFk != null"> join_table_fk = #{joinTableFk},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where gen_join_table.table_id = #{tableId} and gen_join_table.join_table_id = #{joinTableId}
</update>
<!-- deleteGenJoinTableByTableId -->
<delete id="deleteGenJoinTableByTableId">
delete from gen_join_table where table_id = #{tableId}
</delete>
</mapper>

View File

@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="GenTable" id="GenTableResult">
<id property="tableId" column="table_id" />
<result property="tableName" column="table_name" />
<result property="tableAlias" column="table_alias" />
<result property="tableComment" column="table_comment" />
<result property="subTableName" column="sub_table_name" />
<result property="subTableFkName" column="sub_table_fk_name" />
@ -61,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectGenTableVo">
select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, tpl_web_type, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, have_sub_column,create_by, create_time, update_by, update_time, remark from gen_table
select table_id, table_name,table_alias, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, tpl_web_type, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, have_sub_column,create_by, create_time, update_by, update_time, remark from gen_table
</sql>
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
@ -85,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">
select table_name, table_comment, create_time, update_time from information_schema.tables
where table_schema = (select database())
AND table_name NOT LIKE 'qrtz\_%' AND table_name NOT LIKE 'gen\_%'
AND table_name NOT LIKE 'qrtz\_%'
AND table_name NOT IN (select table_name from gen_table)
<if test="tableName != null and tableName != ''">
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
@ -104,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDbTableListByNames" resultMap="GenTableResult">
select table_name, table_comment, create_time, update_time from information_schema.tables
where table_name NOT LIKE 'qrtz\_%' AND table_name NOT LIKE 'gen\_%' and table_schema = (select database())
where table_name NOT LIKE 'qrtz\_%' and table_schema = (select database())
and table_name in
<foreach collection="array" item="name" open="(" separator="," close=")">
#{name}
@ -118,7 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,t.have_sub_column,
SELECT t.table_id, t.table_name, t.table_alias, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,t.have_sub_column,
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort,c.sub_column_table_name,c.sub_column_fk_name,c.sub_column_name,c.sub_column_java_type,c.sub_column_java_field
FROM gen_table t
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
@ -126,7 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,t.have_sub_column,
SELECT t.table_id, t.table_name,t.table_alias, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,t.have_sub_column,
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort,c.sub_column_table_name,c.sub_column_fk_name,c.sub_column_name,c.sub_column_java_type,c.sub_column_java_field
FROM gen_table t
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
@ -134,7 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
SELECT t.table_id, t.table_name,t.table_alias, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort,c.sub_column_table_name,c.sub_column_fk_name,c.sub_column_name,c.sub_column_java_type,c.sub_column_java_field
FROM gen_table t
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
@ -144,6 +145,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId">
insert into gen_table (
<if test="tableName != null">table_name,</if>
<if test="tableAlias != null">table_alias,</if>
<if test="tableComment != null and tableComment != ''">table_comment,</if>
<if test="className != null and className != ''">class_name,</if>
<if test="tplCategory != null and tplCategory != ''">tpl_category,</if>
@ -161,6 +163,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
create_time
)values(
<if test="tableName != null">#{tableName},</if>
<if test="tableAlias != null">#{tableAlias},</if>
<if test="tableComment != null and tableComment != ''">#{tableComment},</if>
<if test="className != null and className != ''">#{className},</if>
<if test="tplCategory != null and tplCategory != ''">#{tplCategory},</if>
@ -187,6 +190,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update gen_table
<set>
<if test="tableName != null">table_name = #{tableName},</if>
<if test="tableAlias != null">table_alias = #{tableAlias},</if>
<if test="tableComment != null and tableComment != ''">table_comment = #{tableComment},</if>
<if test="subTableName != null">sub_table_name = #{subTableName},</if>
<if test="subTableFkName != null">sub_table_fk_name = #{subTableFkName},</if>

View File

@ -66,6 +66,24 @@ CREATE TABLE `gen_table_column` (
) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT = '代码生成业务表字段';
DROP TABLE IF EXISTS `gen_join_table`;
CREATE TABLE `gen_join_table` (
`table_id` bigint NOT NULL COMMENT '表编号',
`main_table_id` bigint NOT NULL COMMENT '主表名称',
`join_table_id` bigint NOT NULL COMMENT '关联表编号',
`main_table_alias` varchar(200) NOT NULL COMMENT '主表别名',
`join_table_alias` varchar(200) NOT NULL COMMENT '关联表别名',
`main_table_fk` varchar(200) NOT NULL COMMENT '主表别名',
`join_table_fk` varchar(200) NOT NULL COMMENT '关联表别名',
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`table_id`,`join_table_id`,`main_table_id`)
) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT = '代码生成关联表字段';
insert into sys_menu values('116', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', sysdate(), '', null, '代码生成菜单');
-- 代码生成按钮
insert into sys_menu values('1055', '生成查询', '116', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', sysdate(), '', null, '');