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
596ac9a0
Commit
596ac9a0
authored
Jun 17, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
常规BUG的修改
parent
bccd38c0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
DaoConst.java
yzg-util-db/src/main/java/com/yanzuoguang/dao/DaoConst.java
+2
-2
TableStruct.java
...b/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
+11
-11
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/dao/DaoConst.java
View file @
596ac9a0
...
@@ -93,11 +93,11 @@ public class DaoConst {
...
@@ -93,11 +93,11 @@ public class DaoConst {
/**
/**
* 更新SQL语句模板
* 更新SQL语句模板
*/
*/
public
static
final
String
UPDATE_MODEL
=
"UPDATE {TABLE} SET {FIELD} WHERE 1=1 {WHERE}"
;
public
static
final
String
UPDATE_MODEL
=
"UPDATE {TABLE}
AS a{INNER}
SET {FIELD} WHERE 1=1 {WHERE}"
;
/**
/**
* 删除SQL语句模板
* 删除SQL语句模板
*/
*/
public
static
final
String
REMOVE_MODEL
=
"DELETE
FROM {TABLE
} WHERE 1=1 {WHERE}"
;
public
static
final
String
REMOVE_MODEL
=
"DELETE
a FROM {TABLE} AS a{INNER
} WHERE 1=1 {WHERE}"
;
/**
/**
* 加载SQL语句模板
* 加载SQL语句模板
*/
*/
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
View file @
596ac9a0
...
@@ -334,21 +334,21 @@ public class TableStruct {
...
@@ -334,21 +334,21 @@ public class TableStruct {
TableFieldVo
removeField
=
this
.
getRemove
();
TableFieldVo
removeField
=
this
.
getRemove
();
TableFieldVo
versionField
=
this
.
getVersion
();
TableFieldVo
versionField
=
this
.
getVersion
();
sql
.
addParaConst
(
this
.
getKey
().
inputName
,
sql
.
addParaConst
(
this
.
getKey
().
inputName
,
DaoConst
.
FIELD_CODE
,
"
"
+
this
.
getKey
().
name
+
"=
"
+
this
.
getKey
().
name
,
DaoConst
.
FIELD_CODE
,
"
a."
+
this
.
getKey
().
name
+
"=a.
"
+
this
.
getKey
().
name
,
DaoConst
.
WHERE_CODE
,
" AND "
+
this
.
getKey
().
name
+
"=?"
);
DaoConst
.
WHERE_CODE
,
" AND
a.
"
+
this
.
getKey
().
name
+
"=?"
);
for
(
TableFieldVo
field
:
this
.
getFields
())
{
for
(
TableFieldVo
field
:
this
.
getFields
())
{
if
(
field
==
removeField
||
field
==
versionField
)
{
if
(
field
==
removeField
||
field
==
versionField
)
{
continue
;
continue
;
}
}
sql
.
addParaConst
(
field
.
inputName
,
DaoConst
.
FIELD_CODE
,
","
+
field
.
name
+
"=?"
);
sql
.
addParaConst
(
field
.
inputName
,
DaoConst
.
FIELD_CODE
,
",
a.
"
+
field
.
name
+
"=?"
);
}
}
if
(
removeField
!=
null
)
{
if
(
removeField
!=
null
)
{
sql
.
addParaConst
(
removeField
.
inputName
,
DaoConst
.
WHERE_CODE
,
" AND "
+
removeField
.
name
+
"=0"
);
sql
.
addParaConst
(
removeField
.
inputName
,
DaoConst
.
WHERE_CODE
,
" AND
a.
"
+
removeField
.
name
+
"=0"
);
}
}
if
(
versionField
!=
null
)
{
if
(
versionField
!=
null
)
{
sql
.
addParaConst
(
versionField
.
inputName
,
sql
.
addParaConst
(
versionField
.
inputName
,
DaoConst
.
FIELD_CODE
,
",
"
+
versionField
.
name
+
"=1+
"
+
versionField
.
name
,
DaoConst
.
FIELD_CODE
,
",
a."
+
versionField
.
name
+
"=1+a.
"
+
versionField
.
name
,
DaoConst
.
WHERE_CODE
,
" AND "
+
versionField
.
name
+
"=?"
);
DaoConst
.
WHERE_CODE
,
" AND
a.
"
+
versionField
.
name
+
"=?"
);
}
}
return
sql
;
return
sql
;
}
}
...
@@ -365,19 +365,19 @@ public class TableStruct {
...
@@ -365,19 +365,19 @@ public class TableStruct {
// 生成添加的SQL语句
// 生成添加的SQL语句
String
text
=
DaoConst
.
UPDATE_MODEL
.
replace
(
DaoConst
.
TABLE_CODE
,
this
.
name
);
String
text
=
DaoConst
.
UPDATE_MODEL
.
replace
(
DaoConst
.
TABLE_CODE
,
this
.
name
);
SqlData
sql
=
new
SqlData
(
DaoConst
.
REMOVE
,
text
);
SqlData
sql
=
new
SqlData
(
DaoConst
.
REMOVE
,
text
);
sql
.
addCode
(
DaoConst
.
FIELD_CODE
,
removeField
.
name
+
"=1"
);
sql
.
addCode
(
DaoConst
.
FIELD_CODE
,
"a."
+
removeField
.
name
+
"=1"
);
for
(
TableFieldVo
field
:
this
.
getFieldActionList
(
DaoConst
.
FIELD_REMOVE_UPDATE
))
{
for
(
TableFieldVo
field
:
this
.
getFieldActionList
(
DaoConst
.
FIELD_REMOVE_UPDATE
))
{
sql
.
addParaConst
(
field
.
inputName
,
DaoConst
.
FIELD_CODE
,
","
+
field
.
name
+
"=?"
);
sql
.
addParaConst
(
field
.
inputName
,
DaoConst
.
FIELD_CODE
,
",
a.
"
+
field
.
name
+
"=?"
);
}
}
if
(
versionField
!=
null
)
{
if
(
versionField
!=
null
)
{
sql
.
addCode
(
DaoConst
.
FIELD_CODE
,
",
"
+
versionField
.
name
+
"=1+
"
+
versionField
.
name
);
sql
.
addCode
(
DaoConst
.
FIELD_CODE
,
",
a."
+
versionField
.
name
+
"=1+a.
"
+
versionField
.
name
);
}
}
addWhereField
(
sql
,
""
,
true
);
addWhereField
(
sql
,
"
a.
"
,
true
);
return
sql
;
return
sql
;
}
else
{
}
else
{
String
text
=
DaoConst
.
REMOVE_MODEL
.
replace
(
DaoConst
.
TABLE_CODE
,
this
.
name
);
String
text
=
DaoConst
.
REMOVE_MODEL
.
replace
(
DaoConst
.
TABLE_CODE
,
this
.
name
);
SqlData
sql
=
new
SqlData
(
DaoConst
.
REMOVE
,
text
);
SqlData
sql
=
new
SqlData
(
DaoConst
.
REMOVE
,
text
);
addWhereField
(
sql
,
""
,
true
);
addWhereField
(
sql
,
"
a.
"
,
true
);
return
sql
;
return
sql
;
}
}
}
}
...
...
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