CREATE DATABASE `yxt_supervise_dbcenter` /*!40100 DEFAULT mb4 */

DROP TABLE IF EXISTS `enp_info`;
CREATE TABLE `enp_info`  (
`id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
`sid` varchar(64) NOT NULL COMMENT 'sid',
`lockVersion` int(0) NULL DEFAULT 0 COMMENT '版本锁',
`createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`modifyTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '修改时间',
`isEnable` int(0) NULL DEFAULT 1 COMMENT '是否可用：1可用，0不可用',
`state` int(0) NULL DEFAULT 1 COMMENT '状态',
`isDelete` int(0) NULL DEFAULT 0 COMMENT '是否删除：0未删除，1已删除',
`remarks` varchar(255) NULL DEFAULT NULL COMMENT '备注',
`createBySid` varchar(64) NULL DEFAULT NULL COMMENT '创建人sid',
`updateBySid` varchar(64) NULL DEFAULT NULL COMMENT '修改人sid',

`name` varchar(100) NULL DEFAULT NULL COMMENT '企业名称',
`code` varchar(100) NULL DEFAULT NULL COMMENT '企业编码',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='企业/集团信息' ROW_FORMAT = Dynamic;

INSERT INTO `enp_info` (`sid`, `name`, `code`) VALUES
	('1001', '中鸿记', '1001');
	

DROP TABLE IF EXISTS `enp_brand`;
CREATE TABLE `enp_brand`  (
`id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
`sid` varchar(64) NOT NULL COMMENT 'sid',
`lockVersion` int(0) NULL DEFAULT 0 COMMENT '版本锁',
`createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`modifyTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '修改时间',
`isEnable` int(0) NULL DEFAULT 1 COMMENT '是否可用：1可用，0不可用',
`state` int(0) NULL DEFAULT 1 COMMENT '状态',
`isDelete` int(0) NULL DEFAULT 0 COMMENT '是否删除：0未删除，1已删除',
`remarks` varchar(255) NULL DEFAULT NULL COMMENT '备注',
`createBySid` varchar(64) NULL DEFAULT NULL COMMENT '创建人sid',
`updateBySid` varchar(64) NULL DEFAULT NULL COMMENT '修改人sid',

`code` varchar(100) NULL DEFAULT NULL COMMENT '品牌编码',
`name` varchar(100) NULL DEFAULT NULL COMMENT '品牌名称',
`enpSid` varchar(100) NULL DEFAULT NULL COMMENT '所属企业SID',
`enpCode` varchar(100) NULL DEFAULT NULL COMMENT '所属企业编码',
`enpName` varchar(100) NULL DEFAULT NULL COMMENT '所属企业名称',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='企业品牌信息' ROW_FORMAT = Dynamic;

INSERT INTO `enp_brand` (`sid`, `name`, `code`, `enpSid`, `enpCode`, `enpName`) VALUES
	('100101', '熟溢香', '100101', '1001', '1001', '中鸿记'),
	('100102', '馍馍卤', '100102', '1001', '1001', '中鸿记');

DROP TABLE IF EXISTS `enp_store`;
CREATE TABLE `enp_store`  (
`id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
`sid` varchar(64) NOT NULL COMMENT 'sid',
`lockVersion` int(0) NULL DEFAULT 0 COMMENT '版本锁',
`createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`modifyTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '修改时间',
`isEnable` int(0) NULL DEFAULT 1 COMMENT '是否可用：1可用，0不可用',
`state` int(0) NULL DEFAULT 1 COMMENT '状态',
`isDelete` int(0) NULL DEFAULT 0 COMMENT '是否删除：0未删除，1已删除',
`remarks` varchar(255) NULL DEFAULT NULL COMMENT '备注',
`createBySid` varchar(64) NULL DEFAULT NULL COMMENT '创建人sid',
`updateBySid` varchar(64) NULL DEFAULT NULL COMMENT '修改人sid',

`code` varchar(100) NULL DEFAULT NULL COMMENT '门店编码',
`name` varchar(100) NULL DEFAULT NULL COMMENT '门店名称',
`enpSid` varchar(100) NULL DEFAULT NULL COMMENT '所属企业SID',
`enpCode` varchar(100) NULL DEFAULT NULL COMMENT '所属企业编码',
`enpName` varchar(100) NULL DEFAULT NULL COMMENT '所属企业名称',
`brandSid` varchar(100) NULL DEFAULT NULL COMMENT '所属品牌SID',
`brandCode` varchar(100) NULL DEFAULT NULL COMMENT '所属品牌编码',
`brandName` varchar(100) NULL DEFAULT NULL COMMENT '所属品牌名称',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='企业门店信息' ROW_FORMAT = Dynamic;

INSERT INTO `enp_store` (`sid`, `name`, `code`, `enpSid`, `enpCode`, `enpName`, `brandSid`, `brandCode`, `brandName`) VALUES
	('10010101', '熟溢香振头店', '10010101', '1001', '1001', '中鸿记','100101', '100101', '熟溢香'),
	('10010102', '馍馍卤振岗店', '10010102', '1001', '1001', '中鸿记','100102', '100102', '馍馍卤'),
	('10010103', '馍馍卤雅清街店', '10010103', '1001', '1001', '中鸿记','100102', '100102', '馍馍卤');

DROP TABLE IF EXISTS `dishes_info`;
CREATE TABLE `dishes_info`  (
`id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
`sid` varchar(64) NOT NULL COMMENT 'sid',
`lockVersion` int(0) NULL DEFAULT 0 COMMENT '版本锁',
`createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`modifyTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '修改时间',
`isEnable` int(0) NULL DEFAULT 1 COMMENT '是否可用：1可用，0不可用',
`state` int(0) NULL DEFAULT 1 COMMENT '状态',
`isDelete` int(0) NULL DEFAULT 0 COMMENT '是否删除：0未删除，1已删除',
`remarks` varchar(255) NULL DEFAULT NULL COMMENT '备注',
`createBySid` varchar(64) NULL DEFAULT NULL COMMENT '创建人sid',
`updateBySid` varchar(64) NULL DEFAULT NULL COMMENT '修改人sid',

`code` varchar(100) NULL DEFAULT NULL COMMENT '菜品编码',
`name` varchar(100) NULL DEFAULT NULL COMMENT '菜品名称',
`unit` varchar(100) NULL DEFAULT NULL COMMENT '规格单位',
`sellingPrice` double(12,2) NULL DEFAULT NULL COMMENT '销售单价',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='菜品信息' ROW_FORMAT = Dynamic;



DROP TABLE IF EXISTS `material_info`;
CREATE TABLE `material_info`  (
`id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
`sid` varchar(64) NOT NULL COMMENT 'sid',
`lockVersion` int(0) NULL DEFAULT 0 COMMENT '版本锁',
`createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`modifyTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '修改时间',
`isEnable` int(0) NULL DEFAULT 1 COMMENT '是否可用：1可用，0不可用',
`state` int(0) NULL DEFAULT 1 COMMENT '状态',
`isDelete` int(0) NULL DEFAULT 0 COMMENT '是否删除：0未删除，1已删除',
`remarks` varchar(255) NULL DEFAULT NULL COMMENT '备注',
`createBySid` varchar(64) NULL DEFAULT NULL COMMENT '创建人sid',
`updateBySid` varchar(64) NULL DEFAULT NULL COMMENT '修改人sid',

`code` varchar(100) NULL DEFAULT NULL COMMENT '物料编码',
`name` varchar(100) NULL DEFAULT NULL COMMENT '物料名称',
`unit` varchar(100) NULL DEFAULT NULL COMMENT '规格单位',
`taxPrice` double(12,2) NULL DEFAULT NULL COMMENT '含税单价',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='物料信息' ROW_FORMAT = Dynamic;


DROP TABLE IF EXISTS `crawl_sales_amount`;
CREATE TABLE `crawl_sales_amount`  (
`id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id',

`dataDate` varchar(100) NULL DEFAULT NULL COMMENT '数据日期',
`storeName` varchar(100) NULL DEFAULT NULL COMMENT '门店名称',
`salesAmount` double(12,2) NULL DEFAULT NULL COMMENT '实收金额',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='抓取的营业指标数据' ROW_FORMAT = Dynamic;


DROP TABLE IF EXISTS `crawl_sales_dishes`;
CREATE TABLE `crawl_sales_dishes`  (
`id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id',

`dataDate` varchar(100) NULL DEFAULT NULL COMMENT '数据日期',
`storeName` varchar(100) NULL DEFAULT NULL COMMENT '门店名称',
`dishesName` varchar(100) NULL DEFAULT NULL COMMENT '菜品名称',
`unit` varchar(100) NULL DEFAULT NULL COMMENT '规格单位',
`salesCount` double(12,2) NULL DEFAULT NULL COMMENT '数量',
`salesPrice` double(12,2) NULL DEFAULT NULL COMMENT '单价',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='抓取的菜品销量数据' ROW_FORMAT = Dynamic;



DROP TABLE IF EXISTS `crawl_purchase`;
CREATE TABLE `crawl_purchase`  (
`id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id',

`dataDate` varchar(100) NULL DEFAULT NULL COMMENT '数据日期',
`storeName` varchar(100) NULL DEFAULT NULL COMMENT '门店名称',
`purchaseDate` varchar(100) NULL DEFAULT NULL COMMENT '采购日期',
`materialName` varchar(100) NULL DEFAULT NULL COMMENT '物料名称',
`unit` varchar(100) NULL DEFAULT NULL COMMENT '规格单位',
`purchaseCount` double(12,2) NULL DEFAULT NULL COMMENT '采购数量',
`taxPrice` double(12,2) NULL DEFAULT NULL COMMENT '含税单价',
`purchaseAmount` double(12,2) NULL DEFAULT NULL COMMENT '采购金额',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='抓取的采购数据' ROW_FORMAT = Dynamic;


DROP TABLE IF EXISTS `zhj_report_datacount`;
CREATE TABLE `zhj_report_datacount`  (
`id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
`sid` varchar(64) NOT NULL COMMENT 'sid',
`createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`modifyTime` timestamp(0) NULL DEFAULT NULL COMMENT '修改时间',
`remarks` varchar(255) NULL DEFAULT NULL COMMENT '备注',

`dataDate` varchar(100) NULL DEFAULT NULL COMMENT '数据日期',
`dataYear` int(10) NOT NULL DEFAULT 1 COMMENT '年份',
`dataMonth` int(10) NOT NULL DEFAULT 1 COMMENT '月份',
`dataDay` int(10) NOT NULL DEFAULT 1 COMMENT '天',
`typeNo` int(10) NOT NULL DEFAULT 1 COMMENT '序号：类型号,1=米类，2=面类，3=油类',
`typeName` varchar(100) NULL DEFAULT NULL COMMENT '类型名称：1=米类，2=面类，3=油类',

`allMonth` double(12,2) NULL DEFAULT 0 COMMENT '所有企业月累计',
`allMonthPre` double(12,2) NULL DEFAULT 0 COMMENT '所有企业上月同期累计',
`allMonthIncrement` double(12,2) NULL DEFAULT 0 COMMENT '所有企业增长量',
`caterMonth` double(12,2) NULL DEFAULT 0 COMMENT '餐饮企业月累计',
`caterMonthPre` double(12,2) NULL DEFAULT 0 COMMENT '餐饮企业上月同期累计',
`caterMonthIncrement` double(12,2) NULL DEFAULT 0 COMMENT '餐饮企业月增长量',
`targetData` double(12,2) NULL DEFAULT 0 COMMENT '月份任务数',
`targetDataRate` varchar(100) NULL DEFAULT NULL COMMENT '月份任务数完成百分比',
`allData` double(12,2) NULL DEFAULT 0 COMMENT '累计订货量',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='业务总体数据' ROW_FORMAT = Dynamic;

insert into zhj_report_datacount(sid,createTime,dataDate,dataYear,dataMonth,dataDay,
`typeNo`,`typeName`,
`allMonth`,`allMonthPre`,`allMonthIncrement`,
`caterMonth`,`caterMonthPre`,`caterMonthIncrement`,
`targetData`,`targetDataRate`,`allData`)
values 
(uuid(),now(),'2023-11-15','2023','11','15','1','米类','99248','47998','51250','49433','36838','12595','190000','52.24%','542701'),
(uuid(),now(),'2023-11-15','2023','11','15','2','面类','153210','112980','40230','63895','65195','-1300','420000','36.48%','1368695'),
(uuid(),now(),'2023-11-15','2023','11','15','3','油类','446330','517105','-70775','343410','267385','76025','1500000','29.76%','3709524.3');


DROP TABLE IF EXISTS `zhj_report_ranking`;
CREATE TABLE `zhj_report_ranking`  (
`id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
`sid` varchar(64) NOT NULL COMMENT 'sid',
`createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`modifyTime` timestamp(0) NULL DEFAULT NULL COMMENT '修改时间',
`remarks` varchar(255) NULL DEFAULT NULL COMMENT '备注',

`dataDate` varchar(100) NULL DEFAULT NULL COMMENT '数据日期',
`dataYear` int(10) NOT NULL DEFAULT 1 COMMENT '年份',
`dataMonth` int(10) NOT NULL DEFAULT 1 COMMENT '月份',
`dataDay` int(10) NOT NULL DEFAULT 1 COMMENT '天',

`sortNo` int(10) NOT NULL DEFAULT 1 COMMENT '排名',
`bankName` varchar(100) NULL DEFAULT NULL COMMENT '支行名称',

`currentDate` varchar(100) NULL DEFAULT NULL COMMENT '当天日期',
`currentDateData` double(12,2) NULL DEFAULT 0 COMMENT '当天完成情况',

`allMonth` double(12,2) NULL DEFAULT 0 COMMENT '本月累计',
`allMonthPre` double(12,2) NULL DEFAULT 0 COMMENT '上月同期',
`allMonthIncrement` double(12,2) NULL DEFAULT 0 COMMENT '较上月同期',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='支行订单量完成情况排名' ROW_FORMAT = Dynamic;

insert into zhj_report_ranking(sid,createTime,dataDate,dataYear,dataMonth,dataDay,
`sortNo`,`bankName`,
`currentDate`,`currentDateData`,
`allMonth`,`allMonthPre`,`allMonthIncrement`)
values 
(uuid(),now(),'2023-11-15','2023','11','15','1','孙村支行','2023-11-16','7000','25572','32514','-6942'),
(uuid(),now(),'2023-11-15','2023','11','15','2','中华大街支行','2023-11-16','16','19570','14405','5165'),
(uuid(),now(),'2023-11-15','2023','11','15','3','营业部','2023-11-16','0','14570','6804','7766'),
(uuid(),now(),'2023-11-15','2023','11','15','4','建华大街支行','2023-11-16','0','9803','2112','7691'),
(uuid(),now(),'2023-11-15','2023','11','15','5','留营支行','2023-11-16','270','8084','1915','6169'),
(uuid(),now(),'2023-11-15','2023','11','15','6','维明街支行','2023-11-16','2000','8009','2200','5809'),
(uuid(),now(),'2023-11-15','2023','11','15','7','西三庄支行','2023-11-16','94','7984','6074','1910'),
(uuid(),now(),'2023-11-15','2023','11','15','8','槐安东路分理处','2023-11-16','108','7774','4506','3268'),
(uuid(),now(),'2023-11-15','2023','11','15','9','杜北支行','2023-11-16','0','7185','7090','95'),
(uuid(),now(),'2023-11-15','2023','11','15','10','跃进路支行','2023-11-16','221','7147','9730','-2583'),
(uuid(),now(),'2023-11-15','2023','11','15','11','谈固北大街支行','2023-11-16','0','6034','4570','1464'),
(uuid(),now(),'2023-11-15','2023','11','15','12','振头支行','2023-11-16','229','5716','3111','2605'),
(uuid(),now(),'2023-11-15','2023','11','15','13','桃园支行','2023-11-16','0','3560','5819','-2259'),
(uuid(),now(),'2023-11-15','2023','11','15','14','金马分理处','2023-11-16','12','3538','5776','-2238'),
(uuid(),now(),'2023-11-15','2023','11','15','15','联盟路支行','2023-11-16','37','1868','5149','-3281'),
(uuid(),now(),'2023-11-15','2023','11','15','16','于底支行','2023-11-16','297','1309','1065','244'),
(uuid(),now(),'2023-11-15','2023','11','15','17','广安大街分理处','2023-11-16','0','1033','4919','-3886'),
(uuid(),now(),'2023-11-15','2023','11','15','18','裕西分理处','2023-11-16','40','1002','2201','-1199');