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
0bc772ac
Commit
0bc772ac
authored
Jun 14, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
压缩视频
parent
d3d0501b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
19 deletions
+15
-19
TableStruct.java
...b/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
+15
-19
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
View file @
0bc772ac
...
...
@@ -536,9 +536,7 @@ public class TableStruct {
* @return 生成的语句
*/
private
void
addWhereField
(
SqlData
sql
,
String
tag
,
boolean
isRemove
)
{
sql
.
add
(
this
.
getKey
().
inputName
,
String
.
format
(
DaoConst
.
CODE_WHERE_EQUALS
,
tag
,
this
.
getKey
().
name
,
DaoConst
.
CODE_PARA
)
);
addWhereFieldCommon
(
sql
,
this
.
getKey
(),
tag
);
// Where条件包含的字段
List
<
TableFieldVo
>
fields
;
...
...
@@ -549,22 +547,27 @@ public class TableStruct {
// 非删除时需要更新的字段
fields
=
this
.
getFieldActionList
(
DaoConst
.
FIELD_COMMON
,
DaoConst
.
FIELD_REMOVE_UPDATE
);
}
// 添加普通的Where条件
for
(
TableFieldVo
field
:
fields
)
{
// 添加等于条件
sql
.
add
(
field
.
inputName
,
String
.
format
(
DaoConst
.
CODE_WHERE_EQUALS
,
tag
,
field
.
name
,
DaoConst
.
CODE_PARA
));
// 添加in条件
String
sqlIn
=
String
.
format
(
DaoConst
.
CODE_WHERE_IN
,
tag
,
field
.
name
,
DaoConst
.
CODE_PARA
);
if
(
field
.
inputLName
.
endsWith
(
DaoConst
.
CODE_WHERE_IN_END
))
{
sql
.
add
(
field
.
inputName
+
DaoConst
.
CODE_WHERE_IN_END_ES
,
sqlIn
);
}
else
{
sql
.
add
(
field
.
inputName
+
DaoConst
.
CODE_WHERE_IN_END
,
sqlIn
);
}
addWhereFieldCommon
(
sql
,
field
,
tag
);
}
// 查询时,不能查询到非删除的字段
addWhereRemove
(
sql
);
}
private
void
addWhereFieldCommon
(
SqlData
sql
,
TableFieldVo
field
,
String
tag
)
{
// 添加等于条件
sql
.
add
(
field
.
inputName
,
String
.
format
(
DaoConst
.
CODE_WHERE_EQUALS
,
tag
,
field
.
name
,
DaoConst
.
CODE_PARA
));
// 添加in条件
String
sqlIn
=
String
.
format
(
DaoConst
.
CODE_WHERE_IN
,
tag
,
field
.
name
,
DaoConst
.
CODE_PARA
);
if
(
field
.
inputLName
.
endsWith
(
DaoConst
.
CODE_WHERE_IN_END
))
{
sql
.
add
(
field
.
inputName
+
DaoConst
.
CODE_WHERE_IN_END_ES
,
sqlIn
);
}
else
{
sql
.
add
(
field
.
inputName
+
DaoConst
.
CODE_WHERE_IN_END
,
sqlIn
);
}
}
/**
* 添加删除WHERE条件字段
*
...
...
@@ -615,13 +618,6 @@ public class TableStruct {
for
(
TableFieldVo
field
:
whereFields
)
{
sql
.
addConst
(
field
.
inputName
,
String
.
format
(
DaoConst
.
CODE_WHERE_EQUALS_PARA
,
field
.
name
));
// 添加in条件
if
(
field
.
inputLName
.
endsWith
(
DaoConst
.
CODE_WHERE_IN_END
))
{
sql
.
add
(
field
.
inputName
+
DaoConst
.
CODE_WHERE_IN_END_ES
,
String
.
format
(
DaoConst
.
CODE_WHERE_IN_PARA
,
field
.
name
));
}
else
{
sql
.
add
(
field
.
inputName
+
DaoConst
.
CODE_WHERE_IN_END
,
String
.
format
(
DaoConst
.
CODE_WHERE_IN_PARA
,
field
.
name
));
}
}
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