Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
finance-manage
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
finance-oa
finance-manage
Commits
b1b82857
Commit
b1b82857
authored
Jan 14, 2022
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化字段更新未同步
parent
869dcf73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
ruoyi-generator/src/main/java/com/ruoyi/generator/service/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;
...
@@ -7,6 +7,7 @@ import java.io.StringWriter;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
import
java.util.zip.ZipOutputStream
;
...
@@ -286,7 +287,7 @@ public class GenTableServiceImpl implements IGenTableService
...
@@ -286,7 +287,7 @@ public class GenTableServiceImpl implements IGenTableService
{
{
GenTable
table
=
genTableMapper
.
selectGenTableByName
(
tableName
);
GenTable
table
=
genTableMapper
.
selectGenTableByName
(
tableName
);
List
<
GenTableColumn
>
tableColumns
=
table
.
getColumns
();
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
);
List
<
GenTableColumn
>
dbTableColumns
=
genTableColumnMapper
.
selectDbTableColumnsByName
(
tableName
);
if
(
StringUtils
.
isEmpty
(
dbTableColumns
))
if
(
StringUtils
.
isEmpty
(
dbTableColumns
))
...
@@ -296,9 +297,20 @@ public class GenTableServiceImpl implements IGenTableService
...
@@ -296,9 +297,20 @@ public class GenTableServiceImpl implements IGenTableService
List
<
String
>
dbTableColumnNames
=
dbTableColumns
.
stream
().
map
(
GenTableColumn:
:
getColumnName
).
collect
(
Collectors
.
toList
());
List
<
String
>
dbTableColumnNames
=
dbTableColumns
.
stream
().
map
(
GenTableColumn:
:
getColumnName
).
collect
(
Collectors
.
toList
());
dbTableColumns
.
forEach
(
column
->
{
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
);
genTableColumnMapper
.
insertGenTableColumn
(
column
);
}
}
});
});
...
@@ -359,7 +371,7 @@ public class GenTableServiceImpl implements IGenTableService
...
@@ -359,7 +371,7 @@ public class GenTableServiceImpl implements IGenTableService
zip
.
putNextEntry
(
new
ZipEntry
(
VelocityUtils
.
getFileName
(
template
,
table
)));
zip
.
putNextEntry
(
new
ZipEntry
(
VelocityUtils
.
getFileName
(
template
,
table
)));
IOUtils
.
write
(
sw
.
toString
(),
zip
,
Constants
.
UTF8
);
IOUtils
.
write
(
sw
.
toString
(),
zip
,
Constants
.
UTF8
);
IOUtils
.
closeQuietly
(
sw
);
IOUtils
.
closeQuietly
(
sw
);
zip
.
flush
();
zip
.
flush
();
zip
.
closeEntry
();
zip
.
closeEntry
();
}
}
catch
(
IOException
e
)
catch
(
IOException
e
)
...
@@ -472,7 +484,7 @@ public class GenTableServiceImpl implements IGenTableService
...
@@ -472,7 +484,7 @@ public class GenTableServiceImpl implements IGenTableService
String
treeName
=
paramsObj
.
getString
(
GenConstants
.
TREE_NAME
);
String
treeName
=
paramsObj
.
getString
(
GenConstants
.
TREE_NAME
);
String
parentMenuId
=
paramsObj
.
getString
(
GenConstants
.
PARENT_MENU_ID
);
String
parentMenuId
=
paramsObj
.
getString
(
GenConstants
.
PARENT_MENU_ID
);
String
parentMenuName
=
paramsObj
.
getString
(
GenConstants
.
PARENT_MENU_NAME
);
String
parentMenuName
=
paramsObj
.
getString
(
GenConstants
.
PARENT_MENU_NAME
);
genTable
.
setTreeCode
(
treeCode
);
genTable
.
setTreeCode
(
treeCode
);
genTable
.
setTreeParentCode
(
treeParentCode
);
genTable
.
setTreeParentCode
(
treeParentCode
);
genTable
.
setTreeName
(
treeName
);
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