



DROP TABLE IF EXISTS `T_TRADER`;
CREATE TABLE `T_TRADER` (
  `UUID` varchar(32) NOT NULL COMMENT '主键',
  `PARTY_ID` varchar(32) ,
  `NAME` varchar(32) ,
  `REMARKS` varchar(1024) DEFAULT NULL,
  `SYMBOLS` varchar(64)  COMMENT '代码',
  `PROFIT` double ,
  `PROFIT_RATIO` double ,
  `ORDER_PROFIT` int ,
  `ORDER_LOSS` int ,
  `ORDER_SUM` int ,
  `FOLLOWER_SUM` int ,
  `PROFIT_SHARE_RATIO` double ,
  `FOLLOWER_NOW` int ,
  `FOLLOWER_MAX` int ,
  `STATE` varchar(32) ,
  `CREATE_TIME` datetime ,
  `IMG`  varchar(64),


  PRIMARY KEY (`UUID`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;
create index INDEX_TRADER_PARTY_ID_STATE on T_TRADER (
  `PARTY_ID`,`STATE`
);
create index INDEX_TRADER_NAME on T_TRADER (
  `NAME`
);
create index INDEX_TRADER_STATE on T_TRADER (
  `STATE`
);
create index INDEX_TRADER_PROFIT_STATE on T_TRADER (
 `PROFIT`,`STATE`
);
create index INDEX_TRADER_PROFIT_RATIO_STATE on T_TRADER (
 `PROFIT_RATIO`,`STATE`
);








DROP TABLE IF EXISTS `T_TRADER_FOLLOW_USER`;
CREATE TABLE `T_TRADER_FOLLOW_USER` (
  `UUID` varchar(32) NOT NULL COMMENT '主键',
  `PARTY_ID` varchar(32) DEFAULT NULL,
  `TRADER_PARTY_ID` varchar(32) DEFAULT NULL,
  `SYMBOL` varchar(64) DEFAULT NULL,
  `FOLLOW_TYPE` varchar(32) DEFAULT NULL,
  `VOLUME` double  DEFAULT '0',
  `VOLUME_MAX` double  DEFAULT '0',
  `STOP_PFOFIT` double  DEFAULT '0',
  `STOP_LOSS` double  DEFAULT '0',
  
  
  
  `STATE` varchar(2) DEFAULT NULL,
  `CREATE_TIME` datetime DEFAULT NULL,


  PRIMARY KEY (`UUID`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

create index INDEX_PARTY_ID_TRADER_PARTY_ID_STATE on T_TRADER_FOLLOW_USER (
 `PARTY_ID`,`TRADER_PARTY_ID`,`STATE`
);

create index INDEX_PARTY_ID_TRADER_PARTY_ID on T_TRADER_FOLLOW_USER (
 `PARTY_ID`,`TRADER_PARTY_ID`
);
create index INDEX_PARTY_ID on T_TRADER_FOLLOW_USER (
 `PARTY_ID`
);
create index INDEX_TRADER_PARTY_ID on T_TRADER_FOLLOW_USER (
 `TRADER_PARTY_ID`
);












DROP TABLE IF EXISTS `T_TRADER_FOLLOW_USER_ORDER`;
CREATE TABLE `T_TRADER_FOLLOW_USER_ORDER` (
  `UUID` varchar(32) NOT NULL COMMENT '主键',
  `PARTY_ID` varchar(32) DEFAULT NULL,
  `TRADER_PARTY_ID` varchar(32) DEFAULT NULL,
  `USER_ORDER_NO` varchar(64) DEFAULT NULL,
  `TRADER_ORDER_NO` varchar(64) DEFAULT NULL,
  `CREATE_TIME` datetime DEFAULT NULL,

  PRIMARY KEY (`UUID`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;


create index INDEX_PARTY_ID_TRADER_PARTY_ID on T_TRADER_FOLLOW_USER_ORDER (
 `PARTY_ID`,`TRADER_PARTY_ID`
);
create index INDEX_PARTY_ID on T_TRADER_FOLLOW_USER_ORDER (
 `PARTY_ID`
);
create index INDEX_TRADER_PARTY_ID on T_TRADER_FOLLOW_USER_ORDER (
 `TRADER_PARTY_ID`
);




 ALTER TABLE `T_TRADER`
ADD COLUMN `WEEK_3_PROFIT`  double NULL DEFAULT 0;
 ALTER TABLE `T_TRADER`
ADD COLUMN `WEEK_3_ORDER_AMOUNT`  double NULL DEFAULT 0;
 ALTER TABLE `T_TRADER`
ADD COLUMN `WEEK_3_PROFIT_RATIO`  double NULL DEFAULT 0;
 ALTER TABLE `T_TRADER`
ADD COLUMN `ORDER_AMOUNT`  double NULL DEFAULT 0;


 ALTER TABLE `T_TRADER`
ADD COLUMN `WEEK_3_ORDER_SUM`  int NULL DEFAULT 0;
 ALTER TABLE `T_TRADER`
ADD COLUMN `WEEK_3_ORDER_PROFIT`  int NULL DEFAULT 0;

    
    
    
ALTER TABLE `T_TRADER_FOLLOW_USER`
ADD COLUMN `USERNAME`  varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `PARTY_ID`;




 ALTER TABLE `T_TRADER_FOLLOW_USER_ORDER`
ADD COLUMN `VOLUME`  double NULL DEFAULT 0;


 ALTER TABLE `T_TRADER_FOLLOW_USER_ORDER`
ADD COLUMN `STATE`  varchar(32)  NULL DEFAULT NULL;


 ALTER TABLE `T_TRADER_FOLLOW_USER_ORDER`
MODIFY  COLUMN `USER_ORDER_NO` varchar(64)  NULL DEFAULT NULL;


 ALTER TABLE `T_TRADER_FOLLOW_USER_ORDER`
MODIFY  COLUMN `TRADER_ORDER_NO` varchar(64)  NULL DEFAULT NULL;





DROP TABLE IF EXISTS `T_TRADER_USER`;
CREATE TABLE `T_TRADER_USER` (
  `UUID` varchar(32) NOT NULL COMMENT '主键',
  `PARTY_ID` varchar(32) ,
  `NAME` varchar(32) ,
  `PROFIT` double ,
  `AMOUNT_SUM` double ,
`CREATE_TIME` datetime DEFAULT NULL,

  PRIMARY KEY (`UUID`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

create index INDEX_PARTY_ID on T_TRADER_USER (
 `PARTY_ID`
);
create index INDEX_NAME on T_TRADER_USER (
 `NAME`
);



 ALTER TABLE `T_TRADER_FOLLOW_USER`
ADD COLUMN `PROFIT`  double NULL DEFAULT 0;

 ALTER TABLE `T_TRADER_FOLLOW_USER`
ADD COLUMN `AMOUNT_SUM`  double NULL DEFAULT 0;








 ALTER TABLE `T_TRADER`
ADD COLUMN `DEVIATION_PROFIT`  double NULL DEFAULT 0;
 ALTER TABLE `T_TRADER`
ADD COLUMN `DEVIATION_ORDER_AMOUNT`  double NULL DEFAULT 0;
 ALTER TABLE `T_TRADER`
ADD COLUMN `DEVIATION_PROFIT_RATIO`  double NULL DEFAULT 0;
 ALTER TABLE `T_TRADER`
ADD COLUMN `DEVIATION_ORDER_PROFIT`  double NULL DEFAULT 0;
 ALTER TABLE `T_TRADER`
ADD COLUMN `DEVIATION_ORDER_LOSS`  double NULL DEFAULT 0;
 ALTER TABLE `T_TRADER`
ADD COLUMN `DEVIATION_ORDER_SUM`  double NULL DEFAULT 0;
 ALTER TABLE `T_TRADER`
ADD COLUMN `DEVIATION_FOLLOWER_SUM`  double NULL DEFAULT 0;
 ALTER TABLE `T_TRADER`
ADD COLUMN `DEVIATION_FOLLOWER_NOW`  double NULL DEFAULT 0;
 ALTER TABLE `T_TRADER`
ADD COLUMN `DEVIATION_WEEK_3_PROFIT`  double NULL DEFAULT 0;
 ALTER TABLE `T_TRADER`
ADD COLUMN `DEVIATION_WEEK_3_ORDER_AMOUNT`  double NULL DEFAULT 0;
 ALTER TABLE `T_TRADER`
ADD COLUMN `DEVIATION_WEEK_3_PROFIT_RATIO`  double NULL DEFAULT 0;
 ALTER TABLE `T_TRADER`
ADD COLUMN `DEVIATION_WEEK_3_ORDER_PROFIT`  double NULL DEFAULT 0;
 ALTER TABLE `T_TRADER`
ADD COLUMN `DEVIATION_WEEK_3_ORDER_SUM`  double NULL DEFAULT 0;
