DROP TABLE autofan_account ;
DROP TABLE autofan_act ;
DROP TABLE autofan_act_apply;
DROP TABLE autofan_act_detail;
DROP TABLE autofan_act_member;
DROP TABLE autofan_act_pay;
DROP TABLE autofan_act_real_route;
DROP TABLE autofan_act_route;
DROP TABLE autofan_club;
DROP TABLE autofan_comment;
DROP TABLE autofan_follow_club;
DROP TABLE autofan_img;


create table autofan_account (
id                 bigint(20)   comment 'Ì«ÆœÑó¹«¹²ÕÊºÅID            ',
nickname           varchar(100) comment 'êÇ³Æ                        ',
faceUrl            varchar(255) comment 'Í·Ïñ                        ',
faceUrlLarge       varchar(255) comment 'Í·Ïñ                        ',
loginType          smallint     comment 'µÇÂŒÀàÐÍ:sina¡¢tencent      ',
openId             bigint(20)   comment '¿ª·ÅÆœÌšID                  ',
mobile             varchar(20)  comment 'ÊÖ»ú                        ',
licensePlate       varchar(20)  comment '³µÅÆ                        ',
areaId             int          comment 'µØÇø                        ',
censor             bigint(20)   comment 'CENSOR                      ',
censorDate         datetime     comment 'CENSOR_DATE                 ',
censorStatus       smallint     comment 'CENSOR_STATUS               ',
pendingTime        int          comment 'PENDING_TIME                ',
hasAudit           smallint     comment 'HAS_AUDIT                   ',
PRIMARY KEY (id)
)ENGINE = InnoDB; 


create table autofan_act (
id                bigint(20)    comment '»î¶¯ID       ',    
name              varchar(100)  comment '»î¶¯Ãû³Æ     ',      
startDate         datetime      comment '¿ªÊŒÊ±Œä     ', 
endDate           datetime      comment 'œáÊøÊ±Œä     ', 
status            smallint      comment '×ŽÌ¬         ',    
clubId            bigint(20)    comment '             ',    
areaId            int           comment 'µØÇø         ',       
hasRecommend      smallint      comment 'ÊÇ·ñÍÆŒö     ',      
recommendDate     datetime      comment 'ÍÆŒöÊ±Œä     ',     
createdBy         bigint(20)    comment 'uid          ',       
createDate        datetime      comment 'ŽŽœšÊ±Œä     ',      
updateBy          bigint(20)    comment 'uid          ',         
lastUpdateDate    datetime      comment '×îºóÐÞžÄÊ±Œä ',        
censor            bigint(20)    comment 'CENSOR       ',         
censorDate        datetime      comment 'CENSOR_DATE  ',          
censorStatus      smallint      comment 'CENSOR_STATUS',            
pendingTime       int           comment 'PENDING_TIME ',             
hasAudit          smallint      comment 'HAS_AUDIT    ',     
PRIMARY KEY (id)
)ENGINE = InnoDB; 

create table autofan_actDetail(
id                bigint(20)    comment 'ID       ',    
actId             bigint(20)    comment '»î¶¯ID       ',    
detail            varchar(4000) comment '»î¶¯ÏêÇé     ',
PRIMARY KEY (id)
)ENGINE = InnoDB; 


create table autofan_actMember (
id                 bigint(20)    comment 'ID                    ',    
actId              bigint(20)    comment '»î¶¯ID                ',        
uid                bigint(20)    comment 'ÓÃ»§ID                ',        
type               smallint      comment 'Éí·Ý(manager,member)  ',                      
mobile             varchar(20)   comment 'ÊÖ»ú                  ',      
licensePlate       varchar(20)   comment '³µÅÆ                  ',      
status             smallint      comment '×ŽÌ¬£º1£ºÕý³£¡¢0£ºÉŸ³ý',                        
createdBy          bigint(20)    comment 'ACCOUNT_ID            ',            
createDate         datetime      comment 'ŽŽœšÊ±Œä              ',          
updateBy           bigint(20)    comment 'ACCOUNT_ID            ',            
lastUpdateDate     datetime      comment '×îºóÐÞžÄÊ±Œä          ',              
PRIMARY KEY (id)
)ENGINE = InnoDB; 



create table autofan_actPay (
id                bigint(20)    comment '·ÑÓÃID  ', 
actId             bigint(20)    comment '»î¶¯ID  ', 
pay               smallint      comment '·ÑÓÃ    ', 
memo              varchar(100)  comment '·ÑÓÃÃèÊö', 
createDate        datetime      comment 'ŽŽœšÊ±Œä', 
uid               bigint(20)    comment 'ŽŽœšÈË  ',
PRIMARY KEY (id)
)ENGINE = InnoDB; 

create table autofan_actRoute (
id                bigint(20)    comment '»î¶¯ID                                            ',    
actId             bigint(20)    comment '»î¶¯ID                                            ',    
seq               smallint      comment 'Ë³ÐòºÅ                                            ',    
routeName         varchar(100)  comment 'µØµãÃû³Æ                                          ',  
preLongitude      double(15,10) comment 'ÊÖ»úÉè±žGPSŸ­¶È                                   ',  
preLatitude       double(15,10) comment 'ÊÖ»úÉè±žGPSÎ³¶È                                   ',      
longitude         double(15,10) comment '°Ù¶ÈµØÍŒŸ­¶È                                      ',  
latitude          double(15,10) comment '°Ù¶ÈµØÍŒÎ³¶È                                      ',  
addr              varchar(100)  comment 'µØÖ·Ãû³Æ                                          ',      
province          varchar(50)   comment 'Ê¡·ÝÃû³Æ                                          ',      
city              varchar(50)   comment '³ÇÊÐÃû³Æ                                          ',      
distict           varchar(50)   comment 'ÇøÏØÃû³Æ                                          ',      
areaId            int           comment 'µØÇøid                                            ',    
type              varchar(10)   comment 'ÀàÐÍ£ºstart, end, pass ·Ö±ðŽú±íÆðµã£¬Ÿ­Í£µã£¬ÖÕµã ',  
memo              varchar(100)  comment '±ž×¢                                              ',  
PRIMARY KEY (id)
)ENGINE = InnoDB; 

create table autofan_actApply (
id                bigint(20)    comment 'ID                    ',    
actId             bigint(20)   comment '»î¶¯ID                 ',  
uid               bigint(20)   comment 'ÓÃ»§ID                 ',  
verifyStr         varchar(100) comment '»î¶¯ÑéÖ€ÃÜÂë           ',        
mobile            varchar(20)  comment 'ÊÖ»ú                   ',
licensePlate      varchar(20)  comment '³µÅÆ                   ',
status            smallint     comment '×ŽÌ¬£º1£ºÕý³£¡¢0£ºÉŸ³ý ',                  
createdBy         bigint(20)   comment 'ACCOUNT_ID             ',      
createDate        datetime     comment 'ŽŽœšÊ±Œä               ',    
updateBy          bigint(20)   comment 'ACCOUNT_ID             ',      
lastUpdateDate    datetime     comment '×îºóÐÞžÄÊ±Œä           ',        
PRIMARY KEY (id)
)ENGINE = InnoDB; 

create table autofan_actRealRoute (
id                 bigint(20)    comment 'ID        ',    
actId              bigint(20)    comment '»î¶¯ID    ',  
uid                bigint(20)    comment 'ÓÃ»§ID    ',  
preLongitude      double(15,10) comment 'ÊÖ»úÉè±žGPSŸ­¶È  ',  
preLatitude       double(15,10) comment 'ÊÖ»úÉè±žGPSÎ³¶È  ',      
longitude         double(15,10) comment '°Ù¶ÈµØÍŒŸ­¶È     ',  
latitude          double(15,10) comment '°Ù¶ÈµØÍŒÎ³¶È     ',  
location           varchar(100)  comment 'Î»ÖÃËµÃ÷  ',
createdBy          bigint(20)    comment 'ACCOUNT_ID',      
createDate         datetime      comment 'ŽŽœšÊ±Œä  ',    
PRIMARY KEY (id)
)ENGINE = InnoDB; 



create table autofan_club (
id                 bigint(20)   comment '³µÓÑ»áID                      ',
name               varchar(100) comment '³µÓÑ»áÃû³Æ                    ',
prefix             varchar(10)  comment 'ÆŽÒôÊ××ÖÄž                    ',
logo               varchar(255) comment '³µÓÑ»áLOGO                    ',
logoUrl            varchar(255) comment '³µÓÑ»áLOGOŽóÍŒ                ',
uid                bigint(20)   comment 'ŽŽœšÕß                        ',
createDate         datetime     comment 'ŽŽœšÊ±Œä                      ',
PRIMARY KEY (id)
)ENGINE = InnoDB; 


create table autofan_followClub (
id                 bigint(20)   comment '',
uid                bigint(20)   comment 'ACCOUNT_ID                   ',
clubId             bigint(20)   comment '³µÓÑ»áID                     ',
createDate         datetime     comment '                             ',
PRIMARY KEY (id)
)ENGINE = InnoDB; 



create table autofan_img  (
id                bigint(20)    comment 'ÍŒÆ¬ID                        ',
actId             bigint(20)    comment '»î¶¯ID                        ',
imgUrl            varchar(255)  comment 'Ô­ÍŒURL                       ',
imgUrlMiddle      varchar(255)  comment 'ÖÐÍŒURL                       ',
imgUrlSmall       varchar(255)  comment 'Ð¡ÍŒURL                       ',
memo              varchar(255)  comment 'ÍŒÆ¬ÃèÊö                      ',
createDate        datetime      comment 'ŽŽœšÊ±Œä                      ',
uid               bigint(20)    comment 'ACCOUNT_ID                    ',
censor            bigint(20)    comment 'CENSOR                        ',
censorDate        datetime      comment 'CENSOR_DATE                   ',
censorStatus      smallint      comment 'CENSOR_STATUS                 ',
pendingTime       int           comment 'PENDING_TIME                  ',
hasAudit          smallint      comment 'HAS_AUDIT                     ',
PRIMARY KEY (id)
)ENGINE = InnoDB; 



create table autofan_comment (
id                 bigint(20)   comment 'ÆÀÂÛID                        ',
type               smallint     comment 'ÆÀÂÛÀàÐÍ                      ',
ownerId            bigint(20)   comment 'ÆÀÂÛ¶ÔÏóID                    ',
content            varchar(500) comment 'ÆÀÂÛÕýÎÄ                      ',
createDate         datetime     comment 'ŽŽœšÊ±Œä                      ',
uid                bigint(20)   comment '·¢±íÕß                        ',
lastUpdateDate     datetime     comment '×îºóÐÞžÄÊ±Œä                  ',
censor             bigint(20)   comment 'CENSOR                        ',
censorDate         datetime     comment 'CENSOR_DATE                   ',
censorStatus       smallint     comment 'CENSOR_STATUS                 ',
pendingTime        int          comment 'PENDING_TIME                  ',
hasAudit           smallint     comment 'HAS_AUDIT                     ',
PRIMARY KEY (id)
)ENGINE = InnoDB; 

CREATE UNIQUE INDEX actMemberActUid ON autofan_actMember (actId, uid)   ;


/*Table structure for table `autofan_keygen` */


CREATE TABLE `autofan_keygen` (
  `TABLE_NAME` varchar(50) NOT NULL,
  `LAST_USED_ID` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`TABLE_NAME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table `autofan_keygen` */

insert  into `autofan_keygen`(`TABLE_NAME`,`LAST_USED_ID`) values ('autofan_act',40),('autofan_actapply',0),('autofan_actdetail',40),('autofan_actmember',0),('autofan_actpay',0),('autofan_actrealroute',30),('autofan_actroute',30),('autofan_comment',0),('autofan_img',0);

/*Table structure for table `sec_acl` */


CREATE TABLE `sec_acl` (
  `RESOURCE_ID` varchar(50) NOT NULL DEFAULT '',
  `ROLE_ID` bigint(20) NOT NULL DEFAULT '0',
  `USER_ID` bigint(20) NOT NULL DEFAULT '0',
  `APPLICATION` varchar(50) NOT NULL DEFAULT '',
  `ACCOUNT_ID` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`RESOURCE_ID`,`ROLE_ID`,`USER_ID`,`APPLICATION`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table `sec_acl` */

/*Table structure for table `sec_function` */


CREATE TABLE `sec_function` (
  `ID` bigint(20) NOT NULL DEFAULT '0',
  `NAME` varchar(50) DEFAULT NULL,
  `RANK` bigint(20) DEFAULT NULL,
  `APPLICATION` varchar(50) DEFAULT NULL,
  `DISPLAY_ORDER` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table `sec_function` */

/*Table structure for table `sec_role` */


CREATE TABLE `sec_role` (
  `ID` bigint(20) NOT NULL DEFAULT '0',
  `NAME` varchar(50) DEFAULT NULL,
  `DESCRIPTION` varchar(200) DEFAULT NULL,
  `RANK` bigint(20) DEFAULT NULL,
  `APPLICATION` varchar(50) DEFAULT NULL,
  `DISPLAY_ORDER` bigint(20) DEFAULT '0',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table `sec_role` */

/*Table structure for table `sec_role_function` */


CREATE TABLE `sec_role_function` (
  `ROLE_ID` bigint(20) NOT NULL DEFAULT '0',
  `FUNCTION_ID` bigint(20) NOT NULL DEFAULT '0',
  `APPLICATION` varchar(50) NOT NULL DEFAULT '',
  PRIMARY KEY (`ROLE_ID`,`FUNCTION_ID`,`APPLICATION`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;




CREATE TABLE `autofan_admin` (
  `ID` bigint(20) NOT NULL,
  `ACCOUNT` varchar(255) NOT NULL,
  `CREATEAT` date DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table `autofan_admin` */

insert  into `autofan_admin`(`ID`,`ACCOUNT`,`CREATEAT`) values (2,'admin','2012-02-22');