提交 acc9cac8 编写于 作者: L leon.li

add new table highload_sql

上级 1a55f336
...@@ -26,6 +26,7 @@ import com.dianping.cat.home.dal.alarm.ScheduledReportDao; ...@@ -26,6 +26,7 @@ import com.dianping.cat.home.dal.alarm.ScheduledReportDao;
import com.dianping.cat.home.dal.alarm.ScheduledSubscriptionDao; import com.dianping.cat.home.dal.alarm.ScheduledSubscriptionDao;
import com.dianping.cat.home.dal.report.BaselineDao; import com.dianping.cat.home.dal.report.BaselineDao;
import com.dianping.cat.home.dal.report.DailyReportContentDao; import com.dianping.cat.home.dal.report.DailyReportContentDao;
import com.dianping.cat.home.dal.report.HighloadSqlDao;
import com.dianping.cat.home.dal.report.MonthlyReportContentDao; import com.dianping.cat.home.dal.report.MonthlyReportContentDao;
import com.dianping.cat.home.dal.report.OverloadDao; import com.dianping.cat.home.dal.report.OverloadDao;
import com.dianping.cat.home.dal.report.TopologyGraphDao; import com.dianping.cat.home.dal.report.TopologyGraphDao;
...@@ -187,7 +188,7 @@ public class TaskComponentConfigurator extends AbstractResourceConfigurator { ...@@ -187,7 +188,7 @@ public class TaskComponentConfigurator extends AbstractResourceConfigurator {
all.add(C(ReportTaskBuilder.class, HighLoadSqlUpdater.ID, HighLoadSqlUpdater.class)// all.add(C(ReportTaskBuilder.class, HighLoadSqlUpdater.ID, HighLoadSqlUpdater.class)//
.req(ModelService.class, TransactionAnalyzer.ID)// .req(ModelService.class, TransactionAnalyzer.ID)//
.req(ReportServiceManager.class)); .req(ReportServiceManager.class).req(HighloadSqlDao.class));
all.add(C(ReportRender.class, ReportRenderImpl.class)); all.add(C(ReportRender.class, ReportRenderImpl.class));
......
...@@ -285,6 +285,45 @@ ...@@ -285,6 +285,45 @@
</query> </query>
</query-defs> </query-defs>
</entity> </entity>
<entity name="highload-sql" table="highload_sql" alias="hs">
<member name="id" field="id" value-type="int" length="10" nullable="false" key="true" auto-increment="true" />
<member name="domain" field="domain" value-type="String" length="50" nullable="false" />
<member name="weight" field="weight" value-type="double" length="5" decimal="3" nullable="false" />
<member name="transaction-name-content" field="transaction_name_content" value-type="String" length="65535" nullable="false" />
<member name="date" field="date" value-type="Date" nullable="false" />
<member name="creation-date" field="creation_date" value-type="Date" nullable="false" />
<var name="key-id" value-type="int" key-member="id" />
<primary-key name="PRIMARY" members="id" />
<readsets>
<readset name="FULL" all="true" />
</readsets>
<updatesets>
<updateset name="FULL" all="true" />
</updatesets>
<query-defs>
<query name="find-by-PK" type="SELECT">
<param name="key-id" />
<statement><![CDATA[SELECT <FIELDS/>
FROM <TABLE/>
WHERE <FIELD name='id'/> = ${key-id}]]></statement>
</query>
<query name="insert" type="INSERT">
<statement><![CDATA[INSERT INTO <TABLE/>(<FIELDS/>)
VALUES(<VALUES/>)]]></statement>
</query>
<query name="update-by-PK" type="UPDATE">
<param name="key-id" />
<statement><![CDATA[UPDATE <TABLE/>
SET <FIELDS/>
WHERE <FIELD name='id'/> = ${key-id}]]></statement>
</query>
<query name="delete-by-PK" type="DELETE">
<param name="key-id" />
<statement><![CDATA[DELETE FROM <TABLE/>
WHERE <FIELD name='id'/> = ${key-id}]]></statement>
</query>
</query-defs>
</entity>
<entity name="monthly-report-content" table="monthly_report_content" alias="mrc"> <entity name="monthly-report-content" table="monthly_report_content" alias="mrc">
<member name="report-id" field="report_id" value-type="int" length="10" nullable="false" key="true" /> <member name="report-id" field="report_id" value-type="int" length="10" nullable="false" key="true" />
<member name="content" field="content" value-type="byte[]" length="2147483647" nullable="false" /> <member name="content" field="content" value-type="byte[]" length="2147483647" nullable="false" />
......
...@@ -302,4 +302,19 @@ ...@@ -302,4 +302,19 @@
<entity name="config-modification" table="config_modification" alias="cm"> <entity name="config-modification" table="config_modification" alias="cm">
<member name="creation-date" insert-expr="NOW()" /> <member name="creation-date" insert-expr="NOW()" />
</entity> </entity>
<entity name="highload-sql" table="highload_sql" alias="hs">
<var name="select-date" value-type="Date" />
<member name="creation-date" insert-expr="NOW()" />
<query-defs>
<query name="find-by-date" type="SELECT" multiple="true">
<param name="date" />
<statement><![CDATA[
SELECT <FIELDS/>
FROM <TABLE/>
WHERE <FIELD name='date'/> = ${select-date}
ORDER BY <FIELD name='weight'/> DESC
]]></statement>
</query>
</query-defs>
</entity>
</entities> </entities>
\ No newline at end of file
...@@ -1451,6 +1451,9 @@ ...@@ -1451,6 +1451,9 @@
<requirement> <requirement>
<role>com.dianping.cat.report.service.ReportServiceManager</role> <role>com.dianping.cat.report.service.ReportServiceManager</role>
</requirement> </requirement>
<requirement>
<role>com.dianping.cat.home.dal.report.HighloadSqlDao</role>
</requirement>
</requirements> </requirements>
</component> </component>
<component> <component>
...@@ -2110,6 +2113,16 @@ ...@@ -2110,6 +2113,16 @@
<data-source-name>cat</data-source-name> <data-source-name>cat</data-source-name>
</configuration> </configuration>
</component> </component>
<component>
<role>org.unidal.dal.jdbc.mapping.TableProvider</role>
<role-hint>highload-sql</role-hint>
<implementation>org.unidal.dal.jdbc.mapping.SimpleTableProvider</implementation>
<configuration>
<logical-table-name>highload-sql</logical-table-name>
<physical-table-name>highload_sql</physical-table-name>
<data-source-name>cat</data-source-name>
</configuration>
</component>
<component> <component>
<role>org.unidal.dal.jdbc.mapping.TableProvider</role> <role>org.unidal.dal.jdbc.mapping.TableProvider</role>
<role-hint>monthly-report-content</role-hint> <role-hint>monthly-report-content</role-hint>
...@@ -2223,6 +2236,15 @@ ...@@ -2223,6 +2236,15 @@
</requirement> </requirement>
</requirements> </requirements>
</component> </component>
<component>
<role>com.dianping.cat.home.dal.report.HighloadSqlDao</role>
<implementation>com.dianping.cat.home.dal.report.HighloadSqlDao</implementation>
<requirements>
<requirement>
<role>org.unidal.dal.jdbc.QueryEngine</role>
</requirement>
</requirements>
</component>
<component> <component>
<role>com.dianping.cat.home.dal.report.MonthlyReportContentDao</role> <role>com.dianping.cat.home.dal.report.MonthlyReportContentDao</role>
<implementation>com.dianping.cat.home.dal.report.MonthlyReportContentDao</implementation> <implementation>com.dianping.cat.home.dal.report.MonthlyReportContentDao</implementation>
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<table name="overload"/> <table name="overload"/>
<table name="config_modification"/> <table name="config_modification"/>
<table name="user_define_rule"/> <table name="user_define_rule"/>
<table name="highload_sql"/>
</group> </group>
<group name="alarm" package="com.dianping.cat.home.dal.alarm"> <group name="alarm" package="com.dianping.cat.home.dal.alarm">
<table name="mailRecord"/> <table name="mailRecord"/>
......
...@@ -402,3 +402,13 @@ CREATE TABLE `user_define_rule` ( ...@@ -402,3 +402,13 @@ CREATE TABLE `user_define_rule` (
`creation_date` datetime NOT NULL COMMENT '创建时间', `creation_date` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1242 DEFAULT CHARSET=utf8 COMMENT='用户定义规则表'; ) ENGINE=InnoDB AUTO_INCREMENT=1242 DEFAULT CHARSET=utf8 COMMENT='用户定义规则表';
CREATE TABLE `highload_sql` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增长ID',
`domain` varchar(50) NOT NULL COMMENT '项目名称',
`weight` double NOT NULL COMMENT '权重',
`transaction_name_content` text NOT NULL COMMENT 'TransactionName内容',
`date` datetime NOT NULL COMMENT '统计时间',
`creation_date` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1242 DEFAULT CHARSET=utf8 COMMENT='高消耗SQL记录表';
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册