Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyang
sts网站
Commits
b1b82857
Commit
b1b82857
authored
Jan 14, 2022
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化字段更新未同步
parent
869dcf73
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
GenTableServiceImpl.java
...java/com/ruoyi/generator/service/GenTableServiceImpl.java
+17
-5
No files found.
ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java
View file @
b1b82857
...
...
@@ -7,6 +7,7 @@ import java.io.StringWriter;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
...
...
@@ -286,7 +287,7 @@ public class GenTableServiceImpl implements IGenTableService
{
GenTable
table
=
genTableMapper
.
selectGenTableByName
(
tableName
);
List
<
GenTableColumn
>
tableColumns
=
table
.
getColumns
();
List
<
String
>
tableColumnNames
=
tableColumns
.
stream
().
map
(
GenTableColumn:
:
getColumnName
).
collect
(
Collectors
.
toList
(
));
Map
<
String
,
GenTableColumn
>
tableColumnMap
=
tableColumns
.
stream
().
collect
(
Collectors
.
toMap
(
GenTableColumn:
:
getColumnName
,
Function
.
identity
()
));
List
<
GenTableColumn
>
dbTableColumns
=
genTableColumnMapper
.
selectDbTableColumnsByName
(
tableName
);
if
(
StringUtils
.
isEmpty
(
dbTableColumns
))
...
...
@@ -296,9 +297,20 @@ public class GenTableServiceImpl implements IGenTableService
List
<
String
>
dbTableColumnNames
=
dbTableColumns
.
stream
().
map
(
GenTableColumn:
:
getColumnName
).
collect
(
Collectors
.
toList
());
dbTableColumns
.
forEach
(
column
->
{
if
(!
tableColumnNames
.
contains
(
column
.
getColumnName
()))
GenUtils
.
initColumnField
(
column
,
table
);
if
(
tableColumnMap
.
containsKey
(
column
.
getColumnName
()))
{
GenTableColumn
prevColumn
=
tableColumnMap
.
get
(
column
.
getColumnName
());
column
.
setColumnId
(
prevColumn
.
getColumnId
());
if
(
column
.
isList
())
{
// 如果是列表,继续保留字典类型
column
.
setDictType
(
prevColumn
.
getDictType
());
}
genTableColumnMapper
.
updateGenTableColumn
(
column
);
}
else
{
GenUtils
.
initColumnField
(
column
,
table
);
genTableColumnMapper
.
insertGenTableColumn
(
column
);
}
});
...
...
@@ -359,7 +371,7 @@ public class GenTableServiceImpl implements IGenTableService
zip
.
putNextEntry
(
new
ZipEntry
(
VelocityUtils
.
getFileName
(
template
,
table
)));
IOUtils
.
write
(
sw
.
toString
(),
zip
,
Constants
.
UTF8
);
IOUtils
.
closeQuietly
(
sw
);
zip
.
flush
();
zip
.
flush
();
zip
.
closeEntry
();
}
catch
(
IOException
e
)
...
...
@@ -472,7 +484,7 @@ public class GenTableServiceImpl implements IGenTableService
String
treeName
=
paramsObj
.
getString
(
GenConstants
.
TREE_NAME
);
String
parentMenuId
=
paramsObj
.
getString
(
GenConstants
.
PARENT_MENU_ID
);
String
parentMenuName
=
paramsObj
.
getString
(
GenConstants
.
PARENT_MENU_NAME
);
genTable
.
setTreeCode
(
treeCode
);
genTable
.
setTreeParentCode
(
treeParentCode
);
genTable
.
setTreeName
(
treeName
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment