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
1cb5b280
Commit
1cb5b280
authored
Mar 04, 2021
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改实体位置
parent
d4e8ae9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
24 deletions
+35
-24
BaseDaoImpl.java
...b/src/main/java/com/yanzuoguang/dao/impl/BaseDaoImpl.java
+7
-2
BaseDaoSql.java
...db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoSql.java
+28
-22
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoImpl.java
View file @
1cb5b280
...
@@ -24,9 +24,14 @@ import java.util.*;
...
@@ -24,9 +24,14 @@ import java.util.*;
*/
*/
public
abstract
class
BaseDaoImpl
extends
BaseDaoSql
implements
BaseDao
{
public
abstract
class
BaseDaoImpl
extends
BaseDaoSql
implements
BaseDao
{
@Override
/**
protected
void
initExecute
(
DbExecute
db
)
{
* 构造函数
*/
public
BaseDaoImpl
()
{
}
public
BaseDaoImpl
(
DbExecute
db
,
TableSqlCache
table
)
{
super
(
db
,
table
);
}
}
/**
/**
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoSql.java
View file @
1cb5b280
...
@@ -37,12 +37,8 @@ public abstract class BaseDaoSql {
...
@@ -37,12 +37,8 @@ public abstract class BaseDaoSql {
/**
/**
* 数据库执行类
* 数据库执行类
*/
*/
@Resource
private
DbExecute
db
;
private
DbExecute
db
;
private
boolean
initSql
=
false
;
/**
/**
* 当前Dao的表结构SQL语句信息
* 当前Dao的表结构SQL语句信息
*/
*/
...
@@ -53,26 +49,42 @@ public abstract class BaseDaoSql {
...
@@ -53,26 +49,42 @@ public abstract class BaseDaoSql {
*/
*/
protected
final
static
MemoryCache
<
TableSqlCache
>
cache
=
new
MemoryCache
<>();
protected
final
static
MemoryCache
<
TableSqlCache
>
cache
=
new
MemoryCache
<>();
/**
* 构造函数
*/
public
BaseDaoSql
()
{
this
.
initTable
();
this
.
init
();
}
/**
* 自己构造
*
* @param db
* @param table
*/
public
BaseDaoSql
(
DbExecute
db
,
TableSqlCache
table
)
{
this
.
db
=
db
;
this
.
table
=
table
;
this
.
init
();
}
@Resource
public
void
setDb
(
DbExecute
db
)
{
this
.
db
=
db
;
}
/**
/**
* 获取数据库执行类
* 获取数据库执行类
*
*
* @return
* @return
*/
*/
protected
DbExecute
getDb
()
{
protected
DbExecute
getDb
()
{
synchronized
(
this
.
db
)
{
return
db
;
if
(
this
.
db
!=
null
&&
!
this
.
initSql
)
{
this
.
initExecute
(
this
.
db
);
this
.
initSql
=
true
;
}
return
db
;
}
}
}
/**
public
void
setTable
(
TableSqlCache
table
)
{
* 构造函数
this
.
table
=
table
;
*/
public
BaseDaoSql
()
{
this
.
initTable
();
}
}
/**
/**
...
@@ -86,15 +98,9 @@ public abstract class BaseDaoSql {
...
@@ -86,15 +98,9 @@ public abstract class BaseDaoSql {
if
(
this
.
table
==
null
)
{
if
(
this
.
table
==
null
)
{
this
.
table
=
new
TableSqlCache
();
this
.
table
=
new
TableSqlCache
();
cache
.
put
(
cls
,
this
.
table
);
cache
.
put
(
cls
,
this
.
table
);
this
.
init
();
}
}
}
}
/**
* 初始化执行
*/
protected
abstract
void
initExecute
(
DbExecute
db
);
/**
/**
* 注册SQL语句
* 注册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