Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
9fad4ad8
Commit
9fad4ad8
authored
Jun 10, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
常规BUG的修改
parent
753c8505
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
TableStruct.java
...b/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
+17
-4
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
View file @
9fad4ad8
...
...
@@ -372,12 +372,12 @@ public class TableStruct {
if
(
versionField
!=
null
)
{
sql
.
addCode
(
DaoConst
.
FIELD_CODE
,
","
+
versionField
.
name
+
"=1+"
+
versionField
.
name
);
}
addWhereField
(
sql
,
""
);
addWhereField
(
sql
,
""
,
true
);
return
sql
;
}
else
{
String
text
=
DaoConst
.
REMOVE_MODEL
.
replace
(
DaoConst
.
TABLE_CODE
,
this
.
name
);
SqlData
sql
=
new
SqlData
(
DaoConst
.
REMOVE
,
text
);
addWhereField
(
sql
,
""
);
addWhereField
(
sql
,
""
,
true
);
return
sql
;
}
}
...
...
@@ -391,7 +391,7 @@ public class TableStruct {
// 生成添加的SQL语句
String
text
=
DaoConst
.
LOAD_MODEL
.
replace
(
DaoConst
.
TABLE_CODE
,
this
.
name
);
SqlData
sql
=
new
SqlData
(
DaoConst
.
LOAD
,
text
);
addWhereField
(
sql
,
"a."
);
addWhereField
(
sql
,
"a."
,
false
);
return
sql
;
}
...
...
@@ -400,10 +400,23 @@ public class TableStruct {
*
* @param sql
*/
private
void
addWhereField
(
SqlData
sql
,
String
tag
)
{
private
void
addWhereField
(
SqlData
sql
,
String
tag
,
boolean
isRemove
)
{
TableFieldVo
removeField
=
this
.
getRemove
();
sql
.
add
(
this
.
getKey
().
inputName
,
" AND "
+
tag
+
this
.
getKey
().
name
+
"=?"
);
// 删除时更新字段
List
<
TableFieldVo
>
removeUpdate
=
this
.
getRemoveUpdate
();
Map
<
TableFieldVo
,
Boolean
>
updateField
=
new
HashMap
<>(
removeUpdate
.
size
());
if
(
isRemove
)
{
for
(
TableFieldVo
field
:
removeUpdate
)
{
updateField
.
put
(
field
,
true
);
}
}
for
(
TableFieldVo
field
:
this
.
getFields
())
{
if
(
updateField
.
containsKey
(
field
))
{
continue
;
}
sql
.
add
(
field
.
inputName
,
" AND "
+
tag
+
field
.
name
+
"=?"
);
}
if
(
removeField
!=
null
)
{
...
...
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