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
1bf8e4b6
Commit
1bf8e4b6
authored
Aug 18, 2023
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.3版本修改,增加删除功能
parent
0cb7ca51
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
18 deletions
+19
-18
TableStruct.java
...b/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
+19
-18
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
View file @
1bf8e4b6
...
@@ -482,13 +482,9 @@ public class TableStruct {
...
@@ -482,13 +482,9 @@ public class TableStruct {
*/
*/
private
SqlData
releaseSqlUpdate
()
{
private
SqlData
releaseSqlUpdate
()
{
// 生成添加的SQL语句
// 生成添加的SQL语句
String
text
=
SQL_UPDATE
.
replace
(
CODE_TABLE
,
this
.
name
);
SqlData
sql
=
getUpdateSql
(
UPDATE
,
SQL_TYPE_UPDATE
);
SqlData
sql
=
new
SqlData
(
UPDATE
,
text
);
sql
.
setSqlType
(
SQL_TYPE_UPDATE
);
TableFieldVo
key
=
this
.
getKey
();
// 主键字段操作
TableFieldVo
key
=
this
.
getKey
();
sql
.
addCode
(
CODE_FIELD
,
String
.
format
(
CODE_UPDATE_PRIMARY
,
key
.
name
,
key
.
name
));
sql
.
addConst
(
key
.
inputName
,
String
.
format
(
CODE_WHERE_EQUALS_PARA
,
key
.
name
));
sql
.
addConst
(
key
.
inputName
,
String
.
format
(
CODE_WHERE_EQUALS_PARA
,
key
.
name
));
// 增加普通代码片段字段
// 增加普通代码片段字段
...
@@ -500,10 +496,6 @@ public class TableStruct {
...
@@ -500,10 +496,6 @@ public class TableStruct {
);
);
}
}
// 添加删除字段
// addWhereRemove(sql);
addUpdateRemoveField
(
sql
);
addUpdateVersionField
(
sql
);
// 添加版本号条件
// 添加版本号条件
if
(
getVersion
()
!=
null
)
{
if
(
getVersion
()
!=
null
)
{
sql
.
addConst
(
getVersion
().
inputName
,
String
.
format
(
CODE_WHERE_EQUALS_PARA
,
getVersion
().
name
));
sql
.
addConst
(
getVersion
().
inputName
,
String
.
format
(
CODE_WHERE_EQUALS_PARA
,
getVersion
().
name
));
...
@@ -519,14 +511,7 @@ public class TableStruct {
...
@@ -519,14 +511,7 @@ public class TableStruct {
private
SqlData
releaseSqlRemove
()
{
private
SqlData
releaseSqlRemove
()
{
TableFieldVo
remove
=
this
.
getRemove
();
TableFieldVo
remove
=
this
.
getRemove
();
if
(
remove
!=
null
)
{
if
(
remove
!=
null
)
{
// 生成添加的SQL语句
SqlData
sql
=
getUpdateSql
(
REMOVE
,
SQL_TYPE_REMOVE
);
String
text
=
SQL_UPDATE
.
replace
(
CODE_TABLE
,
this
.
name
);
SqlData
sql
=
new
SqlData
(
REMOVE
,
text
);
sql
.
setSqlType
(
SQL_TYPE_REMOVE
);
// 设置删除字段标记
addUpdateRemoveField
(
sql
);
// 增加版本号字段的值
addUpdateVersionField
(
sql
);
// 设置删除时需要修改的字段的值
// 设置删除时需要修改的字段的值
for
(
TableFieldVo
field
:
this
.
getFieldActionList
(
FIELD_REMOVE_UPDATE
))
{
for
(
TableFieldVo
field
:
this
.
getFieldActionList
(
FIELD_REMOVE_UPDATE
))
{
sql
.
addParaConst
(
field
.
inputName
,
sql
.
addParaConst
(
field
.
inputName
,
...
@@ -545,6 +530,22 @@ public class TableStruct {
...
@@ -545,6 +530,22 @@ public class TableStruct {
}
}
}
}
private
SqlData
getUpdateSql
(
String
sqlName
,
int
sqlType
)
{
// 生成添加的SQL语句
String
text
=
SQL_UPDATE
.
replace
(
CODE_TABLE
,
this
.
name
);
SqlData
sql
=
new
SqlData
(
sqlName
,
text
);
sql
.
setSqlType
(
SQL_TYPE_REMOVE
);
TableFieldVo
key
=
this
.
getKey
();
// 主键字段操作
sql
.
addCode
(
CODE_FIELD
,
String
.
format
(
CODE_UPDATE_PRIMARY
,
key
.
name
,
key
.
name
));
// 设置删除字段标记
addUpdateRemoveField
(
sql
);
// 增加版本号字段的值
addUpdateVersionField
(
sql
);
return
sql
;
}
private
SqlData
releaseSqlQuery
(
String
sqlName
,
int
sqlType
)
{
private
SqlData
releaseSqlQuery
(
String
sqlName
,
int
sqlType
)
{
// 生成添加的SQL语句
// 生成添加的SQL语句
String
text
=
SQL_LOAD
.
replace
(
CODE_TABLE
,
this
.
name
);
String
text
=
SQL_LOAD
.
replace
(
CODE_TABLE
,
this
.
name
);
...
...
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