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
24d4ff91
Commit
24d4ff91
authored
Aug 18, 2023
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表结构修改表结构修改
parent
c5c9feb3
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
136 additions
and
157 deletions
+136
-157
DaoConst.java
yzg-util-db/src/main/java/com/yanzuoguang/dao/DaoConst.java
+3
-3
QueryPara.java
yzg-util-db/src/main/java/com/yanzuoguang/dao/QueryPara.java
+3
-26
BaseDaoImpl.java
...b/src/main/java/com/yanzuoguang/dao/impl/BaseDaoImpl.java
+2
-4
BaseDaoSql.java
...db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoSql.java
+1
-10
TableStruct.java
...b/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
+127
-114
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/dao/DaoConst.java
View file @
24d4ff91
...
...
@@ -141,7 +141,7 @@ public class DaoConst {
/**
* 更新字段模板参数
*/
public
static
final
String
CODE_UPDATE_FIELD_REMOVE
=
"a.%s=
1
"
;
public
static
final
String
CODE_UPDATE_FIELD_REMOVE
=
"a.%s=
IFNULL(?,1)
"
;
/**
* 等于条件
*/
...
...
@@ -173,7 +173,7 @@ public class DaoConst {
/**
* 未删除条件
*/
public
static
final
String
CODE_WHERE_EQUALS_NOT_REMOVE
=
"AND a.%s=
0
"
;
public
static
final
String
CODE_WHERE_EQUALS_NOT_REMOVE
=
"AND a.%s=
IFNULL(?,0)
"
;
/**
* 版本好字段
*/
...
...
@@ -225,7 +225,7 @@ public class DaoConst {
/**
* 删除字符串长度变量
*/
public
static
final
String
REMOVE_FLAG_INPUT
=
"remove_input
"
;
public
static
final
String
OLD_FLAG
=
"Old
"
;
/**
* ID字段
*/
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/QueryPara.java
View file @
24d4ff91
...
...
@@ -6,37 +6,22 @@ import io.swagger.annotations.ApiModelProperty;
/**
* 查询参数
*
* @author
颜佐光
* @author
颜佐光
*/
@ApiModel
(
description
=
"查询参数"
)
public
class
QueryPara
{
/**
* 查询删除
*/
public
static
QueryPara
LOAD_REMOVE
=
new
QueryPara
(
false
,
true
);
/**
* 所有条件生效
*/
public
static
QueryPara
FULL_COND
=
new
QueryPara
(
true
,
false
);
public
static
QueryPara
FULL_COND
=
new
QueryPara
(
true
);
/**
* 所有条件生效
*/
@ApiModelProperty
(
notes
=
"所有条件生效,而不仅仅在主键存在时,通过主键加载"
)
private
boolean
fullCond
;
/**
* 查询删除标记的结果
*/
@ApiModelProperty
(
notes
=
"在数据通过删除标记删除时,可以通过该参数查询出来"
)
private
boolean
loadRemove
;
public
QueryPara
(
boolean
fullCond
,
boolean
loadRemove
)
{
public
QueryPara
(
boolean
fullCond
)
{
this
.
fullCond
=
fullCond
;
this
.
loadRemove
=
loadRemove
;
}
public
boolean
isFullCond
()
{
...
...
@@ -46,12 +31,4 @@ public class QueryPara {
public
void
setFullCond
(
boolean
fullCond
)
{
this
.
fullCond
=
fullCond
;
}
public
boolean
isLoadRemove
()
{
return
loadRemove
;
}
public
void
setLoadRemove
(
boolean
loadRemove
)
{
this
.
loadRemove
=
loadRemove
;
}
}
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoImpl.java
View file @
24d4ff91
...
...
@@ -61,8 +61,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
// 最终处理
this
.
created
(
model
);
// 返回执行结果
String
retVal
=
ret
>
0
?
keyString
:
""
;
return
retVal
;
return
ret
>
0
?
keyString
:
""
;
}
protected
List
<
String
>
createReplaceList
(
String
sqlName
,
Collection
collection
)
{
...
...
@@ -403,8 +402,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
return
model
;
}
// 获取来源主键
Object
from
=
this
.
table
.
getKeyObject
(
model
);
return
from
;
return
this
.
table
.
getKeyObject
(
model
);
}
private
<
T
>
void
checkLoadResult
(
T
toItem
,
List
<
T
>
tos
)
{
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoSql.java
View file @
24d4ff91
...
...
@@ -213,16 +213,7 @@ public abstract class BaseDaoSql {
* @param copy 是否复制
*/
protected
SqlData
getSqlQueryPara
(
SqlData
sqlData
,
QueryPara
queryPara
,
boolean
copy
)
{
SqlData
copyTo
=
sqlData
;
if
(
queryPara
!=
null
&&
queryPara
.
isLoadRemove
())
{
if
(
copyTo
.
getField
(
DaoConst
.
REMOVE_FLAG_INPUT
)
!=
null
)
{
if
(
copy
)
{
copyTo
=
sqlData
.
copy
();
}
copyTo
.
removeField
(
DaoConst
.
REMOVE_FLAG_INPUT
);
}
}
return
copyTo
;
return
sqlData
;
}
/**
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
View file @
24d4ff91
This diff is collapsed.
Click to expand it.
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