DROP TABLE IF EXISTS `enforce_deduct_situation`;
CREATE TABLE `enforce_deduct_situation` (
                                                   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
                                                   `situation_content` varchar(1000) DEFAULT NULL COMMENT '情形内容',
                                                   `single_deduct` double DEFAULT NULL COMMENT '单次扣分',
                                                   `create_user_id` varchar(64) DEFAULT NULL,
                                                   `create_user_name` varchar(64) DEFAULT NULL,
                                                   `create_time` datetime DEFAULT NULL,
                                                   `update_user_id` varchar(64) DEFAULT NULL,
                                                   `update_user_name` varchar(128) DEFAULT NULL COMMENT '更新人名称',
                                                   `update_time` datetime DEFAULT NULL,
                                                   PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='扣分情形';


DROP TABLE IF EXISTS `enforce_deduct_record`;
CREATE TABLE `enforce_deduct_record` (
                                            `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
                                            `enforce_org_id` varchar(64) CHARACTER SET utf8 DEFAULT NULL COMMENT '执法机构ID',
                                            `enforce_org_name` varchar(128) CHARACTER SET utf8 DEFAULT NULL COMMENT '执法机构名称',
                                            `executor_id` varchar(200) CHARACTER SET utf8 DEFAULT NULL COMMENT '扣分人员id',
                                            `executor_name` varchar(200) CHARACTER SET utf8 DEFAULT NULL COMMENT '扣分人员名称',
                                            `deduct_resource` varchar(50) CHARACTER SET utf8 DEFAULT NULL COMMENT '扣分来源（SUPERVISE-内部执法监督,REPORT-举报投诉,RECONSIDERATION-复议、诉讼，PATROL-上级巡察、督导、考评,FIREINVESTIGATION-火灾事故调查,OTHER-其他工作中）',
                                            `synopsis` text DEFAULT NULL COMMENT '案件简介',
                                            `deduct_value` double DEFAULT NULL COMMENT '扣分分值',
                                            `deduct_time` datetime DEFAULT NULL COMMENT '扣分时间',
                                            `f_down` text COMMENT '上传文件',
                                            `create_user_id` varchar(64) DEFAULT NULL,
                                            `create_user_name` varchar(64) DEFAULT NULL,
                                            `create_time` datetime DEFAULT NULL,
                                            `update_user_id` varchar(64) DEFAULT NULL,
                                            `update_user_name` varchar(128) DEFAULT NULL COMMENT '更新人名称',
                                            `update_time` datetime DEFAULT NULL,
                                            PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='其他扣分记录';

DROP TABLE IF EXISTS `enforce_deduct_record_situation`;
CREATE TABLE `enforce_deduct_record_situation` (
                                            `deduct_record_id` bigint(20) NOT NULL  COMMENT '扣分记录主键id',
                                            `deduct_situation_id` bigint(20) NOT NULL  COMMENT '扣分情形主键id',
                                            `times` int(10) DEFAULT NULL COMMENT '扣分次数',
                                            `single_deduct` double DEFAULT NULL COMMENT '单次扣分',
                                            `total_deduct` double DEFAULT NULL COMMENT '总扣分(扣分次数*单次扣分)',
                                            `situation_content` varchar(1000) DEFAULT NULL COMMENT '' 情形内容 '',
                                            PRIMARY KEY ( `deduct_record_id`, `deduct_situation_id` ) USING BTREE
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='扣分记录情形关联表';