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
8216dfb5
Commit
8216dfb5
authored
Mar 11, 2021
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改实体位置
parent
2ad34e83
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
+21
-6
BaseDaoImpl.java
...b/src/main/java/com/yanzuoguang/dao/impl/BaseDaoImpl.java
+6
-2
MessageDaoImpl.java
...main/java/com/yanzuoguang/mq/dao/impl/MessageDaoImpl.java
+15
-4
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoImpl.java
View file @
8216dfb5
...
...
@@ -9,6 +9,7 @@ import com.yanzuoguang.util.exception.CodeException;
import
com.yanzuoguang.util.helper.DateHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.vo.*
;
import
org.omg.CORBA.StringHolder
;
import
java.util.*
;
...
...
@@ -661,12 +662,15 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
}
String
md5Field
=
this
.
table
.
getTable
().
getMD5KeyName
();
String
md5From
=
StringHelper
.
isEmpty
(
md5Field
)
?
StringHelper
.
EMPTY
:
ObjectHelper
.
getString
(
model
,
md5Field
);
// 获取前台分组的MD5标识
String
md5
=
this
.
getMd5
(
DaoConst
.
GROUP_QUERY
,
model
);
String
md5
=
md5From
;
if
(
StringHelper
.
isEmpty
(
md5
))
{
md5
=
this
.
getMd5
(
DaoConst
.
GROUP_QUERY
,
model
);
}
if
(!
StringHelper
.
isEmpty
(
md5Field
))
{
ObjectHelper
.
set
(
model
,
md5Field
,
md5
);
}
if
(
this
.
table
.
getTable
().
getKeyType
()
==
String
.
class
)
{
this
.
setKeyString
(
model
,
md5
);
}
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/dao/impl/MessageDaoImpl.java
View file @
8216dfb5
...
...
@@ -7,6 +7,7 @@ import com.yanzuoguang.db.DbExecute;
import
com.yanzuoguang.mq.dao.MessageDao
;
import
com.yanzuoguang.mq.vo.MessageVo
;
import
com.yanzuoguang.util.vo.MapRow
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
...
...
@@ -19,7 +20,7 @@ import java.util.Map;
* @author 颜佐光
*/
@Component
public
class
MessageDaoImpl
extends
BaseDaoImpl
implements
MessageDao
{
public
class
MessageDaoImpl
extends
BaseDaoImpl
implements
MessageDao
,
InitializingBean
{
private
static
final
String
UPDATE_BATCH_SQL
=
"UPDATE_BATCH_SQL"
;
private
static
final
String
QUERY_TABLE_SQL
=
"SHOW TABLES LIKE 'queue_message'"
;
private
static
final
String
CREATE_TABLE_SQL
=
"CREATE TABLE `queue_message` ( "
+
...
...
@@ -50,11 +51,21 @@ public class MessageDaoImpl extends BaseDaoImpl implements MessageDao {
"SET a.BatchId = ?,a.HandleTime=DATE_ADD(NOW(),INTERVAL 5 MINUTE) "
,
"batchId"
);
}
/**
* Invoked by a BeanFactory after it has set all bean properties supplied
* (and satisfied BeanFactoryAware and ApplicationContextAware).
* <p>This method allows the bean instance to perform initialization only
* possible when all bean properties have been set and to throw an
* exception in the event of misconfiguration.
*
* @throws Exception in the event of misconfiguration (such
* as failure to set an essential property) or if initialization fails.
*/
@Override
p
rotected
void
initExecute
(
DbExecute
db
)
{
List
<
MapRow
>
tables
=
db
.
query
(
MessageDaoImpl
.
class
,
"QUERY_TABLE_SQL"
,
QUERY_TABLE_SQL
);
p
ublic
void
afterPropertiesSet
()
throws
Exception
{
List
<
MapRow
>
tables
=
this
.
getDb
()
.
query
(
MessageDaoImpl
.
class
,
"QUERY_TABLE_SQL"
,
QUERY_TABLE_SQL
);
if
(
tables
.
isEmpty
())
{
db
.
update
(
MessageDaoImpl
.
class
,
"CREATE_TABLE_SQL"
,
CREATE_TABLE_SQL
);
this
.
getDb
()
.
update
(
MessageDaoImpl
.
class
,
"CREATE_TABLE_SQL"
,
CREATE_TABLE_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