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
f0addf73
Commit
f0addf73
authored
Jun 18, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
常规BUG的修改
parent
4fba420b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
14 deletions
+32
-14
TableStruct.java
...b/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
+32
-14
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
View file @
f0addf73
...
...
@@ -98,7 +98,8 @@ public class TableStruct {
List
<
TableFieldVo
>
commonActionList
=
this
.
getFieldActionList
(
DaoConst
.
FIELD_COMMON
);
// 判断是否属于主键
if
(
fieldAction
==
DaoConst
.
FIELD_PRIMARY
||
stringAction
==
DaoConst
.
FIELD_PRIMARY
)
{
int
resultActionType
=
getActionType
(
fieldAction
,
stringAction
);
if
(
resultActionType
==
DaoConst
.
FIELD_PRIMARY
)
{
// 将历史主键添加到普通列,并且移除历史主键
List
<
TableFieldVo
>
primaryActionList
=
this
.
getFieldActionList
(
DaoConst
.
FIELD_PRIMARY
);
commonActionList
.
addAll
(
primaryActionList
);
...
...
@@ -109,27 +110,43 @@ public class TableStruct {
// 将所有非主键列添加到普通列
commonActionList
.
add
(
vo
);
boolean
isTypeMany
=
fieldAction
==
DaoConst
.
FIELD_REMOVE_UPDATE
||
stringAction
==
DaoConst
.
FIELD_REMOVE_UPDATE
||
fieldAction
==
DaoConst
.
FIELD_CREATE
||
stringAction
==
DaoConst
.
FIELD_CREATE
;
boolean
isTypeMany
=
resultActionType
==
DaoConst
.
FIELD_REMOVE_UPDATE
||
resultActionType
==
DaoConst
.
FIELD_CREATE
;
if
(
isTypeMany
)
{
List
<
TableFieldVo
>
actionList
=
this
.
getFieldActionList
(
DaoConst
.
FIELD_REMOVE_UPDATE
);
List
<
TableFieldVo
>
actionList
=
this
.
getFieldActionList
(
resultActionType
);
actionList
.
add
(
vo
);
}
// 处理其他特殊列
else
if
(
fieldAction
!=
DaoConst
.
FIELD_COMMON
)
{
else
if
(
resultActionType
!=
DaoConst
.
FIELD_COMMON
)
{
List
<
TableFieldVo
>
actionList
=
this
.
getFieldActionList
(
resultActionType
);
// fieldAction 优先级高于 stringAction
// 假如特殊列已经存在,则将已经存在的特殊列删除,并且添加新的特殊列
List
<
TableFieldVo
>
actionList
=
this
.
getFieldActionList
(
fieldAction
);
if
(
resultActionType
==
fieldAction
)
{
actionList
.
clear
();
actionList
.
add
(
vo
);
}
else
if
(
stringAction
!=
DaoConst
.
FIELD_COMMON
)
{
}
else
{
// 假如是默认的,并且特殊列已经存在,则不进行任何处理
List
<
TableFieldVo
>
actionList
=
this
.
getFieldActionList
(
stringAction
);
if
(
actionList
.
isEmpty
())
{
actionList
.
add
(
vo
);
}
}
}
}
}
/**
* 获取字段类型
*
* @param fieldAction 字段类型
* @param stringAction 字符串字段类型
* @return 最终类型
*/
private
int
getActionType
(
int
fieldAction
,
int
stringAction
)
{
if
(
fieldAction
!=
DaoConst
.
FIELD_COMMON
)
{
return
fieldAction
;
}
else
{
return
stringAction
;
}
}
/**
* 获取字符串动作类型
...
...
@@ -381,8 +398,9 @@ public class TableStruct {
sql
.
addConst
(
this
.
getKey
().
inputName
,
String
.
format
(
DaoConst
.
CODE_WHERE_EQUALS_PARA
,
this
.
getKey
().
name
));
// 增加普通代码片段字段
for
(
TableFieldVo
field
:
getFieldActionList
(
DaoConst
.
FIELD_COMMON
,
DaoConst
.
FIELD_CREATE
,
DaoConst
.
FIELD_REMOVE
,
DaoConst
.
FIELD_VERSION
))
{
List
<
TableFieldVo
>
updateList
=
getFieldActionList
(
DaoConst
.
FIELD_COMMON
,
DaoConst
.
FIELD_CREATE
,
DaoConst
.
FIELD_REMOVE
,
DaoConst
.
FIELD_VERSION
);
for
(
TableFieldVo
field
:
updateList
)
{
sql
.
addParaConst
(
field
.
inputName
,
DaoConst
.
FIELD_CODE
,
String
.
format
(
DaoConst
.
CODE_UPDATE_FIELD_PARA
,
field
.
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