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
07605d8a
Commit
07605d8a
authored
Sep 05, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改MQ请求尸体,防止出错
parent
2975ef98
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
3 deletions
+32
-3
DaoConst.java
yzg-util-db/src/main/java/com/yanzuoguang/dao/DaoConst.java
+9
-1
SqlData.java
...il-db/src/main/java/com/yanzuoguang/dao/impl/SqlData.java
+23
-2
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/dao/DaoConst.java
View file @
07605d8a
...
...
@@ -99,7 +99,7 @@ public class DaoConst {
* 加载SQL语句模板
*/
public
static
final
String
SQL_LOAD
=
"{SELECT_OUTER_BEGIN}SELECT {FIELD} FROM {TABLE} AS a {INNER} WHERE 1=1"
+
"{WHERE}{GROUP}{HAVING}{ORDER}{LIMIT}{SELECT_OUTER_END}"
;
"{WHERE}{GROUP}{HAVING}{ORDER}{LIMIT}{SELECT_OUTER_END}
{LIMIT_END}
"
;
/**
* 表名代码片段
*/
...
...
@@ -124,6 +124,14 @@ public class DaoConst {
* WHERE条件代码片段
*/
public
static
final
String
CODE_WHERE
=
"{WHERE}"
;
/**
* WHERE条件代码片段
*/
public
static
final
String
CODE_LIMIT
=
"{LIMIT}"
;
/**
* WHERE条件代码片段
*/
public
static
final
String
CODE_LIMIT_END
=
"{LIMIT_END}"
;
/**
* 更新字段模板
*/
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/SqlData.java
View file @
07605d8a
...
...
@@ -3,12 +3,11 @@ package com.yanzuoguang.dao.impl;
import
com.yanzuoguang.dao.DaoConst
;
import
com.yanzuoguang.dao.cond.SqlCond
;
import
com.yanzuoguang.dao.cond.SqlCondDefault
;
import
com.yanzuoguang.util.helper.StringFormatHandle
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* SQL语句基本信息
...
...
@@ -82,6 +81,28 @@ public class SqlData {
return
name
;
}
/**
* 交换SQL语句中的{LIMIT}和{LIMIT_END}
*
* @return
*/
public
SqlData
switchLimit
()
{
this
.
sql
=
StringHelper
.
getFormat
(
this
.
sql
,
StringHelper
.
EMPTY
,
new
StringFormatHandle
()
{
@Override
public
void
addPos
(
StringBuilder
sb
,
String
group
,
String
fieldFull
,
String
field
,
String
command
)
{
if
(
StringHelper
.
compare
(
group
,
DaoConst
.
CODE_LIMIT
))
{
sb
.
append
(
DaoConst
.
CODE_LIMIT_END
);
}
else
if
(
StringHelper
.
compare
(
group
,
DaoConst
.
CODE_LIMIT_END
))
{
sb
.
append
(
DaoConst
.
CODE_LIMIT
);
}
else
{
sb
.
append
(
group
);
}
}
});
return
this
;
}
/**
* 设置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