Commit 3ea8716c authored by yanzg's avatar yanzg

接口文档的支持

parent 44cec2dd
...@@ -28,8 +28,8 @@ public interface DbExecute { ...@@ -28,8 +28,8 @@ public interface DbExecute {
* 查询数据 * 查询数据
* *
* @param targetClass 触发类 * @param targetClass 触发类
* @param sqlName SQL语句名称
* @param cls 查询的结果的类型 * @param cls 查询的结果的类型
* @param sqlName SQL语句名称
* @param rowHandle 通过该类来处理结果 * @param rowHandle 通过该类来处理结果
* @param sql 需要查询的SQL语句 * @param sql 需要查询的SQL语句
* @param paras 查询语句的参数 * @param paras 查询语句的参数
...@@ -42,8 +42,8 @@ public interface DbExecute { ...@@ -42,8 +42,8 @@ public interface DbExecute {
* 查询数据,并返回集合 * 查询数据,并返回集合
* *
* @param targetClass 触发类 * @param targetClass 触发类
* @param sqlName SQL语句名称
* @param cls 查询的结果的类型 * @param cls 查询的结果的类型
* @param sqlName SQL语句名称
* @param sql 需要查询的SQL语句 * @param sql 需要查询的SQL语句
* @param paras 查询语句的参数 * @param paras 查询语句的参数
* @param <T> 返回的集合的类型 * @param <T> 返回的集合的类型
......
...@@ -20,6 +20,20 @@ import java.util.Map; ...@@ -20,6 +20,20 @@ import java.util.Map;
@Component @Component
public class MessageDaoImpl extends BaseDaoImpl implements MessageDao { public class MessageDaoImpl extends BaseDaoImpl implements MessageDao {
private static final String UPDATE_BATCH_SQL = "UPDATE_BATCH_SQL"; 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` ( " +
" `MessageId` varchar(32) NOT NULL COMMENT '消息编号', " +
" `ExchangeName` varchar(255) NOT NULL DEFAULT '' COMMENT '交换器', " +
" `RouteKey` varchar(255) NOT NULL DEFAULT '' COMMENT '路由键', " +
" `Message` text NOT NULL COMMENT '消息内容', " +
" `DedTime` int(11) NOT NULL DEFAULT '0' COMMENT '死信时间', " +
" `HandleCount` int(11) NOT NULL DEFAULT '0' COMMENT '处理次数', " +
" `HandleTime` datetime NOT NULL COMMENT '上次处理时间', " +
" `BatchId` varchar(32) NOT NULL COMMENT '发送批次', " +
" `CreateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', " +
" PRIMARY KEY (`MessageId`), " +
" KEY `IndexHandleTime` (`HandleTime`) " +
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='队列消息表'";
@Override @Override
protected void init() { protected void init() {
...@@ -33,6 +47,11 @@ public class MessageDaoImpl extends BaseDaoImpl implements MessageDao { ...@@ -33,6 +47,11 @@ public class MessageDaoImpl extends BaseDaoImpl implements MessageDao {
"INNER JOIN ( SELECT * FROM Queue_Message WHERE (HandleTime IS NULL OR HandleTime < NOW()) " + "INNER JOIN ( SELECT * FROM Queue_Message WHERE (HandleTime IS NULL OR HandleTime < NOW()) " +
"ORDER BY HandleTime ASC,MessageId ASC {LIMIT} ) AS b ON a.MessageId = b.MessageId " + "ORDER BY HandleTime ASC,MessageId ASC {LIMIT} ) AS b ON a.MessageId = b.MessageId " +
"SET a.BatchId = ?,a.HandleTime=DATE_ADD(NOW(),INTERVAL 5 MINUTE) ", "batchId"); "SET a.BatchId = ?,a.HandleTime=DATE_ADD(NOW(),INTERVAL 5 MINUTE) ", "batchId");
List<MapRow> tables = this.db.query(MessageDaoImpl.class, "QUERY_TABLE_SQL", QUERY_TABLE_SQL);
if (tables.isEmpty()) {
this.db.update(MessageDaoImpl.class, "CREATE_TABLE_SQL", CREATE_TABLE_SQL);
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment