Skip to content

Commit

Permalink
fixed issue 3 #3 , 统一init sql和sqlmap中的大小写
Browse files Browse the repository at this point in the history
  • Loading branch information
agapple committed Aug 20, 2013
1 parent b5ccc97 commit 9453662
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 116 deletions.
26 changes: 13 additions & 13 deletions manager/biz/src/main/resources/sqlmap/sqlmap-mapping-delayStat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
</resultMap>

<resultMap id="topDelayStatResult" class="topDelayStat">
<result property="channelName" column="channel_name" />
<result property="pipelineName" column="pipeline_name" />
<result property="channelId" column="channel_id" />
<result property="channelName" column="CHANNEL_NAME" />
<result property="pipelineName" column="PIPELINE_NAME" />
<result property="channelId" column="CHANNEL_ID" />
<result property="pipelineId" column="PIPELINE_ID" />
<result property="delayTime" column="DELAY_TIME" />
<result property="lastUpdate" column="gmt_create" />
<result property="lastUpdate" column="GMT_CREATE" />
</resultMap>
<!-- all delayStat columns -->
<sql id="allDelayStatColumns">ID,DELAY_TIME,DELAY_NUMBER,PIPELINE_ID,GMT_CREATE,GMT_MODIFIED</sql>
Expand Down Expand Up @@ -97,21 +97,21 @@

<!-- listTopByName -->
<select id="listTopByName" resultMap="topDelayStatResult">
select p.* , d.delay_time , d.gmt_create
from delay_stat d , (
select p.channel_id , p.id as pipeline_id , c.name as channel_name, p.name as pipeline_name from channel c , pipeline p
where 1 = 1 and c.id = p.channel_id
select p.* , d.DELAY_TIME , d.GMT_CREATE
from DELAY_STAT d , (
select p.CHANNEL_ID , p.ID as PIPELINE_ID , c.NAME as CHANNEL_NAME, p.NAME as PIPELINE_NAME from CHANNEL c , PIPELINE p
where 1 = 1 and c.ID = p.CHANNEL_ID
<dynamic prepend="and">
<isNotEmpty property="searchKey">
c.name like concat('%',replace(#searchKey#,'_','\_'),'%')
c.NAME like concat('%',replace(#searchKey#,'_','\_'),'%')
</isNotEmpty>
</dynamic>
) p
where d.id = (
select d1.id from delay_stat d1
where d1.pipeline_id = p.pipeline_id order by d1.pipeline_id desc , d1.gmt_create desc limit 1
where d.ID = (
select d1.ID from DELAY_STAT d1
where d1.PIPELINE_ID = p.PIPELINE_ID order by d1.PIPELINE_ID desc , d1.GMT_CREATE desc limit 1
)
order by d.delay_time desc , d.id desc
order by d.DELAY_TIME desc , d.ID desc
<dynamic>
<isNotEmpty property="topN" >
limit #topN#
Expand Down
55 changes: 0 additions & 55 deletions manager/biz/src/main/resources/sqlmap/sqlmap-mapping-sample.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@

<!-- listThroughputStatByPipelineId -->
<select id="listRealtimeThroughputStatByPipelineIds" resultMap="throughputStatSimpleResult">
select pipeline_id, type , sum(number) as number , sum(size) as size
select PIPELINE_ID, type , sum(NUMBER) as number , sum(SIZE) as size
from THROUGHPUT_STAT
where pipeline_id in
where PIPELINE_ID in
<iterate property="pipelineIds" open="(" close=")" conjunction=",">
#pipelineIds[]#
</iterate>
and type in ('ROW','FILE') and end_time >= (now() - INTERVAL #minute# MINUTE)
group by pipeline_id , type;
and TYPE in ('ROW','FILE') and END_TIME >= (now() - INTERVAL #minute# MINUTE)
group by PIPELINE_ID , TYPE;
</select>
</sqlMap>
66 changes: 22 additions & 44 deletions manager/deployer/src/main/resources/sql/otter-manager-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `otter` /*!40100 DEFAULT CHARACTER SET

USE `otter`;

CREATE TABLE `alarm_rule` (
CREATE TABLE `ALARM_RULE` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`MONITOR_NAME` varchar(1024) DEFAULT NULL,
`RECEIVER_KEY` varchar(1024) DEFAULT NULL,
Expand All @@ -16,7 +16,7 @@ CREATE TABLE `alarm_rule` (
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `autokeeper_cluster` (
CREATE TABLE `AUTOKEEPER_CLUSTER` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`CLUSTER_NAME` varchar(200) NOT NULL,
`SERVER_LIST` varchar(1024) NOT NULL,
Expand All @@ -26,7 +26,7 @@ CREATE TABLE `autokeeper_cluster` (
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `canal` (
CREATE TABLE `CANAL` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`NAME` varchar(200) DEFAULT NULL,
`DESCRIPTION` varchar(200) DEFAULT NULL,
Expand All @@ -37,7 +37,7 @@ CREATE TABLE `canal` (
UNIQUE KEY `CANALUNIQUE` (`NAME`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `channel` (
CREATE TABLE `CHANNEL` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`NAME` varchar(200) NOT NULL,
`DESCRIPTION` varchar(200) DEFAULT NULL,
Expand All @@ -48,7 +48,7 @@ CREATE TABLE `channel` (
UNIQUE KEY `CHANNELUNIQUE` (`NAME`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `column_pair` (
CREATE TABLE `COLUMN_PAIR` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`SOURCE_COLUMN` varchar(200) DEFAULT NULL,
`TARGET_COLUMN` varchar(200) DEFAULT NULL,
Expand All @@ -59,7 +59,7 @@ CREATE TABLE `column_pair` (
KEY `idx_DATA_MEDIA_PAIR_ID` (`DATA_MEDIA_PAIR_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `column_pair_group` (
CREATE TABLE `COLUMN_PAIR_GROUP` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`DATA_MEDIA_PAIR_ID` bigint(20) NOT NULL,
`COLUMN_PAIR_CONTENT` text DEFAULT NULL,
Expand All @@ -69,29 +69,7 @@ CREATE TABLE `column_pair_group` (
KEY `idx_DATA_MEDIA_PAIR_ID` (`DATA_MEDIA_PAIR_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `conflict_detail_stat` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`PIPELINE_ID` bigint(20) DEFAULT NULL,
`PAIR_ID` bigint(20) DEFAULT NULL,
`COLUMN_NAME` varchar(200) DEFAULT NULL,
`CONFLICT_TYPE` varchar(200) DEFAULT NULL,
`DESCRIPTION` varchar(2000) DEFAULT NULL,
`GMT_CREATE` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`GMT_MODIFIED` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `conflict_stat` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`PIPELINE_ID` bigint(20) DEFAULT NULL,
`PAIR_ID` bigint(20) DEFAULT NULL,
`COUNT` bigint(20) DEFAULT NULL,
`GMT_CREATE` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`GMT_MODIFIED` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `data_media` (
CREATE TABLE `DATA_MEDIA` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`NAME` varchar(200) NOT NULL,
`NAMESPACE` varchar(200) NOT NULL,
Expand All @@ -103,7 +81,7 @@ CREATE TABLE `data_media` (
UNIQUE KEY `DATAMEDIAUNIQUE` (`NAME`,`NAMESPACE`,`DATA_MEDIA_SOURCE_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `data_media_pair` (
CREATE TABLE `DATA_MEDIA_PAIR` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`PULLWEIGHT` bigint(20) DEFAULT NULL,
`PUSHWEIGHT` bigint(20) DEFAULT NULL,
Expand All @@ -119,7 +97,7 @@ CREATE TABLE `data_media_pair` (
KEY `idx_PipelineID` (`PIPELINE_ID`,`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `data_media_source` (
CREATE TABLE `DATA_MEDIA_SOURCE` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`NAME` varchar(200) NOT NULL,
`TYPE` varchar(20) NOT NULL,
Expand All @@ -130,7 +108,7 @@ CREATE TABLE `data_media_source` (
UNIQUE KEY `DATAMEDIASOURCEUNIQUE` (`NAME`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `delay_stat` (
CREATE TABLE `DELAY_STAT` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`DELAY_TIME` int(21) NOT NULL,
`DELAY_NUMBER` bigint(20) NOT NULL,
Expand All @@ -143,7 +121,7 @@ CREATE TABLE `delay_stat` (
KEY `idx_GmtCreate_id` (`GMT_CREATE`,`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `log_record` (
CREATE TABLE `LOG_RECORD` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`NID` varchar(200) DEFAULT NULL,
`CHANNEL_ID` varchar(200) NOT NULL,
Expand All @@ -157,7 +135,7 @@ CREATE TABLE `log_record` (
KEY `logRecord_pipelineId` (`PIPELINE_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `node` (
CREATE TABLE `NODE` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`NAME` varchar(200) NOT NULL,
`IP` varchar(32) NOT NULL,
Expand All @@ -170,7 +148,7 @@ CREATE TABLE `node` (
UNIQUE KEY `NODEUNIQUE` (`NAME`,`IP`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `pipeline` (
CREATE TABLE `PIPELINE` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`NAME` varchar(200) NOT NULL,
`DESCRIPTION` varchar(200) DEFAULT NULL,
Expand All @@ -183,7 +161,7 @@ CREATE TABLE `pipeline` (
KEY `idx_ChannelID` (`CHANNEL_ID`,`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `pipeline_node_relation` (
CREATE TABLE `PIPELINE_NODE_RELATION` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`NODE_ID` bigint(20) NOT NULL,
`PIPELINE_ID` bigint(20) NOT NULL,
Expand All @@ -194,15 +172,15 @@ CREATE TABLE `pipeline_node_relation` (
KEY `idx_PipelineID` (`PIPELINE_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `system_parameter` (
CREATE TABLE `SYSTEM_PARAMETER` (
`ID` bigint(20) unsigned NOT NULL,
`VALUE` varchar(1000) DEFAULT NULL,
`GMT_CREATE` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`GMT_MODIFIED` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `table_history_stat` (
CREATE TABLE `TABLE_HISTORY_STAT` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`FILE_SIZE` bigint(20) DEFAULT NULL,
`FILE_COUNT` bigint(20) DEFAULT NULL,
Expand All @@ -220,7 +198,7 @@ CREATE TABLE `table_history_stat` (
KEY `idx_GmtCreate_id` (`GMT_CREATE`,`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `table_stat` (
CREATE TABLE `TABLE_STAT` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`FILE_SIZE` bigint(20) NOT NULL,
`FILE_COUNT` bigint(20) NOT NULL,
Expand All @@ -235,7 +213,7 @@ CREATE TABLE `table_stat` (
KEY `idx_PipelineID_DataMediaPairID` (`PIPELINE_ID`,`DATA_MEDIA_PAIR_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `throughput_stat` (
CREATE TABLE `THROUGHPUT_STAT` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`TYPE` varchar(20) NOT NULL,
`NUMBER` bigint(20) NOT NULL,
Expand All @@ -251,7 +229,7 @@ CREATE TABLE `throughput_stat` (
KEY `idx_GmtCreate_id` (`GMT_CREATE`,`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `user` (
CREATE TABLE `USER` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`USERNAME` varchar(20) NOT NULL,
`PASSWORD` varchar(20) NOT NULL,
Expand All @@ -264,7 +242,7 @@ CREATE TABLE `user` (
UNIQUE KEY `USERUNIQUE` (`USERNAME`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `data_matrix` (
CREATE TABLE `DATA_MATRIX` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`GROUP_KEY` varchar(200) DEFAULT NULL,
`MASTER` varchar(200) DEFAULT NULL,
Expand All @@ -277,5 +255,5 @@ CREATE TABLE `data_matrix` (
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8


insert into user(ID,USERNAME,PASSWORD,AUTHORIZETYPE,DEPARTMENT,REALNAME,GMT_CREATE,GMT_MODIFIED) values(null,'admin','801fc357a5a74743894a','ADMIN','admin','admin',now(),now());
insert into user(ID,USERNAME,PASSWORD,AUTHORIZETYPE,DEPARTMENT,REALNAME,GMT_CREATE,GMT_MODIFIED) values(null,'guest','471e02a154a2121dc577','OPERATOR','guest','guest',now(),now());
insert into USER(ID,USERNAME,PASSWORD,AUTHORIZETYPE,DEPARTMENT,REALNAME,GMT_CREATE,GMT_MODIFIED) values(null,'admin','801fc357a5a74743894a','ADMIN','admin','admin',now(),now());
insert into USER(ID,USERNAME,PASSWORD,AUTHORIZETYPE,DEPARTMENT,REALNAME,GMT_CREATE,GMT_MODIFIED) values(null,'guest','471e02a154a2121dc577','OPERATOR','guest','guest',now(),now());

0 comments on commit 9453662

Please sign in to comment.