
-- ----------------------------
-- Table structure for __PREFIX__qingdongams_account
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_account`
(
    `id`         int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
    `deposit`    varchar(255) DEFAULT NULL COMMENT '开户行',
    `name`       varchar(255) DEFAULT NULL COMMENT '收款账户名称',
    `account`    varchar(64)  DEFAULT NULL COMMENT '收款账号',
    `status`     tinyint(1) DEFAULT '1' COMMENT '0禁用1正常',
    `type`       enum('public','private') DEFAULT 'public' COMMENT '账户类型public 公账 private私户',
    `create_id`  int(11) DEFAULT NULL COMMENT '创建人',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COMMENT='项目开户行表';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_achievement
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_achievement`
(
    `id`         int(11) NOT NULL AUTO_INCREMENT,
    `name`       varchar(50)    DEFAULT '' COMMENT '名字',
    `obj_id`     int(11) DEFAULT '0' COMMENT '对象ID',
    `type`       tinyint(2) DEFAULT '0' COMMENT '1公司2部门3员工',
    `year`       int(8) DEFAULT NULL COMMENT '年',
    `january`    decimal(18, 2) DEFAULT '0.00' COMMENT '一月',
    `february`   decimal(18, 2) DEFAULT '0.00' COMMENT '二月',
    `march`      decimal(18, 2) DEFAULT '0.00' COMMENT '三月',
    `april`      decimal(18, 2) DEFAULT '0.00' COMMENT '四月',
    `may`        decimal(18, 2) DEFAULT '0.00' COMMENT '五月',
    `june`       decimal(18, 2) DEFAULT '0.00' COMMENT '六月',
    `july`       decimal(18, 2) DEFAULT '0.00' COMMENT '七月',
    `august`     decimal(18, 2) DEFAULT '0.00' COMMENT '八月',
    `september`  decimal(18, 2) DEFAULT '0.00' COMMENT '九月',
    `october`    decimal(18, 2) DEFAULT '0.00' COMMENT '十月',
    `november`   decimal(18, 2) DEFAULT '0.00' COMMENT '十一月',
    `december`   decimal(18, 2) DEFAULT '0.00' COMMENT '十二月',
    `status`     tinyint(2) DEFAULT '0' COMMENT '1销售（目标）2回款（目标）3 获客 4 拜访 5服务工单',
    `yeartarget` decimal(18, 2) DEFAULT '0.00' COMMENT '年目标',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='业绩目标表';

CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_achievement_records`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `name`            varchar(50)  DEFAULT '' COMMENT '名字',
    `obj_id`          int(11) DEFAULT '0' COMMENT '对象ID',
    `type`            tinyint(2) DEFAULT '0' COMMENT '1公司2部门3员工',
    `year`            int(8) DEFAULT NULL COMMENT '年',
    `january`         decimal(18, 2) DEFAULT '0.00' COMMENT '一月',
    `february`        decimal(18, 2) DEFAULT '0.00' COMMENT '二月',
    `march`           decimal(18, 2) DEFAULT '0.00' COMMENT '三月',
    `april`           decimal(18, 2) DEFAULT '0.00' COMMENT '四月',
    `may`             decimal(18, 2) DEFAULT '0.00' COMMENT '五月',
    `june`            decimal(18, 2) DEFAULT '0.00' COMMENT '六月',
    `july`            decimal(18, 2) DEFAULT '0.00' COMMENT '七月',
    `august`          decimal(18, 2) DEFAULT '0.00' COMMENT '八月',
    `september`       decimal(18, 2) DEFAULT '0.00' COMMENT '九月',
    `october`         decimal(18, 2) DEFAULT '0.00' COMMENT '十月',
    `november`        decimal(18, 2) DEFAULT '0.00' COMMENT '十一月',
    `december`        decimal(18, 2) DEFAULT '0.00' COMMENT '十二月',
    `status`          tinyint(2) DEFAULT '0' COMMENT '1销售（目标）2回款（目标）',
    `yeartarget`      decimal(18, 2) DEFAULT '0.00' COMMENT '年目标',
    `check_status`    tinyint(4) DEFAULT '0' COMMENT '0待审核、1审核中、2审核通过、3审核未通过、4撤销、',
    `flow_staff_ids`  varchar(255)   DEFAULT '' COMMENT '流程审批人ID',
     `flow_id` int(11) NULL DEFAULT NULL COMMENT '审核流程ID',
  `order_id` int(11) NULL DEFAULT NULL COMMENT '审批流程步骤id',
    `check_staff_ids` varchar(255)   DEFAULT '' COMMENT '已审批人IDs',
    `owner_staff_id` int(11) NULL DEFAULT NULL COMMENT '负责人id',
    `createtime`      int(11) DEFAULT NULL,
    `updatetime`      int(11) DEFAULT NULL,
    `deletetime`      int(11) DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COMMENT='业绩目标修改日志表';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_admin_config
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_admin_config`
(
    `id`         int(11) NOT NULL AUTO_INCREMENT,
    `type`       varchar(50)  DEFAULT NULL COMMENT '类型',
    `field`      varchar(50)  DEFAULT NULL COMMENT '字段名',
    `value`      varchar(200) DEFAULT NULL COMMENT '字段值',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_aftermarket
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_aftermarket`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `type_ids`        varchar(64)  DEFAULT NULL COMMENT '分类id 1,2,3,4',
    `product_ids`     varchar(64)  DEFAULT NULL COMMENT '产品id',
    `title`           varchar(255) DEFAULT NULL COMMENT '标题',
    `img`             varchar(255) DEFAULT NULL COMMENT '图片',
    `method`          text COMMENT '处理方式',
    `desc`            varchar(255) DEFAULT NULL COMMENT '简介',
    `content`         text COMMENT '内容',
    `click_number`    int(10) DEFAULT '0' COMMENT '点击次数',
    `comment_num`     int(10) DEFAULT '0' COMMENT '评论数',
    `create_staff_id` int(10) DEFAULT NULL COMMENT '创建销售',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='售后问题';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_aftermarket_type
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_aftermarket_type`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `pid`             int(10) DEFAULT NULL COMMENT '问题上级分类id',
    `name`            varchar(255) DEFAULT NULL COMMENT '问题分类名称',
    `create_staff_id` int(10) DEFAULT NULL  COMMENT '创建人',
    `sort`            int(4) DEFAULT '10'  COMMENT '排序',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='售后问题分类';


CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_approval`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `formapproval_id` int(11) DEFAULT NULL COMMENT '审批id',
    `number`          varchar(255) DEFAULT NULL COMMENT '编号',
    `relation_type`   varchar(255) DEFAULT NULL COMMENT '关联类型',
    `relation_id`     int(11) DEFAULT NULL COMMENT '关联id',
    `content`         text COMMENT '内容',
    `check_status`    tinyint(4) DEFAULT '0' COMMENT '0待审核、1审核中、2审核通过、3审核未通过、4撤销、',
    `flow_staff_ids`   varchar(255) DEFAULT '' COMMENT '流程审批人ID',
    `check_staff_ids`  varchar(255) DEFAULT '' COMMENT '已审批人IDs',
    `next_staff_id`   int(4) DEFAULT NULL COMMENT '下个审核人Id',
    `show_staff_id`   varchar(128) DEFAULT NULL COMMENT '查看人',
    `create_staff_id` int(10) DEFAULT NULL  COMMENT '创建人',
    `file_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件',
    `flow_id` int(11) NULL DEFAULT NULL COMMENT '审核流程ID',
    `order_id` int(11) NULL DEFAULT NULL COMMENT '审批流程步骤id',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=utf8mb4 COMMENT='审批详情';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_area_management
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_area_management`
(
    `id`           int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
    `name`         varchar(32) DEFAULT NULL COMMENT '区域名称',
    `province_ids` text COMMENT 'area_province里面id集合',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE,
    KEY            `name_index` (`name`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COMMENT='区域管理';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_area_province
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_area_province`
(
    `id`        int(10) NOT NULL AUTO_INCREMENT COMMENT 'ID',
    `status`    tinyint(1) DEFAULT '0' COMMENT '选中状态0未选中1已选中',
    `pid`       int(10) DEFAULT NULL COMMENT '父id',
    `shortname` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '简称',
    `name`      varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '名称',
    `mergename` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '全称',
    `level`     tinyint(4) DEFAULT NULL COMMENT '层级 0 1 2 省市区县',
    `pinyin`    varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '拼音',
    `code`      varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '长途区号',
    `zip`       varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '邮编',
    `first`     varchar(50) COLLATE utf8mb4_unicode_ci  DEFAULT NULL COMMENT '首字母',
    `lng`       varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '经度',
    `lat`       varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '纬度',
    PRIMARY KEY (`id`) USING BTREE,
    KEY         `pid` (`pid`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='地区表';
-- ----------------------------
-- Table structure for __PREFIX__qingdongams_comment
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_comment`
(
    `id`            int(11) NOT NULL AUTO_INCREMENT,
    `relation_type` varchar(32)  DEFAULT '0' COMMENT 'sign 签到 customer 客户 event 日程 notice 公告 article文章 workorder工单',
    `relation_id`   int(11) DEFAULT NULL COMMENT '关联id',
    `staff_id`      int(11) DEFAULT NULL COMMENT '用户ID',
    `content`       varchar(255) DEFAULT NULL COMMENT '评论内容',
    `praise`        int(11) DEFAULT '0' COMMENT '点赞数',
    `file_ids`      varchar(128) DEFAULT NULL  COMMENT '文件ID',
    `status`        tinyint(1) DEFAULT '0' COMMENT '0 待审核 1已审核',
    `ip`            varchar(100) DEFAULT NULL COMMENT 'ip地址',
    `operator` int(11) NULL DEFAULT NULL COMMENT '审核人',
    `checktime` datetime NULL DEFAULT NULL COMMENT '审核时间',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='评论表';

CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_companys` (
     `id` int(11) NOT NULL AUTO_INCREMENT,
     `com` varchar(32) DEFAULT NULL  COMMENT '名称',
     `no` varchar(32) DEFAULT NULL  COMMENT '编号',
     PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='快递公司';

CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_consume`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `number`          varchar(32)    DEFAULT NULL COMMENT '费用编号',
    `title`           varchar(255)   DEFAULT NULL  COMMENT '标题',
    `relation_type`   varchar(32)    DEFAULT NULL COMMENT '关联业务',
    `relation_id`     int(11) DEFAULT NULL COMMENT '关联id',
    `customer_id`     int(11) DEFAULT NULL COMMENT '客户ID',
    `consume_time` date NULL DEFAULT NULL COMMENT '消费日期',
  `consume_type` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '消费方式',
    `submit_date`     date           DEFAULT NULL COMMENT '申请日期',
    `submit_type`     varchar(64)    DEFAULT '' COMMENT '报销类型',
    `money`           decimal(18, 2) DEFAULT '0.00' COMMENT '报销总金额',
    `is_cashier`      tinyint(1) DEFAULT '0' COMMENT '是否出纳 0否 1是',
    `check_status`    tinyint(4) DEFAULT '0' COMMENT '0待审核、1审核中、2审核通过、3审核未通过、4撤销、5草稿(未提交)',
    `flow_id` int(11) NULL DEFAULT NULL COMMENT '审核流程ID',
    `order_id` int(11) NULL DEFAULT NULL COMMENT '审批流程步骤id',
    `flow_staff_ids`  varchar(255)   DEFAULT '' COMMENT '流程审批人ID',
    `check_staff_ids` varchar(255)   DEFAULT '' COMMENT '已审核审批人IDs',
    `next_staff_id`   int(4) DEFAULT NULL COMMENT '下一个审批人id',
    `show_staff_ids`  varchar(128)   DEFAULT NULL COMMENT '可查看人',
    `remark`          varchar(255)   DEFAULT NULL COMMENT '备注',
     `file_ids` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件ID',
    `staff_id`        int(10) NOT NULL COMMENT '创建人ID',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE,
    KEY               `staff_id` (`staff_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='费用表';

CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_consume_detail`
(
    `id`            int(11) NOT NULL AUTO_INCREMENT,
    `consume_id`    int(10) NOT NULL COMMENT '费用id',
    `customer_id`   int(11) DEFAULT NULL COMMENT '客户ID',
    `consume_date`  date           DEFAULT NULL COMMENT '消费日期',
    `consume_type`  varchar(64)    DEFAULT '' COMMENT '报销类型',
    `consume_money` decimal(18, 2) DEFAULT '0.00' COMMENT '报销总金额',
    `remark`        varchar(255)   DEFAULT NULL COMMENT '备注',
    `file_ids`      varchar(128)   DEFAULT NULL COMMENT '附件ID',
    `mileage`       varchar(255)   DEFAULT NULL COMMENT '公里数',
    `car_number`    varchar(128)   DEFAULT NULL COMMENT '车牌号',
    `car_type`      varchar(128)   DEFAULT NULL COMMENT '出行工具',
    `start_mileage` varchar(255)   DEFAULT NULL COMMENT '起始公里数',
    `end_mileage`   varchar(255)   DEFAULT NULL COMMENT '结束公里数',
    `other_files`   varchar(64)    DEFAULT NULL  COMMENT '其他附件',
    PRIMARY KEY (`id`) USING BTREE,
    KEY             `staff_id` (`consume_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='费用表';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_contacts
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_contacts`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `customer_id`     int(10) NOT NULL COMMENT '客户ID',
    `is_major`        tinyint(1) DEFAULT '0' COMMENT '是否主要联系人 0 否 1是',
    `region`          tinyint(1) DEFAULT NULL COMMENT '1国内 2国外',
    `name`            varchar(64)  DEFAULT '' COMMENT '姓名',
    `subname`         varchar(64)  DEFAULT NULL COMMENT '简称或尊称',
    `sex`             tinyint(1) DEFAULT NULL COMMENT '性别 1男 2女',
    `role`            varchar(32)  DEFAULT NULL COMMENT '角色',
    `post`            varchar(32)  DEFAULT NULL COMMENT '职务',
    `email`           varchar(32)  DEFAULT NULL COMMENT '邮箱',
    `mobilecode`      varchar(32)  DEFAULT NULL COMMENT '区号',
    `mobile`          varchar(32)  DEFAULT NULL COMMENT '手机号',
    `telephone`       varchar(32)  DEFAULT NULL COMMENT '电话 座机',
    `birthday`        varchar(32)  DEFAULT NULL COMMENT '生日',
    `fax`             varchar(32)  DEFAULT NULL COMMENT '传真号',
    `wechat`          varchar(32)  DEFAULT NULL COMMENT '微信号',
    `qq`              varchar(32)  DEFAULT NULL COMMENT 'qq号',
    `address`         varchar(64)  DEFAULT NULL COMMENT '省市区',
    `address_detail`  varchar(64)  DEFAULT NULL COMMENT '详细地址',
    `remarks`         varchar(255) DEFAULT NULL COMMENT '备注信息',
    `create_staff_id` int(10) DEFAULT NULL COMMENT '创建人ID',
    `owner_staff_id`  int(10) DEFAULT NULL COMMENT '负责人ID',
    `next_time`       datetime     DEFAULT NULL COMMENT '下次联系时间',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE,
    KEY               `customer_id_index` (`customer_id`) USING BTREE,
    KEY               `mobile` (`mobile`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='联系人表';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_contacts_file
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_contacts_file`
(
    `id`          int(11) NOT NULL AUTO_INCREMENT,
    `contacts_id` int(11) NOT NULL  COMMENT '联系人ID',
    `file_id`     int(11) NOT NULL  COMMENT '附件ID',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='联系人附件';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_contacts_other
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_contacts_other`
(
    `id`    int(11) NOT NULL AUTO_INCREMENT COMMENT '客户id',
    `otherdata` text COMMENT '自定义信息 json',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_contract
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_contract`
(
    `id`                       int(11) NOT NULL AUTO_INCREMENT,
    `customer_id`              int(10) NOT NULL COMMENT '客户ID',
    `contacts_id`              int(10) DEFAULT NULL COMMENT '客户签约人 联系人',
    `quote_id`                 int(10) DEFAULT NULL COMMENT '报价单id',
    `name`                     varchar(50)    DEFAULT '' COMMENT '合同名称',
    `num`                      varchar(64)    DEFAULT '' COMMENT '合同编号',
    `order_date`               date           DEFAULT NULL COMMENT '下单时间',
    `money`                    decimal(18, 2) DEFAULT '0.00' COMMENT '合同金额',
    `total_price`              decimal(18, 2) DEFAULT '0.00' COMMENT '产品总金额',
    `discount_rate`            decimal(10, 2) DEFAULT '0.00' COMMENT '整单折扣',
    `is_start`                 tinyint(1) DEFAULT NULL COMMENT '0 未生效 1 已生效',
    `is_check_success`         tinyint(1) DEFAULT '0' COMMENT '是否已审核 0 否 1是',
    `contract_status`          tinyint(1) DEFAULT '0' COMMENT '0 进行中 1 已完成  2 已作废',
    `check_status`             tinyint(4) DEFAULT '0' COMMENT '0待审核、1审核中、2审核通过、3审核未通过、4撤销、',
    `flow_staff_ids`           varchar(255)   DEFAULT '' COMMENT '流程审批人ID',
    `check_staff_ids`          varchar(255)   DEFAULT '' COMMENT '已审批人IDs',
    `start_time`               date           DEFAULT NULL COMMENT '开始时间',
    `end_time`                 date           DEFAULT NULL COMMENT '结束时间',
    `order_staff_id`           varchar(255)   DEFAULT '' COMMENT '公司签约人',
    `business_id` int(11) NULL DEFAULT NULL COMMENT '商机ID',
    `remarks`                  varchar(255)   DEFAULT NULL COMMENT '备注',
    `flow_id` int(11) NULL DEFAULT NULL COMMENT '审核流程ID',
  `order_id` int(11) NULL DEFAULT NULL COMMENT '审批流程步骤id',
  `ratio_id` int(11) NULL DEFAULT NULL COMMENT '绩效ID',
  `ratios` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业绩比例',
    `create_staff_id`          int(10) DEFAULT NULL COMMENT '创建人ID',
    `owner_staff_id`           int(10) DEFAULT NULL COMMENT '负责人ID',
    `show_staff_id`            varchar(255)   DEFAULT NULL  COMMENT '显示人ID',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    `plan`                     varchar(2000)  DEFAULT NULL COMMENT '回款计划',
    `signed_at`                varchar(255)   DEFAULT NULL COMMENT '签订地点',
    `guarantee`                varchar(32)    DEFAULT NULL COMMENT '免费保修期限',
    `payment`                  varchar(255)   DEFAULT '' COMMENT '支付方式：全款发货/五五/三六一/三七',
    `payment_text`             varchar(255)   DEFAULT ''   COMMENT '备注',
    `tax_text`                 varchar(255)   DEFAULT NULL COMMENT '含税情况',
    `delivery_time`            varchar(64)    DEFAULT NULL COMMENT '交货时间',
    `be_overdue`               varchar(255)   DEFAULT NULL COMMENT '逾期付款',
    `effective`                varchar(255)   DEFAULT NULL COMMENT '生效方式',
    `legal`                    varchar(32)    DEFAULT NULL COMMENT '法定代表人',
    `deposit`                  varchar(255)   DEFAULT NULL COMMENT '开户行',
    `account`                  varchar(255)   DEFAULT NULL COMMENT '账号',
    `fax`                      varchar(64)    DEFAULT NULL COMMENT '传真',
    `mobile`                   varchar(255)   DEFAULT NULL COMMENT '电话',
    `entrust`                  varchar(32)    DEFAULT NULL COMMENT '委托代理人',
    `handler`                  varchar(32)    DEFAULT NULL COMMENT '经办人',
    `collection_account`       varchar(255)   DEFAULT NULL COMMENT '收款账号',
    `collection_deposit`       varchar(255)   DEFAULT NULL COMMENT '收款开户行',
    `collection_name`          varchar(255)   DEFAULT NULL COMMENT '收款账户名称',
    `collection_img`           varchar(255)   DEFAULT NULL COMMENT '收款图片',
    `consignee`                varchar(255)   DEFAULT '' COMMENT '收货人',
    `consignee_mobile`         varchar(255)   DEFAULT '' COMMENT '收货人联系方式',
    `delivery_address`         varchar(255)   DEFAULT '' COMMENT '交货地点',
    `delivery_address_detail`  varchar(255)   DEFAULT '' COMMENT '交货详情',
    `receipt_file_ids`         varchar(64)    DEFAULT '' COMMENT '回执单附件',
    `receipt_date`             date           DEFAULT NULL COMMENT '回执时间',
    `invoice_file_ids`         varchar(255)   DEFAULT '' COMMENT '发票附件',
    `invoice_date`             date           DEFAULT NULL COMMENT '发票日期',
    `invoice_logistics_number` varchar(64)    DEFAULT NULL COMMENT '发票物流单号',
    PRIMARY KEY (`id`) USING BTREE,
    KEY                        `customer_id_index` (`customer_id`) USING BTREE,
    KEY                        `contacts_id_index` (`contacts_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='合同表';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_contract_file
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_contract_file`
(
    `id`          int(11) NOT NULL AUTO_INCREMENT,
    `contract_id` int(11) NOT NULL COMMENT '合同ID',
    `file_id`     int(11) NOT NULL COMMENT '附件ID',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `create_id`   int(10) DEFAULT NULL COMMENT '创建人',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8mb4 COMMENT='合同附件';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_contract_other
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_contract_other`
(
    `id`    int(11) NOT NULL AUTO_INCREMENT COMMENT '客户id',
    `otherdata` text COMMENT '自定义信息 json',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_contract_product
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_contract_product`
(
    `id`          int(11) NOT NULL AUTO_INCREMENT,
    `contract_id` int(11) DEFAULT NULL COMMENT '合同',
    `product_id`  int(11) DEFAULT NULL COMMENT '产品',
    `number`      int(11) DEFAULT NULL COMMENT '数量',
    `price`       decimal(10, 2) DEFAULT NULL COMMENT '购买价格',
    `parts` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品配置',
  `ship_status` tinyint(1) NULL DEFAULT 0 COMMENT '0 待发货 1发货 2已收货',
    `type`        varchar(32)    DEFAULT NULL COMMENT '标准 非标',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_customer
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_customer`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `type`            enum('A','B','C','D') DEFAULT 'D' COMMENT '客户类型 a-d,A最高',
    `seas_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属公海',
    `sea_time` int(11) NULL DEFAULT NULL COMMENT '放入公海时间',
    `mobile` varchar(15) DEFAULT NULL COMMENT '手机号',
    `parent_id`       int(10) DEFAULT '0' COMMENT '上级（客户/公司）ID',
    `name`            varchar(128) DEFAULT NULL COMMENT '客户名称',
    `subname`         varchar(128) DEFAULT NULL COMMENT '助记名称',
    `level`           tinyint(1) DEFAULT NULL COMMENT '1-5 客户星级',
    `industry`        varchar(64)  DEFAULT NULL COMMENT '客户行业',
    `source`          varchar(64)  DEFAULT NULL COMMENT '客户来源',
    `follow`          varchar(32)  DEFAULT NULL COMMENT '跟进状态',
    `country`         varchar(255) DEFAULT NULL COMMENT '乡',
    `last_time`       datetime     DEFAULT NULL COMMENT '最后一次跟进时间',
    `next_time`       datetime     DEFAULT NULL COMMENT '下次联系时间',
    `contract_status` tinyint(1) DEFAULT '0' COMMENT '成交状态 0未成交 1已成交',
    `trade_date`      date         DEFAULT NULL COMMENT '成交日期',
    `receivetime`     int(11) DEFAULT NULL COMMENT '领取时间',
    `address`         varchar(64)  DEFAULT NULL COMMENT '省市区',
    `address_detail`  varchar(128) DEFAULT NULL COMMENT '详细地址',
    `location`        varchar(128) DEFAULT NULL COMMENT '定位信息',
    `file_ids` varchar(255) DEFAULT NULL COMMENT '附件ID',
    `scale` varchar(32) DEFAULT NULL COMMENT '企业规模',
    `remarks` varchar(255) DEFAULT NULL COMMENT '备注信息',
    `enterprise_status` tinyint(1) DEFAULT '0' COMMENT '工商信息0未查询1已查询',
    `enterprise_detail_status` tinyint(1) DEFAULT '0' COMMENT '工商信息精准查询0未查询1已查询',
    `claimdate` date DEFAULT NULL COMMENT '领用时间（领用A/B/CD）',
    `is_seas` tinyint(1) DEFAULT '0' COMMENT '0  1公海',
    `create_staff_id` int(10) DEFAULT NULL COMMENT '创建人ID',
    `owner_staff_id` int(10) DEFAULT NULL COMMENT '负责人ID',
    `ro_staff_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '只读权限',
    `rw_staff_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '读写权限',
    `show_staff_ids` varchar(128) DEFAULT NULL COMMENT '显示人',
    `management_id` int(10) DEFAULT NULL COMMENT '所在区域',
    `lng` double(16,12) DEFAULT NULL COMMENT '地理位置经度',
    `lat` double(16,12) DEFAULT NULL COMMENT '地理位置维度',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `parent_id_index` (`parent_id`) USING BTREE,
  KEY `owner_staff_id` (`owner_staff_id`) USING BTREE,
  KEY `name` (`name`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='客户表';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_customer_enterprise
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_customer_enterprise`
(
    `id`         int(8) NOT NULL AUTO_INCREMENT,
    `keywords`   varchar(100) NOT NULL COMMENT '关键字',
    `total`      int(4) DEFAULT NULL COMMENT '共查询到条数',
    `num`        int(4) DEFAULT NULL COMMENT '返回条数',
    `content`    mediumtext COMMENT '内容',
    `author_id`  int(8) DEFAULT NULL COMMENT '查询人id',
    `author`     varchar(10) DEFAULT NULL COMMENT '查询人',
    `res_status` tinyint(1) DEFAULT '0' COMMENT '查询结果0正常1异常',
    `createtime` bigint(16) DEFAULT NULL COMMENT '查询时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='工商信息查询记录';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_customer_enterprise_detail
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_customer_enterprise_detail`
(
    `id`         int(8) NOT NULL AUTO_INCREMENT,
    `name`       varchar(100) DEFAULT NULL COMMENT '公司名称',
    `content`    mediumtext COMMENT '内容',
    `author_id`  int(8) DEFAULT NULL COMMENT '查询人id',
    `author`     varchar(10)  DEFAULT NULL COMMENT '查询人',
    `res_status` tinyint(1) DEFAULT '0' COMMENT '查询结果0正常1异常',
    `createtime` int(10) DEFAULT NULL COMMENT '查询时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='工商信息精准查询记录';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_customer_file
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_customer_file`
(
    `id`          int(11) NOT NULL AUTO_INCREMENT,
    `customer_id` int(11) NOT NULL COMMENT '客户ID',
    `file_id`     int(11) NOT NULL COMMENT '附件ID',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='客户附件表';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_customer_other
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_customer_other`
(
    `id`    int(11) NOT NULL AUTO_INCREMENT COMMENT '客户id',
    `otherdata` text COMMENT '自定义信息 json',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_customer_product
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_customer_product`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `customer_id`     int(10) DEFAULT NULL COMMENT '客户ID',
    `contract_id`     int(10) DEFAULT NULL COMMENT '合同id',
    `order_id`        int(10) DEFAULT NULL COMMENT '订单id',
    `product_id`      int(10) DEFAULT NULL COMMENT '产品id',
    `status`          tinyint(1) DEFAULT '0' COMMENT '0 待发货 1 发货中 2 待安装  3 安装成功  9 撤销',
    `number`          varchar(64)  DEFAULT NULL COMMENT '设备编号',
    `file_ids`        varchar(255) DEFAULT NULL COMMENT '设备图片',
    `pay_date`        date         DEFAULT NULL COMMENT '购买时间',
    `over_date`       date         DEFAULT NULL COMMENT '质保到期时间',
    `create_staff_id` int(10) DEFAULT NULL COMMENT '创建人',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='客户产品表';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_customer_type
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_customer_type`
(
    `id`         int(4) NOT NULL AUTO_INCREMENT,
    `name`       varchar(5) DEFAULT NULL COMMENT '名称',
    `days_cus`   int(4) DEFAULT NULL COMMENT '给员工提醒时间节点，天数',
    `days_pid`   int(4) DEFAULT NULL COMMENT '给领导提醒时间节点，第二次天数',
    `cus_status` tinyint(1) DEFAULT '0' COMMENT '员工提醒 0关闭1开启',
    `pid_status` tinyint(1) DEFAULT '0' COMMENT '领导提醒 0关闭1开启',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='客户类型';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_daily
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_daily`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `type`            varchar(50)  DEFAULT NULL COMMENT ' 日 周 月 季 年',
    `other`           text COMMENT '其他',
    `reminds_id`      varchar(255) DEFAULT NULL COMMENT '提醒人员列表',
    `create_staff_id` int(10) DEFAULT NULL COMMENT '创建用户id',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作报告';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_daily_read
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_daily_read`
(
    `id`         int(11) NOT NULL AUTO_INCREMENT,
    `staff_id`   int(10) DEFAULT NULL COMMENT '员工ID',
    `daily_id`   int(10) DEFAULT NULL COMMENT '工作报告ID',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE,
    KEY          `staff_id` (`staff_id`) USING BTREE,
    KEY          `record_id` (`daily_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='跟进记录已读记录';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_discuss
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_discuss`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `title`           varchar(255)  DEFAULT NULL COMMENT '名称',
    `content`         text DEFAULT NULL COMMENT '内容',
    `file_ids`        varchar(64)   DEFAULT NULL COMMENT '附件ID',
    `show_staff_id`   varchar(255)  DEFAULT NULL COMMENT '显示人',
    `create_staff_id` int(10) DEFAULT NULL COMMENT '创建人',
    `relation_type`   varchar(32)   DEFAULT NULL COMMENT '关联类型',
    `relation_id`     int(10) DEFAULT NULL COMMENT '关联ID',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='讨论问题';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_equipment
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_equipment`
(
    `id`         int(8) NOT NULL AUTO_INCREMENT,
    `pro_id`     int(8) DEFAULT NULL COMMENT '产品ID',
    `cus_pro_id` int(8) DEFAULT NULL COMMENT '客户产品表id',
    `number`     char(18)     DEFAULT NULL COMMENT '设备编号',
    `logo`       varchar(255) DEFAULT NULL COMMENT '二维码',
    `name`       varchar(50)  DEFAULT NULL COMMENT '设备名称',
    `model`      varchar(50)  DEFAULT NULL COMMENT '型号',
    `needle`     varchar(50)  DEFAULT NULL COMMENT '机针',
    `voltage`    varchar(50)  DEFAULT NULL COMMENT '电压',
    `weight`     double(10, 2) DEFAULT NULL COMMENT '重量',
  `img` varchar(255) DEFAULT NULL COMMENT '设备图',
  `binding_status` tinyint(1) DEFAULT '1' COMMENT '绑定客户产品状态：1未绑定0已绑定',
  `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
  `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
  `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='设备管理';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_event
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_event`
(
    `id`                 int(11) NOT NULL AUTO_INCREMENT,
    `type`               tinyint(1) DEFAULT '1' COMMENT '1 日程 2任务 3 拜访',
    `process`            varchar(64)                                      DEFAULT '0' COMMENT '进程 1 开始 2 到访 3 结束',
    `event_type`         varchar(128)                                     DEFAULT NULL COMMENT '日程分类',
    `title`              varchar(255)                                     DEFAULT NULL COMMENT '日程标题',
    `visits_number`      tinyint(3) DEFAULT NULL COMMENT '第几次拜访客户',
    `visit_purpose`      varchar(255)                                     DEFAULT NULL COMMENT '拜访目的',
    `start_time`         varchar(32)                                      DEFAULT NULL COMMENT '开始时间',
    `end_time`           varchar(32)                                      DEFAULT NULL COMMENT '结束时间',
    `status`             tinyint(2) DEFAULT '0' COMMENT '日程状态 0未开始 1执行中2 已结束 3 已取消',
    `level`              tinyint(2) DEFAULT NULL COMMENT '紧要程度 0普通 1重要 2紧急 4 重要且紧急',
    `remindtype`         tinyint(4) DEFAULT '0' COMMENT '提醒时间0准时提醒 1：5分钟前 2：15分钟前 3：30分钟前 4：一个小时前 5：两个小时前 6：一天前 7：两天前 8：一周前',
    `remind_time`        datetime                                         DEFAULT NULL COMMENT '提醒时间',
    `remark`             varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT '' COMMENT '备注',
    `relation_type`      varchar(32)                                      DEFAULT NULL COMMENT '关联类型  1客户 2工单',
    `relation_id`        int(11) DEFAULT NULL COMMENT '关联ID',
    `customer_id`        int(11) DEFAULT NULL COMMENT '客户id',
    `staff_id`           int(10) DEFAULT NULL COMMENT '归属人ID',
    `create_staff_id`    int(11) DEFAULT NULL COMMENT '任务创建人id',
    `show_staff_ids`      varchar(32)                                      DEFAULT NULL,
    `actual_start_time`  int(10) DEFAULT NULL COMMENT '实际开始时间',
    `actual_arrive_time` int(10) DEFAULT NULL COMMENT '实际到访时间',
    `actual_end_time`    int(10) DEFAULT NULL COMMENT '实际结束时间',
    `use_time`           int(10) DEFAULT NULL COMMENT '消耗工时',
    `is_successful`      tinyint(1) DEFAULT NULL COMMENT '是否达到预期目的 1是/已解决 2否/俄日解决',
    `achieve_purpose`    varchar(255)                                     DEFAULT NULL COMMENT '达成目的',
    `last_event`         varchar(32)                                      DEFAULT NULL COMMENT '下一行程 返程/拜访下一家',
    `reminds_id`         varchar(32)                                      DEFAULT NULL COMMENT '通知人',
    `call_content`       text                                    DEFAULT NULL COMMENT '通话内容',
    `start_mileage`      varchar(255)                                     DEFAULT NULL COMMENT '起始公里shu',
    `car_type`           varchar(255)                                     DEFAULT NULL COMMENT '出行工具',
    `end_mileage`        varchar(255)                                     DEFAULT NULL COMMENT '结束公里数',
    `back_mileage`       varchar(255)                                     DEFAULT NULL COMMENT '返程公里数',
    `needs`              varchar(255)                                     DEFAULT NULL COMMENT '客户需求',
    `car_number`         varchar(64)                                      DEFAULT NULL,
    `auto_end` tinyint(1) NOT NULL DEFAULT 1 COMMENT '自动结束 0否 1是',
    `owner_staff_id` int(11) NOT NULL DEFAULT 0 COMMENT '指派人',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE,
    KEY                  `title` (`title`) USING BTREE,
    KEY                  `staff_id` (`staff_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='日程提醒';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_event_needs
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_event_needs`
(
    `id`         int(11) NOT NULL AUTO_INCREMENT,
    `event_id`   int(10) DEFAULT NULL COMMENT '事件ID',
    `staff_id`   int(10) DEFAULT NULL COMMENT '创建人',
    `needs`      text COMMENT '记录',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE,
    KEY          `staff_id` (`staff_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='跟进记录已读记录';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_examine_record
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_examine_record`
(
    `id`             int(11) NOT NULL AUTO_INCREMENT,
    `relation_id`    int(10) DEFAULT '0' COMMENT '关联ID',
    `relation_type`  varchar(32)  DEFAULT '0' COMMENT 'consume 费用 ',
    `check_staff_id` int(11) DEFAULT '0' COMMENT '审批人ID',
    `check_time`     int(11) DEFAULT NULL COMMENT '审批时间',
    `status`         tinyint(4) DEFAULT '0' COMMENT '0待审批 1审核通过2审核拒绝 3撤销',
    `content`        varchar(255) DEFAULT '' COMMENT '审核意见',
    `remark`         varchar(255) DEFAULT '' COMMENT '审核备注',
    `edit_field`     text COMMENT '修改的字段',
    `is_end`         tinyint(1) DEFAULT '0' COMMENT '审批失效（1标记为无效）',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='审批记录';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_feedback
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_feedback`
(
    `id`         int(11) NOT NULL AUTO_INCREMENT,
    `staff_id`   int(11) DEFAULT NULL COMMENT '创建人',
    `content`    text COMMENT '内容',
    `file_ids`   varchar(128) DEFAULT NULL COMMENT '附件ID',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='意见反馈';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_field
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_field`
(
    `id`    int(11) NOT NULL AUTO_INCREMENT,
    `type`  varchar(32)  DEFAULT NULL COMMENT '类型',
    `field` varchar(128) DEFAULT NULL COMMENT '内容',
     `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='字段管理';



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_file
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_file`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `types`           varchar(20)  DEFAULT NULL COMMENT '类型（file、image）',
    `name`            varchar(100) DEFAULT NULL COMMENT '附件名称',
    `save_name`       varchar(255) DEFAULT NULL COMMENT '保存路径名称',
    `size`            int(10) DEFAULT NULL COMMENT '附件大小（字节）',
    `file_path`       varchar(255) DEFAULT NULL COMMENT '文件路径',
    `file_path_thumb` varchar(255) DEFAULT NULL COMMENT '文件路径(图片缩略图)',
    `create_staff_id` int(10) DEFAULT NULL COMMENT '创建人ID',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='小程序 附件表';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_flow
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_flow`
(
    `id`          int(11) NOT NULL AUTO_INCREMENT,
    `name`        varchar(100) DEFAULT NULL COMMENT '名称',
    `type`        varchar(32)  DEFAULT NULL COMMENT '类型',
    `examine_ids` varchar(200) DEFAULT NULL COMMENT '默认审核人id',
    `status` tinyint(1) NULL DEFAULT NULL COMMENT '1 固定审批 0 授权审批',
     `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
  `relation_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关联类型',
  `group_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关联角色组',
  `weight` tinyint(4) NULL DEFAULT NULL COMMENT '权重',
  `last_modified` int(11) NULL DEFAULT NULL COMMENT '最后修改时间',
  `last_admin_id` int(11) NULL DEFAULT NULL COMMENT '最后修改人',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='流程审核配置';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_form
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_form`
(
    `id`         int(10) NOT NULL AUTO_INCREMENT,
    `name`       varchar(64) DEFAULT NULL COMMENT '姓名',
    `type`       varchar(32) DEFAULT NULL COMMENT 'type类型',
    `data`       text COMMENT '数据',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='表单配置';

CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_form_approval`
(
    `id`             int(10) NOT NULL AUTO_INCREMENT,
    `form_id` int(11) DEFAULT NULL COMMENT '表单ID',
    `name`           varchar(64)  DEFAULT NULL COMMENT '名称',
    `type`           varchar(32)  DEFAULT NULL COMMENT 'type类型',
    `img`            varchar(255) DEFAULT NULL COMMENT '图片',
    `data`           text COMMENT '数据',
    `desc`           text COMMENT '描述',
    `flow_staff_ids` varchar(255) DEFAULT NULL COMMENT '审批人列表',
    `examine_ids` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '默认审核人id',
    `status` tinyint(1) NULL DEFAULT NULL COMMENT '1 固定审批 0 授权审批',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4  COMMENT='审批表单配置';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_joint_follow
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_joint_follow`
(
    `id`            int(11) NOT NULL AUTO_INCREMENT,
    `relation_type` varchar(255) DEFAULT NULL COMMENT '类型',
    `relation_id`   int(10) DEFAULT NULL COMMENT '关联ID',
    `staff_id`      int(10) DEFAULT NULL COMMENT '创建人',
    `roles`         tinyint(1) DEFAULT NULL COMMENT '1 管理员 2普通角色',
    `is_edit`       tinyint(1) DEFAULT NULL COMMENT '0 只读 1 读写',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='联合跟进人';



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_leads
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_leads`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `customer_id`     int(11) DEFAULT '0' COMMENT '线索转化为客户ID',
    `is_transform`    tinyint(1) DEFAULT '0' COMMENT '1已转化',
    `name`            varchar(64)  DEFAULT '' COMMENT '线索名称',
    `source`          varchar(64)  DEFAULT '' COMMENT '线索来源',
    `sex`             tinyint(1) DEFAULT NULL COMMENT '1男 2女',
    `telephone`       varchar(64)  DEFAULT '' COMMENT '电话',
    `mobile`          varchar(64)  DEFAULT '' COMMENT '手机',
    `industry`        varchar(64)  DEFAULT '' COMMENT '客户行业',
    `level`           varchar(64)  DEFAULT '' COMMENT '客户级别',
    `address`         varchar(128) DEFAULT NULL COMMENT '省市区',
    `address_detail`  varchar(128) DEFAULT '' COMMENT '地址',
    `remarks`         varchar(255) DEFAULT NULL COMMENT '备注',
    `create_staff_id` int(10) DEFAULT NULL COMMENT '创建人ID',
    `owner_staff_id`  int(10) DEFAULT NULL COMMENT '负责人ID',
    `last_time`       datetime     DEFAULT NULL COMMENT '上次跟进时间',
    `next_time` datetime NULL DEFAULT NULL COMMENT '下次联系时间',
    `follow`          varchar(20)  DEFAULT NULL COMMENT '跟进',
    `tranfer_stff_id` int(10) NULL DEFAULT NULL COMMENT '转派人ID',
    `receive_time` int(11) NULL DEFAULT NULL COMMENT '分配时间',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE,
    KEY               `name` (`name`) USING BTREE,
    KEY               `mobile` (`mobile`) USING BTREE,
    KEY               `staff_id` (`owner_staff_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='线索表';



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_leads_file
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_leads_file`
(
    `id`       int(11) NOT NULL AUTO_INCREMENT,
    `leads_id` int(11) NOT NULL COMMENT '线索ID',
    `file_id`  int(11) NOT NULL COMMENT '附件ID',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户附件表';



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_leads_other
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_leads_other`
(
    `id`    int(11) NOT NULL AUTO_INCREMENT COMMENT '客户id',
    `otherdata` text COMMENT '自定义信息 json',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_login_token
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_login_token`
(
    `token`      varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Token',
    `login_id`   varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '登录ID',
    `createtime` int(10) DEFAULT NULL COMMENT '创建时间',
    `expiretime` int(10) DEFAULT NULL COMMENT '过期时间',
    PRIMARY KEY (`token`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小程序用户登录Token表';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_message
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_message`
(
    `id`            int(11) NOT NULL AUTO_INCREMENT,
    `relation_type` varchar(32)  DEFAULT '0' COMMENT '关联类型 consume 费用审批',
    `relation_id`   int(10) DEFAULT NULL COMMENT '关联ID',
    `to_staff_id`   int(10) DEFAULT NULL COMMENT '接收人ID',
    `from_staff_id` int(10) DEFAULT NULL COMMENT '发送人ID',
    `title`         varchar(255) DEFAULT NULL COMMENT '通知标题',
    `content`       text DEFAULT NULL COMMENT '发送内容',
    `send_time`     int(11) DEFAULT NULL COMMENT '发送时间',
    `read_time`     int(11) DEFAULT NULL COMMENT '阅读时间',
    `status`        tinyint(1) DEFAULT NULL COMMENT '0 未操作 1已操作 ',
    `action_id`     int(11) DEFAULT NULL COMMENT '操作ID',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='提醒消息';



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_mobilecode
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_mobilecode`
(
    `id`     int(11) NOT NULL AUTO_INCREMENT,
    `name`   varchar(64) DEFAULT NULL COMMENT '国家',
    `number` varchar(32) DEFAULT NULL COMMENT '区号',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='手机区号';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_notice
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_notice`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `title`           varchar(50)  DEFAULT NULL COMMENT '标题',
    `content`         text COMMENT '内容',
    `start_time`      int(11) DEFAULT NULL COMMENT '开始时间',
    `end_time`        int(11) DEFAULT NULL COMMENT '结束时间',
    `owner_staff_ids` varchar(100) DEFAULT '' COMMENT '通知人',
    `read_staff_ids`  text COMMENT '阅读人',
    `create_staff_id` int(10) DEFAULT NULL COMMENT '创建人ID',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='公告表';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_notice_template
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_notice_template`
(
    `id`         int(11) NOT NULL AUTO_INCREMENT,
    `name`       varchar(64) DEFAULT NULL COMMENT '名称',
    `type`       varchar(32) DEFAULT NULL COMMENT '类型',
    `data`       text COMMENT '内容',
    `enterprise_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '企业微信',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='通知模板设置';



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_ocr
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_ocr`
(
    `id`         int(8) NOT NULL AUTO_INCREMENT COMMENT 'id',
    `type_id`    int(4) DEFAULT NULL COMMENT '类型id',
    `file_id`    int(8) DEFAULT NULL COMMENT '文件id',
    `file_url`   varchar(255)   DEFAULT NULL COMMENT '图片地址',
    `staff_id`   int(8) DEFAULT NULL COMMENT '创建者id',
    `createtime` int(10) DEFAULT NULL COMMENT '提交时间',
    `updatetime` int(10) DEFAULT NULL COMMENT '修改时间',
    `ocr_result` text COMMENT '识别结果',
    `money`      decimal(10, 2) DEFAULT NULL COMMENT '总金额',
    `log_id`     varchar(100)   DEFAULT NULL COMMENT '返回唯一码',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='ocr识别';



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_ocr_type
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_ocr_type`
(
    `id`     int(4) NOT NULL AUTO_INCREMENT COMMENT 'id',
    `name`   varchar(20)  DEFAULT NULL COMMENT '名称',
    `type`   tinyint(2) DEFAULT '1' COMMENT '类型1财务票据文字识别',
    `action` varchar(100) DEFAULT NULL COMMENT '请求方法',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='财务票据类型';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_operation_log
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_operation_log`
(
    `id`             int(11) NOT NULL AUTO_INCREMENT,
    `content`        varchar(255) DEFAULT NULL COMMENT '操作内容',
    `operation_type` tinyint(1) DEFAULT NULL COMMENT '操作人类型 1 员工 2管理员',
    `operation_id`   int(11) DEFAULT NULL COMMENT '操作人id',
    `relation_type`  tinyint(1) DEFAULT NULL COMMENT '关联类型  1客户 2联系人 3合同',
    `relation_id`    int(11) DEFAULT NULL COMMENT '被操作的客户id',
    `lng`            varchar(64)  DEFAULT NULL COMMENT '经度',
    `lat`            varchar(64)  DEFAULT NULL COMMENT '纬度',
    `location`       varchar(255) DEFAULT NULL COMMENT '定位位置',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='操作日志';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_order
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_order`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `customer_id`     int(11) NOT NULL COMMENT '客户ID',
    `contacts_id`     int(11) DEFAULT NULL COMMENT '客户签约人 联系人',
    `contract_id`     int(11) DEFAULT NULL COMMENT '合同id',
    `create_staff_id` int(10) DEFAULT NULL COMMENT '创建人ID',
    `owner_staff_id`  int(10) DEFAULT NULL COMMENT '负责人ID',
    `show_staff_id`   varchar(255) DEFAULT NULL COMMENT '显示人ID',
    `is_account` tinyint(1) NULL DEFAULT 0 COMMENT '是否已到账',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE,
    KEY               `customer_id_index` (`customer_id`) USING BTREE,
    KEY               `contacts_id_index` (`contacts_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=178 DEFAULT CHARSET=utf8mb4 COMMENT='订单表';



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_parts
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_parts`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `product_id`      varchar(64)    DEFAULT NULL COMMENT '所属产品',
    `stock`           int(10) DEFAULT '0' COMMENT '库存',
    `warning_stock`   int(10) DEFAULT '0' COMMENT '预警库存',
    `name`            varchar(128)   DEFAULT '' COMMENT '部件名称',
    `num`             varchar(128)   DEFAULT '' COMMENT '部件编码',
    `img`             varchar(128)   DEFAULT NULL COMMENT '部件图片',
    `banners`         varchar(64)    DEFAULT NULL COMMENT '部件多图',
    `unit`            varchar(128)   DEFAULT '箱' COMMENT '单位',
    `price`           decimal(18, 2) DEFAULT '0.00' COMMENT '标准价格',
    `cost_price`      decimal(10, 2) DEFAULT NULL COMMENT '成本价',
    `status`          varchar(32)    DEFAULT '上架' COMMENT '是否上架',
    `description`     text  DEFAULT NULL COMMENT '部件描述',
    `create_staff_id` int(11) DEFAULT NULL COMMENT '创建人ID',
    `createtime`      int(11) DEFAULT NULL COMMENT '创建时间',
    `updatetime`      int(11) DEFAULT NULL COMMENT '更新时间',
    `deletetime`      int(10) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='产品部件管理';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_parts_stock
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_parts_stock`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `parts_id`        int(11) DEFAULT NULL COMMENT '零件id',
    `consume_id`      int(11) DEFAULT NULL COMMENT '费用id',
    `type`            tinyint(1) DEFAULT NULL COMMENT ' 类型  1入库 2出库',
    `number`          int(11) DEFAULT NULL COMMENT '入库数量',
    `odd_numbers`     varchar(255) DEFAULT NULL COMMENT '入库单号',
    `storage_time`    date         DEFAULT NULL COMMENT '入库时间',
    `desc`            varchar(255) DEFAULT '' COMMENT '备注信息',
    `create_staff_id` int(11) DEFAULT NULL COMMENT '创建人',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='产品库存';



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_parts_stock_reload
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_parts_stock_reload`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `type`            tinyint(1) DEFAULT NULL COMMENT ' 类型  1入库 2出库',
    `odd_numbers`     varchar(255) DEFAULT NULL COMMENT '单号',
    `storage_time`    date         DEFAULT NULL COMMENT '时间',
    `desc`            varchar(255) DEFAULT '' COMMENT '备注信息',
    `parts`           text COMMENT '详情',
    `create_staff_id` int(11) DEFAULT NULL COMMENT '创建人',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    `check_status`    tinyint(1) DEFAULT '0' COMMENT '0待审核、1审核中、2审核通过、3审核未通过、4撤销',
    `flow_staff_ids`   varchar(64)  DEFAULT NULL COMMENT '流程审批人ID',
    `check_staff_ids`  varchar(64)  DEFAULT NULL COMMENT '已审批人IDs',
    `flow_id` int(11) NULL DEFAULT NULL COMMENT '审核流程ID',
  `order_id` int(11) NULL DEFAULT NULL COMMENT '审批流程步骤id',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='产品库存申请记录';



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_person
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_person`
(
    `id`           int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
    `customer_id`  int(10) NOT NULL COMMENT '客户id',
    `account`      varchar(11) COLLATE utf8mb4_unicode_ci  DEFAULT '' COMMENT '手机号',
    `nickname`     varchar(50) COLLATE utf8mb4_unicode_ci  DEFAULT '' COMMENT '昵称',
    `password`     varchar(32) COLLATE utf8mb4_unicode_ci  DEFAULT '' COMMENT '密码',
    `salt`         varchar(30) COLLATE utf8mb4_unicode_ci  DEFAULT '' COMMENT '密码盐',
    `email`        varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '电子邮箱',
    `avatar`       varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '头像',
    `bio`          varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '格言',
    `token`        varchar(50) COLLATE utf8mb4_unicode_ci  DEFAULT '' COMMENT 'Token',
    `status`       varchar(30) COLLATE utf8mb4_unicode_ci  DEFAULT '' COMMENT '状态',
    `verification` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '验证',
    `createtime`   int(10) DEFAULT NULL COMMENT '创建时间',
    `updatetime`   int(10) DEFAULT NULL COMMENT '更新时间',
    `deletetime`   int(10) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE,
    KEY            `email` (`email`) USING BTREE,
    KEY            `mobile` (`account`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户表（不知名端）';



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_person_cart
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_person_cart`
(
    `id`        int(4) NOT NULL AUTO_INCREMENT,
    `person_id` int(4) DEFAULT NULL COMMENT '联系人id',
    `parts_id`  int(4) DEFAULT NULL COMMENT '备件id',
    `num`       int(4) DEFAULT NULL COMMENT '数量',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='购物车表';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_person_order
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_person_order`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `order_sn`        varchar(20) CHARACTER SET utf8mb4   DEFAULT NULL COMMENT '订单号',
    `customer_id`     int(11) DEFAULT NULL COMMENT '商户id',
    `company`         varchar(255)                        DEFAULT NULL COMMENT '客户名称',
    `person_id`       int(11) DEFAULT '0' COMMENT '用户',
    `parts`           text CHARACTER SET utf8mb4 COMMENT '购买零件',
    `parts_amount`    decimal(10, 2)                      DEFAULT '0.00' COMMENT '商品总价',
    `dispatch_amount` decimal(10, 2)                      DEFAULT '0.00' COMMENT '运费',
    `amount`          decimal(10, 2)                      DEFAULT NULL COMMENT '总费用',
    `linkmobile`      varchar(20) CHARACTER SET utf8mb4   DEFAULT NULL COMMENT '联系电话',
    `linkname`        varchar(20) CHARACTER SET utf8mb4   DEFAULT NULL COMMENT '收货人',
    `addrcity`        varchar(20) CHARACTER SET utf8mb4   DEFAULT NULL COMMENT '省市区',
    `address`         varchar(255) CHARACTER SET utf8mb4  DEFAULT NULL COMMENT '详细地址',
    `status`          tinyint(2) DEFAULT '0' COMMENT '订单状态:0=未支付,1=已支付,2=支付失败',
    `remark`          varchar(255) CHARACTER SET utf8mb4  DEFAULT NULL COMMENT '用户备注',
    `pay_type`        enum('wechat','alipay','wallet','score') CHARACTER SET utf8mb4 DEFAULT 'wechat' COMMENT '支付方式:wechat=微信支付,alipay=支付宝,wallet=钱包支付,score=积分支付',
    `transaction_id`  varchar(60) CHARACTER SET utf8mb4   DEFAULT NULL COMMENT '交易单号',
    `payment_json`    varchar(2500) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '交易原始数据',
    `paytime`         int(11) DEFAULT NULL COMMENT '支付时间',
    `ext`             varchar(255) CHARACTER SET utf8mb4  DEFAULT NULL COMMENT '附加字段',
    `createtime`      int(11) DEFAULT NULL COMMENT '创建时间',
    `updatetime`      int(11) DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE,
    KEY               `person_id_index` (`person_id`) USING BTREE,
    KEY               `order_sn_index` (`order_sn`) USING BTREE,
    KEY               `customer_id_index` (`customer_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='用户支付订单';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_praise
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_praise`
(
    `id`            int(11) NOT NULL AUTO_INCREMENT,
    `staff_id`      int(11) DEFAULT NULL COMMENT '用户ID',
    `relation_type` tinyint(1) DEFAULT '0' COMMENT '1 动态 2 跟进记录',
    `relation_id`   int(11) DEFAULT NULL COMMENT 'ID',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='点赞表';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_product
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_product`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `type_id`         int(11) DEFAULT NULL COMMENT '类型',
    `name`            varchar(128)   DEFAULT '' COMMENT '产品名称',
    `stock`           varchar(255)   DEFAULT NULL COMMENT '产品库存数量',
    `num`             varchar(128)   DEFAULT '' COMMENT '产品编码',
    `img`             varchar(200)   DEFAULT NULL COMMENT '产品图片',
    `banners`         varchar(255)   DEFAULT NULL COMMENT '产品多图',
    `unit`            varchar(128)   DEFAULT '箱' COMMENT '单位',
    `product_line`    varchar(255)   DEFAULT NULL COMMENT '产品线',
    `bar_code`        varchar(255)   DEFAULT NULL COMMENT '条形码',
    `price`           decimal(18, 2) DEFAULT '0.00' COMMENT '标准价格',
    `tax_price`       decimal(10, 2) DEFAULT NULL COMMENT '含税价格',
    `status`          varchar(32)    DEFAULT '上架' COMMENT '是否上架',
    `part`            text COMMENT '组成部分,json字符串',
    `description`     text COMMENT '产品描述',
    `create_staff_id` int(11) DEFAULT NULL COMMENT '创建人',
    `update_staff_id` int(11) DEFAULT NULL COMMENT '最后一次更新人',
    `createtime`      int(11) DEFAULT NULL COMMENT '创建时间',
    `updatetime`      int(11) DEFAULT NULL COMMENT '更新时间',
    `deletetime`      int(10) DEFAULT NULL COMMENT '删除时间',
    `content`         text COMMENT '组成部分',
     `goods_id` int(11) NULL DEFAULT NULL COMMENT '商品ID',
    `type` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '规格',
     `min_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '最低销售价',
  `cost_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '成本价',
  `wholesale` decimal(10, 2) NULL DEFAULT NULL COMMENT '批发价',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_product_other
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_product_other`
(
    `id`    int(11) NOT NULL AUTO_INCREMENT COMMENT '产品id',
    `other` text COMMENT '自定义信息 json',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_product_type
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_product_type`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `pid`             int(11) DEFAULT NULL COMMENT '上级分类id',
    `name`            varchar(255) DEFAULT NULL COMMENT '分类名称',
    `sort`            int(4) DEFAULT '10' COMMENT '排序',
    `speci`           varchar(255) DEFAULT NULL COMMENT '规格',
    `description`     text COMMENT '备注说明',
    `config_ids`      varchar(255) DEFAULT NULL COMMENT '规格ids',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    `create_staff_id` int(11) DEFAULT NULL COMMENT '创建人',
     `image` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '分类图片',
  `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '内容',
  `status` tinyint(1) NULL DEFAULT NULL COMMENT '状态',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='售后问题分类';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_product_type_config
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_product_type_config`
(
    `id`         int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
    `type_id`    int(11) DEFAULT '0' COMMENT '类型id，默认0',
    `pid`        int(11) DEFAULT '0' COMMENT '上级id,默认0',
    `name`       varchar(255) DEFAULT NULL COMMENT '名称',
    `num`        int(11) DEFAULT '1' COMMENT '数量',
    `unit`       varchar(10)  DEFAULT NULL COMMENT '单位',
    `remark`     varchar(255) DEFAULT NULL COMMENT '备注',
    `sort`       int(11) DEFAULT '5' COMMENT '排序',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='配置清单';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_proofing
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_proofing`
(
    `id`                             int(11) NOT NULL AUTO_INCREMENT,
    `customer_id`                    int(11) DEFAULT NULL COMMENT '客户id',
    `process_type`                   tinyint(3) DEFAULT '0' COMMENT '进度状态',
    `process_number`                 varchar(128)  DEFAULT NULL COMMENT '打样编号',
    `application_name`               varchar(32)   DEFAULT NULL COMMENT '申请人',
    `application_department`         varchar(32)   DEFAULT NULL COMMENT '申请部门',
    `application_date`               varchar(32)   DEFAULT NULL COMMENT '申请时间',
    `sample_name`                    varchar(128)  DEFAULT NULL COMMENT '样品名称',
    `sample_number`                  varchar(32)   DEFAULT NULL COMMENT '样品数量',
    `sample_material`                varchar(32)   DEFAULT NULL COMMENT '样品材质',
    `sample_provision`               varchar(32)   DEFAULT NULL COMMENT '样品提供',
    `provisio_desc`                  varchar(255)  DEFAULT NULL COMMENT '样品来源',
    `completion_date`                date          DEFAULT NULL COMMENT '要求完成时间',
    `proofing_reason`                varchar(32)   DEFAULT NULL COMMENT '打样原因',
    `device_name`                    text DEFAULT NULL COMMENT '设备名称',
    `device_config`                  varchar(255)  DEFAULT NULL COMMENT '设备配置',
    `sample_preservation`            varchar(32)   DEFAULT NULL COMMENT '样品保存',
    `accuracy`                       varchar(255)  DEFAULT NULL COMMENT '精度要求\n\n',
    `appearance`                     varchar(255)  DEFAULT NULL COMMENT '外观要求\n\n外观要求\n\n外观要求\n\n外观要求',
    `speed`                          varchar(255)  DEFAULT NULL COMMENT '速度要求\n\n',
    `others`                         varchar(255)  DEFAULT NULL COMMENT '其他要求\n\n',
    `test_result`                    tinyint(1) DEFAULT '0' COMMENT '测试结果  1成功  9 失败',
    `accuracy_result`                varchar(255)  DEFAULT NULL COMMENT '精度测试结果\n\n精度要求测试结果',
    `appearance_result`              varchar(255)  DEFAULT NULL COMMENT '外观测试结果',
    `speed_result`                   varchar(255)  DEFAULT NULL COMMENT '速度测试结果',
    `others_result`                  varchar(255)  DEFAULT NULL COMMENT '其他测试结果',
    `tester`                         varchar(32)   DEFAULT NULL COMMENT '测试人员名称',
    `proposal`                       varchar(255)  DEFAULT NULL COMMENT '改善建议',
    `qualified_number`               varchar(32)   DEFAULT NULL COMMENT '合格数量',
    `loss_number`                    varchar(32)   DEFAULT NULL COMMENT '损耗数量',
    `recommended`                    varchar(255)  DEFAULT NULL COMMENT '建议配置',
    `machine_name`                   varchar(128)  DEFAULT NULL COMMENT '机器名称',
    `machine_desc`                   varchar(255)  DEFAULT NULL COMMENT '机器备注',
    `machine_application_date`       varchar(32)   DEFAULT NULL COMMENT '机器申请时间',
    `machine_application_department` varchar(32)   DEFAULT NULL COMMENT '机器申请部门',
    `machine_application_name`       varchar(32)   DEFAULT NULL COMMENT '机器申请人',
    `fail_reason`                    varchar(255)  DEFAULT NULL COMMENT '失败原因',
    `file_ids`                       varchar(50)   DEFAULT NULL COMMENT '附件ID',
    `create_staff_id`                int(11) DEFAULT NULL COMMENT '创建人',
    `owner_staff_id`                 int(11) DEFAULT NULL COMMENT '负责人',
    `show_staff_id`                  varchar(255)  DEFAULT NULL COMMENT '显示人',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_proofing_result
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_proofing_result`
(
    `id`                int(11) NOT NULL AUTO_INCREMENT,
    `proofing_id`       int(11) DEFAULT NULL COMMENT '打样id',
    `test_result`       tinyint(1) DEFAULT '0' COMMENT '测试结果  1成功  9 失败',
    `accuracy_result`   varchar(255) DEFAULT NULL COMMENT '精度测试结果\n\n精度要求测试结果',
    `appearance_result` varchar(255) DEFAULT NULL COMMENT '外观测试结果',
    `speed_result`      varchar(255) DEFAULT NULL COMMENT '速度测试结果',
    `others_result`     varchar(255) DEFAULT NULL COMMENT '其他测试结果',
    `tester`            varchar(32)  DEFAULT NULL COMMENT '测试人员名称',
    `proposal`          varchar(255) DEFAULT NULL COMMENT '改善建议',
    `qualified_number`  varchar(32)  DEFAULT NULL COMMENT '合格数量',
    `loss_number`       varchar(32)  DEFAULT NULL COMMENT '损耗数量',
    `fail_reason`       varchar(255) DEFAULT NULL COMMENT '失败原因',
    `recommended`       varchar(255) DEFAULT NULL COMMENT '建议配置',
    `create_staff_id`   int(11) DEFAULT NULL COMMENT '创建人',
    `owner_staff_id`    int(11) DEFAULT NULL COMMENT '负责人',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='售后工单';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_push_reload
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_push_reload`
(
    `id`          int(11) NOT NULL AUTO_INCREMENT,
    `openid`      varchar(255) DEFAULT NULL COMMENT 'openID',
    `template_id` varchar(255) DEFAULT NULL COMMENT '模板ID',
    `data`        text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '数据',
    `pagepath`    varchar(255) DEFAULT NULL COMMENT '信息',
    `errcode`     varchar(50)  DEFAULT NULL COMMENT 'code',
    `result`      varchar(255) DEFAULT NULL COMMENT '结果',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='微信推送记录';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_quote
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_quote`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `number`          varchar(255)   DEFAULT NULL COMMENT '报价单编号',
    `customer_id`     int(11) DEFAULT NULL COMMENT '客户id',
    `contacts_id`     int(11) DEFAULT NULL COMMENT '客户联系人id',
    `contract_id`     int(11) DEFAULT NULL COMMENT '转化的合同id',
    `quote_date`      date           DEFAULT NULL COMMENT '报价时间',
    `discount_amount` decimal(18, 2) DEFAULT NULL COMMENT '优惠金额',
    `quote_amount`    decimal(18, 2) DEFAULT NULL COMMENT '报价金额',
    `file_ids`        varchar(64)    DEFAULT NULL COMMENT '附件列表',
    `status`          tinyint(1) DEFAULT '0' COMMENT '0 进行中 1 转化成功  9作废',
    `create_staff_id` int(11) DEFAULT NULL COMMENT '创建人ID',
    `owner_staff_id`  int(11) DEFAULT NULL COMMENT '负责人ID',
    `order_staff_id`  int(11) DEFAULT NULL COMMENT '公司签约人',
    `check_status`    tinyint(4) DEFAULT '0' COMMENT '0待审核、1审核中、2审核通过、3审核未通过、4撤销、',
    `flow_staff_ids`   varchar(255)   DEFAULT '' COMMENT '流程审批人ID',
    `check_staff_ids`  varchar(255)   DEFAULT '' COMMENT '已审批人IDs',
    `show_staff_id`   varchar(255)   DEFAULT NULL COMMENT '显示人',
    `next_staff_id`   int(4) DEFAULT NULL COMMENT '下一个审批人id',
    `clause`          text  DEFAULT NULL COMMENT '特约条款',
    `product_type`    text  DEFAULT NULL COMMENT '产品类型',
    `flow_id` int(11) NULL DEFAULT NULL COMMENT '审核流程ID',
  `order_id` int(11) NULL DEFAULT NULL COMMENT '审批流程步骤id',
  `ro_staff_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '只读权限',
  `rw_staff_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '读写权限',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='报价单';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_quote_file
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_quote_file`
(
    `id`         int(11) NOT NULL AUTO_INCREMENT,
    `quote_id`   int(11) NOT NULL COMMENT '报价ID',
    `file_id`    int(11) NOT NULL COMMENT '附件ID',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `create_id`  int(11) DEFAULT NULL COMMENT '创建人',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='合同附件';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_quote_other
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_quote_other`
(
    `id`    int(11) NOT NULL AUTO_INCREMENT,
    `other` text COMMENT '自定义信息 json',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_quote_product
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_quote_product`
(
    `id`          int(11) NOT NULL AUTO_INCREMENT,
    `quote_id`    int(11) DEFAULT NULL COMMENT '报价单id',
    `type_id`     int(11) DEFAULT NULL COMMENT '类型',
    `product_id`  int(11) DEFAULT NULL COMMENT '产品',
    `number`      int(11) DEFAULT NULL COMMENT '数量',
    `price`       decimal(10, 2) DEFAULT NULL COMMENT '购买价格',
    `config_desc` varchar(255)   DEFAULT NULL COMMENT '配置说明',
    `remarks`     varchar(255)   DEFAULT NULL COMMENT '备注',
    `config`      text,
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_receivables
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_receivables`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `plan_id`         int(11) DEFAULT NULL COMMENT '回款计划ID',
    `number`          varchar(100)   DEFAULT '' COMMENT '回款编号',
    `customer_id`     int(11) DEFAULT NULL COMMENT '客户ID',
    `contract_id`     int(11) DEFAULT NULL COMMENT '合同ID',
    `return_time`     date           DEFAULT NULL COMMENT '回款日期',
    `return_type`     varchar(64)    DEFAULT '' COMMENT '回款方式',
    `money`           decimal(18, 2) DEFAULT '0.00' COMMENT '回款金额',
    `check_status`    tinyint(4) DEFAULT '0' COMMENT '0待审核、1审核中、2审核通过、3审核未通过、4撤销、5草稿(未提交)',
    `flow_staff_ids`   varchar(255)   DEFAULT '' COMMENT '流程审批人ID',
    `check_staff_ids`  varchar(255)   DEFAULT '' COMMENT '已审批人IDs',
    `remarks`         text COMMENT '备注',
    `create_staff_id` int(10) DEFAULT NULL COMMENT '创建人ID',
    `owner_staff_id`  int(10) DEFAULT NULL COMMENT '负责人ID',
    `flow_id` int(11) NULL DEFAULT NULL COMMENT '审核流程ID',
    `order_id` int(11) NULL DEFAULT NULL COMMENT '审批流程步骤id',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='回款表';



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_receivables_other
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_receivables_other`
(
    `id`    int(11) NOT NULL AUTO_INCREMENT COMMENT '客户id',
    `otherdata` text COMMENT '自定义信息 json',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_receivables_plan
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_receivables_plan`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `num`             varchar(100)   NOT NULL DEFAULT '' COMMENT '期数',
    `receivables_id`  int(11) NOT NULL DEFAULT '0' COMMENT '回款ID',
    `status`          tinyint(4) NOT NULL DEFAULT '0' COMMENT '0进行中 1完成 2逾期',
    `contract_id`     int(11) NOT NULL COMMENT '合同ID',
    `customer_id`     int(11) NOT NULL COMMENT '客户ID',
    `money`           decimal(18, 2) NOT NULL DEFAULT '0.00' COMMENT '计划回款金额',
    `return_date`     date                    DEFAULT NULL COMMENT '计划回款日期',
    `return_type`     varchar(64)    NOT NULL DEFAULT '' COMMENT '计划回款方式',
    `remind`          tinyint(4) NOT NULL DEFAULT '0' COMMENT '提前几天提醒',
    `remind_date`     date                    DEFAULT NULL COMMENT '提醒日期',
    `remarks`         varchar(255)   NOT NULL DEFAULT '' COMMENT '备注',
    `file`            varchar(255)   NOT NULL DEFAULT '' COMMENT '附件',
    `create_staff_id` int(11) NOT NULL COMMENT '创建人ID',
    `owner_staff_id`  int(11) NOT NULL COMMENT '负责人ID',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='回款计划表';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_staff
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_staff`
(
    `id`               int(11) NOT NULL AUTO_INCREMENT,
    `admin_id`         int(11) NOT NULL COMMENT '关联后台账号id',
    `group_ids`        varchar(100)                                                 DEFAULT NULL COMMENT '角色组列表',
    `role`             tinyint(2) DEFAULT NULL COMMENT '角色角色 1最高管理员 2公司管理员 3部门经理 4部门主管 5组长 6员工',
    `rules`            text                                                DEFAULT NULL COMMENT '权限列表',
    `name`             varchar(64)                                                  DEFAULT NULL COMMENT '姓名',
    `mobile`           varchar(32)                                                  DEFAULT NULL COMMENT '手机号码',
    `salt`             varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '密码盐',
    `password`         varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '密码',
    `is_edit_password` tinyint(1) DEFAULT '0' COMMENT '是否修改过密码',
    `nickname`         varchar(64)                                                  DEFAULT NULL COMMENT '昵称',
    `img`              varchar(255)                                                 DEFAULT NULL COMMENT '头像',
    `num`              varchar(64)                                                  DEFAULT NULL COMMENT '员工编号',
    `email`            varchar(64)                                                  DEFAULT NULL COMMENT '邮箱',
    `email_code`       varchar(20)                                                  DEFAULT NULL COMMENT '邮箱授权码',
    `sex`              tinyint(1) DEFAULT NULL COMMENT '1男 2女',
    `department_id`    int(11) DEFAULT NULL COMMENT '部门id、',
    `post`             varchar(32)                                                  DEFAULT NULL COMMENT '岗位',
    `parent_id`        int(11) DEFAULT NULL COMMENT '直属上级ID',
    `openid`           varchar(64)                                                  DEFAULT NULL COMMENT '小程序openid',
    `unionid`          varchar(64)                                                  DEFAULT NULL COMMENT '微信unionid',
    `wx_openid`        varchar(64)                                                  DEFAULT NULL COMMENT '微信公众号openid',
    `status`           tinyint(1) DEFAULT '1' COMMENT '用户状态 0待审核 1启用 2禁用',
    `touser` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '企业微信touser',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='员工列表';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_staff_collect
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_staff_collect`
(
    `id`            int(11) NOT NULL AUTO_INCREMENT,
    `staff_id`      int(10) DEFAULT NULL COMMENT '销售ID',
    `relation_type` tinyint(2) DEFAULT NULL COMMENT '关联类型 1 客户 2 联系人 3合同',
    `relation_id`   int(10) DEFAULT NULL COMMENT '关联ID',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='重点关注表';



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_staff_department
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_staff_department`
(
    `id`         int(11) NOT NULL AUTO_INCREMENT,
    `name`       varchar(128) DEFAULT NULL COMMENT '部门名称',
    `pid`        int(10) DEFAULT '0' COMMENT '上级ID',
    `type` int(1) NULL DEFAULT 0 COMMENT '0:钉钉  1：微信',
  `number` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信唯一编号',
  `status` int(1) NULL DEFAULT 0 COMMENT '0:未同步 1已同步',
  `role_id` int(11) NULL DEFAULT NULL COMMENT '同步ID',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='员工部门表';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_staff_email
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_staff_email`
(
    `id`         int(8) NOT NULL AUTO_INCREMENT,
    `send_id`    int(8) DEFAULT NULL COMMENT '发件人id',
    `send_name`  varchar(50)  DEFAULT NULL COMMENT '发件人名字',
    `receiver`   varchar(200) DEFAULT NULL COMMENT '收件人账号(多个,隔开)',
    `receive_id` varchar(100) DEFAULT NULL COMMENT '联系人Id(多个,隔开)',
    `copyor`     varchar(255) DEFAULT NULL COMMENT '抄送人',
    `theme`      varchar(200) DEFAULT NULL COMMENT '主题',
    `content`    text COMMENT '发送内容',
    `imgs`       text COMMENT '图片',
    `attach`     text COMMENT '附件',
    `file_ids`   varchar(255) DEFAULT NULL COMMENT '附件ids',
    `is_send`    tinyint(1) DEFAULT '1' COMMENT '0草稿箱1已发送',
    `sendtime`   datetime     DEFAULT NULL COMMENT '发送时间/接受时间',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COMMENT='邮件接受';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_staff_receive_email
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_staff_receive_email`
(
    `id`           int(8) NOT NULL AUTO_INCREMENT,
    `uuid`         int(20) NOT NULL COMMENT '唯一值',
    `staff_id`     int(8) DEFAULT NULL COMMENT '收件人id',
    `staff_name`   varchar(50)  DEFAULT NULL COMMENT '收件人 名字',
    `from_account` varchar(20)  DEFAULT NULL COMMENT '发件账号',
    `from_name`    varchar(20)  DEFAULT NULL COMMENT '发件人名字',
    `theme`        varchar(200) DEFAULT NULL COMMENT '主题',
    `content`      text COMMENT '发送内容',
    `imgs`         varchar(255) DEFAULT NULL COMMENT '图片',
    `attach`       varchar(255) DEFAULT NULL COMMENT '附件(文件/图片)',
    `is_read`      tinyint(1) DEFAULT '0' COMMENT '0未读1已读',
    `is_delete`    tinyint(1) DEFAULT '0' COMMENT '0正常1删除',
    `receivetime`  datetime     DEFAULT NULL COMMENT '发送时间',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='邮件接受';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_staff_rule
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_staff_rule`
(
    `id`     int(10) unsigned NOT NULL AUTO_INCREMENT,
    `type`   enum('menus','operation','fields','data') COLLATE utf8mb4_unicode_ci DEFAULT 'menus' COMMENT 'menu为菜单,file为权限节点',
    `pid`    int(10) unsigned DEFAULT '0' COMMENT '父ID',
    `name`   varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '规则名称',
    `title`  varchar(50) COLLATE utf8mb4_unicode_ci  DEFAULT '' COMMENT '规则名称',
    `remark` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '备注',
    `weigh`  int(10) DEFAULT '0' COMMENT '权重',
    `status` varchar(30) COLLATE utf8mb4_unicode_ci  DEFAULT '' COMMENT '状态',
    PRIMARY KEY (`id`) USING BTREE,
    KEY      `pid` (`pid`) USING BTREE,
    KEY      `weigh` (`weigh`) USING BTREE,
    KEY      `name` (`name`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='节点表';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_staff_sign_in
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_staff_sign_in`
(
    `id`               int(11) NOT NULL AUTO_INCREMENT,
    `customer_id`      int(10) DEFAULT NULL COMMENT '客户id',
    `customer_status`  tinyint(1) DEFAULT NULL COMMENT ' 1 已成交 0未成交',
    `relation_type`    varchar(32)   DEFAULT NULL COMMENT '关联类型',
    `relation_id`      int(11) DEFAULT NULL COMMENT '关联id',
    `relation_process` varchar(64)   DEFAULT NULL COMMENT '关联进度',
    `event_id`         int(11) DEFAULT NULL COMMENT '日程id',
    `location`         varchar(255)  DEFAULT NULL COMMENT '地理位置',
    `lng`              varchar(32)   DEFAULT NULL COMMENT '经度',
    `lat`              varchar(32)   DEFAULT NULL COMMENT '维度',
    `file_ids`            varchar(128)  DEFAULT NULL COMMENT '附件',
    `content`          text DEFAULT NULL COMMENT '签到详情',
    `staff_id`         int(11) DEFAULT NULL COMMENT '创建人',
    `reminds_id`       varchar(64)   DEFAULT NULL COMMENT '提醒人列表',
    `distance`         varchar(32)   DEFAULT NULL COMMENT '与客户距离',
    `working_time`     int(10) DEFAULT NULL COMMENT '工作时长',
    `trip_distance`    int(10) DEFAULT NULL COMMENT '出行距离',
    `other` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
    `next_time` datetime NULL DEFAULT NULL COMMENT '下次跟进时间',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE,
    KEY                `staff_id_index` (`staff_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='员工签到';



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_staff_sign_in_read
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_staff_sign_in_read`
(
    `id`         int(11) NOT NULL AUTO_INCREMENT,
    `staff_id`   int(10) DEFAULT NULL COMMENT '创建人',
    `sign_in_id` int(10) DEFAULT NULL COMMENT '签到ID',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE,
    KEY          `staff_id` (`staff_id`) USING BTREE,
    KEY          `record_id` (`sign_in_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='签到已读记录';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_staff_team
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_staff_team`
(
    `id`               int(11) NOT NULL AUTO_INCREMENT,
    `name`             varchar(128)  DEFAULT NULL COMMENT '团队名称',
    `number`           tinyint(3) DEFAULT NULL COMMENT '现有人数',
    `staff_id`         int(11) DEFAULT NULL COMMENT '团队 负责人',
    `status`           tinyint(1) DEFAULT '1' COMMENT '0 停用 1启用',
    `notice_staff_ids` varchar(128)  DEFAULT NULL COMMENT '业务通知人',
    `flow`             text DEFAULT NULL COMMENT '团队',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='员工团队';

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_staff_team_list
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_staff_team_list`
(
    `id`         int(11) NOT NULL AUTO_INCREMENT,
    `team_id`    int(11) DEFAULT NULL COMMENT '团队id',
    `staff_id`   int(11) DEFAULT NULL COMMENT '团队成员',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='员工团队';


CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_text_template`
(
    `id`         int(11) NOT NULL AUTO_INCREMENT,
    `type`       varchar(64) DEFAULT NULL COMMENT '模板 类型',
    `content`    text COMMENT '内容',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='备注模板表';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_text_template
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_text_template`
(
    `id`         int(11) NOT NULL AUTO_INCREMENT,
    `type`       varchar(64) DEFAULT NULL COMMENT '模板 类型',
    `content`    text COMMENT '内容',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='备注模板表';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_work_report
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_work_report`
(
    `id`                 int(11) NOT NULL AUTO_INCREMENT,
    `staff_id`           int(10) DEFAULT NULL COMMENT '员工ID',
    `report_date`        date          DEFAULT NULL COMMENT '报告时间',
    `type`               varchar(32)   DEFAULT NULL COMMENT '日 周 月 季 年',
    `follow_up`          text DEFAULT NULL COMMENT '跟进次数',
    `customer`           text DEFAULT NULL COMMENT '客户',
    `quote`              text DEFAULT NULL COMMENT '报价单',
    `visit`              text DEFAULT NULL COMMENT '拜访',
    `contract`           text DEFAULT NULL COMMENT '合同',
    `order`              varchar(255)  DEFAULT NULL COMMENT '订单',
    `workorder`          text DEFAULT NULL COMMENT '工单',
    `receivables`        text DEFAULT NULL COMMENT '回款',
    `complete_workorder` text DEFAULT NULL COMMENT '完成工单数量',
    `good_workorder`     text DEFAULT NULL COMMENT '好评工单数量',
    `not_event`          text DEFAULT NULL COMMENT '未完成日程',
    `complete_event`     text DEFAULT NULL COMMENT '已完成日程',
    `report_data`        text DEFAULT NULL COMMENT '报告详情',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for __PREFIX__qingdongams_workorder
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_workorder`
(
    `id`                   int(11) NOT NULL AUTO_INCREMENT,
    `customer_id`          int(10) DEFAULT NULL COMMENT '客户id',
    `contacts_id`          int(10) DEFAULT NULL COMMENT '联系人id',
    `contract_id`          int(10) DEFAULT NULL COMMENT '合同id',
    `person_id`            int(10) DEFAULT NULL COMMENT '用户端id',
    `status`               tinyint(1) DEFAULT '0' COMMENT '工单状态 0待分配 1待处理 2处理中 3已完成  9已取消',
    `process`              tinyint(3) DEFAULT '0' COMMENT '进程 0  1备货中 2备货完成  3 到访/录入物流信息 9已送达',
    `is_pause`             tinyint(1) DEFAULT NULL COMMENT '暂停工单 0否 1是',
    `is_timeout`           tinyint(1) DEFAULT NULL COMMENT '是否超时 0否 1是',
    `is_mobile`            tinyint(1) DEFAULT '0' COMMENT '是否 已电话沟通 0否 1是',
    `is_install`           tinyint(1) DEFAULT NULL COMMENT '是否安装  0 否 1是',
    `mobile_result`        tinyint(3) DEFAULT NULL COMMENT '电话结果 ，  1 已解决    11 上门服务 12 返厂维修',
    `logistics_type`       varchar(32)  DEFAULT NULL COMMENT '返厂运输方式',
    `title`                varchar(255) DEFAULT NULL COMMENT '工单标题',
    `address`              varchar(64)  DEFAULT NULL COMMENT '地址',
    `aftermarket_type_ids` varchar(255) DEFAULT NULL COMMENT '问题分类id列表',
    `workorder_number`     varchar(64)  DEFAULT NULL COMMENT '工单编号',
    `workorder_type`       varchar(255) DEFAULT NULL COMMENT '工单类型 (产品发货 上门安装 上门维修 定期检修 产品设计  生产设备 配件发货 配件安装)',
    `address_detail`       varchar(128) DEFAULT NULL COMMENT '详细地址',
    `linkman`              varchar(50)  DEFAULT NULL COMMENT '联系人',
    `linkfun`              varchar(50)  DEFAULT NULL COMMENT '联系方式',
    `lng`                  double(16, 12) DEFAULT NULL COMMENT '地理位置经度',
  `lat` double(16,12) DEFAULT NULL COMMENT '地理位置维度',
  `customer_product_id` text DEFAULT NULL COMMENT '客户已有产品id',
  `product_part` varchar(255) DEFAULT NULL COMMENT '配件',
  `appointment_time` date DEFAULT NULL COMMENT '预约时间',
  `priority` varchar(32) DEFAULT NULL COMMENT '一般 紧急 非常紧急',
  `desc` text DEFAULT NULL COMMENT '情况说明',
  `matters` text DEFAULT NULL COMMENT '注意事项',
  `accept_time` int(11) DEFAULT NULL COMMENT '接受工单时间',
  `expected_end_time` int(11) DEFAULT NULL COMMENT '预计完成时间',
  `start_time` int(11) DEFAULT NULL COMMENT '开始处理时间',
  `stock_up_time` int(11) DEFAULT NULL COMMENT '备货完成时间',
  `end_time` int(11) DEFAULT NULL COMMENT '结束时间',
  `results` text DEFAULT NULL COMMENT '处理结果',
  `parts` text DEFAULT NULL COMMENT '带出零件',
  `use_parts` text DEFAULT NULL COMMENT '使用的零件',
  `surplus_parts` text DEFAULT NULL COMMENT '剩余零件',
  `pay_service` text DEFAULT NULL COMMENT '收费项目列表',
  `total_money` decimal(10,2) DEFAULT NULL COMMENT '总费用',
  `discount_money` decimal(10,2) DEFAULT NULL COMMENT '优惠金额',
  `discount_desc` varchar(255) DEFAULT NULL COMMENT '优惠备注',
  `money` decimal(10,2) DEFAULT NULL COMMENT '收取费用',
  `resolved_results` tinyint(3) DEFAULT NULL COMMENT '上门结果 ，  1 已解决   9未解决   12 返厂维修',
  `is_pay` tinyint(1) DEFAULT NULL COMMENT '是否支付 0未支付 1已支付',
  `pay_type` varchar(32) DEFAULT NULL COMMENT '支付方式',
  `pay_files` varchar(64) DEFAULT NULL COMMENT '支付凭证',
  `pay_order` varchar(64) DEFAULT NULL COMMENT '支付订单号',
  `pay_time` int(10) DEFAULT NULL COMMENT '支付时间',
  `is_financial_audit` tinyint(1) DEFAULT '0' COMMENT '财务是否审核 0 未审核 1 已审核 9未收款',
  `is_resolved` tinyint(1) DEFAULT NULL COMMENT '是否解决问题 1是 2否',
  `is_over` tinyint(2) DEFAULT NULL COMMENT ' 是否过保 1 过保 2未过保',
  `comment_score` tinyint(1) DEFAULT NULL COMMENT '评分 1-5',
  `comment_content` text DEFAULT NULL COMMENT '评价内容',
  `comment_files` varchar(32) DEFAULT NULL COMMENT '评论图片',
  `aftermarket_ids` varchar(32) DEFAULT NULL COMMENT '解决方案id',
  `aftermarket_text` text DEFAULT NULL COMMENT '其他方案',
  `create_type` tinyint(1) DEFAULT '1' COMMENT '提出方1员工看create_staff_id  2 联系人看person_id',
  `check_status` tinyint(2) DEFAULT NULL COMMENT '审核费用 0无、1审核中、2审核通过、3审核未通过、4撤销、',
  `flow_staff_ids` varchar(64) DEFAULT NULL COMMENT '流程审批人ID',
  `check_staff_ids` varchar(64) DEFAULT NULL COMMENT '已审批人IDs',
  `create_staff_id` int(10) DEFAULT NULL COMMENT '创建人',
  `owner_staff_id` int(10) DEFAULT NULL COMMENT '负责人',
  `show_staff_id` varchar(255) DEFAULT NULL COMMENT '可查看员工id',
  `relation_workorder_id` int(11) DEFAULT NULL COMMENT '关联工单id',
  `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
  `car_type` varchar(255) DEFAULT NULL COMMENT '出行工具',
  `car_number` varchar(255) DEFAULT NULL COMMENT '车牌号',
  `start_mileage` varchar(255) DEFAULT NULL COMMENT '起始公里shu',
  `end_mileage` varchar(255) DEFAULT NULL COMMENT '结束公里数',
  `delivery_time` varchar(32) DEFAULT NULL COMMENT '要求交期时间',
  `actual_delivery_time` varchar(32) DEFAULT NULL COMMENT '实际交期时间',
  `delivery_address` varchar(255) DEFAULT NULL COMMENT '交货地点',
  `delivery_address_detail` varchar(255) DEFAULT NULL,
  `remarks` text DEFAULT NULL COMMENT '备注',
  `consignee` varchar(255) DEFAULT NULL COMMENT '收货人',
  `consignee_mobile` varchar(255) DEFAULT NULL COMMENT '收货人联系方式',
  `total` varchar(32) DEFAULT NULL COMMENT '总数',
  `spot_check` varchar(32) DEFAULT NULL COMMENT '抽检数',
  `bad_number` varchar(32) DEFAULT NULL COMMENT '不良数',
  `checkpoint` varchar(255) DEFAULT NULL COMMENT '发现地点',
  `product_name` varchar(255) DEFAULT NULL COMMENT '产品名称',
  `checker_name` varchar(255) DEFAULT NULL COMMENT '检验员',
  `autograph_url` varchar(255) DEFAULT NULL COMMENT '签名图片',
  `is_autograph` tinyint(1) DEFAULT '0' COMMENT '0否 1是 签名',
  `is_replace` tinyint(1) DEFAULT NULL COMMENT '0否 1 更换 ',
  `is_recovery` tinyint(1) DEFAULT NULL COMMENT '0否 1 回收',
  `receipt_file_ids` varchar(64) DEFAULT '' COMMENT '回执单附件',
  `receipt_date` date DEFAULT NULL COMMENT '回执时间',
  `maintain` text DEFAULT NULL COMMENT '保养注意事项',
  `tax` varchar(255) DEFAULT NULL COMMENT '含税情况',
  `train_content` text DEFAULT NULL COMMENT '培训内容',
  `collection_img` varchar(255) DEFAULT NULL COMMENT '收款图片',
  `collection_deposit` varchar(255) DEFAULT NULL COMMENT '收款开户行',
  `collection_account` varchar(255) DEFAULT NULL COMMENT '收款账号',
  `collection_name` varchar(255) DEFAULT NULL COMMENT '收款账户名称',
  `product` text DEFAULT NULL COMMENT '产品',
  `is_visit` tinyint(1) DEFAULT '0' COMMENT '回访 0否 1是',
  `complete_name` varchar(32) DEFAULT NULL COMMENT '完成联系人电话',
  `complete_contact` varchar(64) DEFAULT NULL COMMENT '完成联系人电话',
  `is_charge` tinyint(1) DEFAULT NULL COMMENT '是否收费 1 收费     2不收费',
  `flow_id` int(11) NULL DEFAULT NULL COMMENT '审核流程ID',
  `order_id` int(11) NULL DEFAULT NULL COMMENT '审批流程步骤id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='售后工单';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_workorder_file
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_workorder_file`
(
    `id`           int(11) NOT NULL AUTO_INCREMENT,
    `workorder_id` int(11) NOT NULL COMMENT '工单ID',
    `file_id`      int(11) NOT NULL COMMENT '文件ID',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='其他信息';



-- ----------------------------
-- Table structure for __PREFIX__qingdongams_workorder_logistics
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_workorder_logistics`
(
    `id`              int(11) NOT NULL AUTO_INCREMENT,
    `customer_id`     int(10) DEFAULT NULL COMMENT '客户ID',
    `workorder_id`    int(10) DEFAULT NULL COMMENT '工单id',
    `number`          varchar(64)    DEFAULT NULL COMMENT '快递编号',
    `type`            varchar(32)    DEFAULT NULL COMMENT '类型',
    `money`           decimal(10, 2) DEFAULT NULL,
    `company`         varchar(64)    DEFAULT NULL COMMENT '快递公司',
    `status`          tinyint(1) DEFAULT '0' COMMENT '快递状态0运输中  1已完成',
    `file_ids`        varchar(63)    DEFAULT NULL COMMENT '发货图片',
    `current_status`  varchar(255)   DEFAULT NULL COMMENT '物流当前状态',
    `content`         text COMMENT '物流详情',
    `receiver_phone`  varchar(255)   DEFAULT NULL COMMENT '收手机号',
    `sender_phone`    varchar(255)   DEFAULT NULL COMMENT '发手机号',
    `create_staff_id` int(10) DEFAULT NULL COMMENT '创建人',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='工单物流信息';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_workorder_other
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_workorder_other`
(
    `id`    int(11) NOT NULL AUTO_INCREMENT,
    `other` text COMMENT '自定义信息 json',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='其他信息';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_workorder_progress
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_workorder_progress`
(
    `id`                int(11) NOT NULL AUTO_INCREMENT,
    `workorder_id`      int(10) DEFAULT NULL COMMENT '工单id',
    `data1`             text DEFAULT NULL COMMENT '原因分析',
    `data2`             text DEFAULT NULL COMMENT '改善对策',
    `data3`             text DEFAULT NULL COMMENT '完成时间',
    `data4`             text DEFAULT NULL COMMENT '评估改善结果',
    `data5`             text DEFAULT NULL COMMENT '完善制度工艺流程',
    `duty_staff`        varchar(64)   DEFAULT NULL COMMENT '责任人',
    `analyst_staff`     varchar(64)   DEFAULT NULL COMMENT '分析人',
    `implementer_staff` varchar(64)   DEFAULT NULL COMMENT '实施人',
    `director_staff`    varchar(64)   DEFAULT NULL COMMENT '主管',
    `create_staff_id`   int(10) DEFAULT NULL COMMENT '创建人',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='品质异常单进度';


-- ----------------------------
-- Table structure for __PREFIX__qingdongams_workorder_visit
-- ----------------------------
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_workorder_visit`
(
    `id`            int(11) NOT NULL AUTO_INCREMENT,
    `workorder_id`  int(10) DEFAULT NULL COMMENT '工单id',
    `satisfaction`  tinyint(2) DEFAULT NULL COMMENT '满意度',
    `visit_time`    varchar(32)  DEFAULT NULL COMMENT '回访时间',
    `visit_opinion` text DEFAULT NULL COMMENT '回访意见',
    `opinion_score` tinyint(2) DEFAULT NULL COMMENT '意见评分',
    `visit_service` varchar(255) DEFAULT NULL COMMENT '服务态度',
    `service_score` tinyint(2) DEFAULT NULL COMMENT '态度评分',
    `visit_skill`   varchar(255) DEFAULT NULL COMMENT '技术水平',
    `visit_desc`    text DEFAULT NULL COMMENT '备注',
    `skill_score`   tinyint(2) DEFAULT NULL COMMENT '水平评分',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='品质异常单进度';


CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_send_template`
(
    `id`         int(11) NOT NULL AUTO_INCREMENT,
    `type`       enum('sms','email') DEFAULT NULL COMMENT 'sms 短信 email邮箱',
    `number`     varchar(64)  DEFAULT NULL COMMENT '短信模板编号',
    `name`       varchar(128) DEFAULT NULL COMMENT '模板名称',
    `content`    varchar(255) DEFAULT NULL COMMENT '内容',
    `preview`    varchar(255) DEFAULT NULL COMMENT '预览内容',
    `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
    `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
    `deletetime` bigint(16) DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4   COMMENT='短信、邮件发送';

CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_attendance` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `staff_id` int(11) DEFAULT NULL COMMENT '员工ID',
  `statisc_id` int(11) DEFAULT NULL COMMENT '统计id',
  `type` int(1) DEFAULT '0' COMMENT '0:上下班打卡 1：外勤',
  `time` varchar(30) DEFAULT NULL COMMENT '打卡时间',
  `address` varchar(150) DEFAULT NULL COMMENT '打卡位置',
  `type_name` int(1) DEFAULT '0' COMMENT '0上班，1下班 2 外勤',
  `late` int(1) DEFAULT '0' COMMENT '迟到0：否 1：是',
  `late_time` int(11) DEFAULT NULL COMMENT '迟到时间(分)',
  `leaver` int(1) DEFAULT '0' COMMENT '早退 0：否 1：是',
  `leaver_time` int(11) DEFAULT NULL COMMENT '早退时间(分)',
  `lng` varchar(50) DEFAULT NULL COMMENT '经度',
  `lat` varchar(50) DEFAULT NULL COMMENT '纬度',
  `start_time` datetime DEFAULT NULL COMMENT '开始时间',
  `end_time` datetime DEFAULT NULL COMMENT '结束时间',
  `status` int(1) DEFAULT '0' COMMENT '是否打卡 0：否 1是',
  `remarks` varchar(255) DEFAULT NULL COMMENT '备注',
  `file_ids` varchar(128) DEFAULT NULL COMMENT '附件',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '修改时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_attendance_address` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `address` varchar(200) DEFAULT NULL COMMENT '地点',
  `address_detail` varchar(255) DEFAULT NULL COMMENT '地址',
  `distance` int(10) DEFAULT '0' COMMENT '范围(米)',
  `lng` varchar(50) DEFAULT NULL COMMENT '经度',
  `lat` varchar(50) DEFAULT NULL COMMENT '纬度',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_attendance_card` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `statisc_id` int(11) DEFAULT NULL COMMENT '考勤ID',
  `type` int(1) DEFAULT '0' COMMENT '0:补卡 1：早退 2：迟到',
  `time` datetime DEFAULT NULL COMMENT '补卡时间',
  `title` varchar(255) DEFAULT NULL COMMENT '补卡原因',
  `remark` varchar(255) DEFAULT NULL COMMENT '补卡事由',
  `file_ids` varchar(255) DEFAULT NULL COMMENT '附件',
  `check_status` int(1) DEFAULT '0' COMMENT '0待审核、1审核中、2审核通过、3审核未通过、4撤销',
  `flow_id` int(11) DEFAULT NULL COMMENT '审核流程ID',
  `order_id` int(11) DEFAULT NULL COMMENT '审批流程步骤id',
  `flow_staff_ids` varchar(255) DEFAULT NULL COMMENT '流程审批人ID',
  `check_staff_ids` varchar(255) DEFAULT NULL COMMENT '已审批人IDs',
  `create_staff_id` int(11) DEFAULT NULL COMMENT '创建人ID',
  `owner_staff_id` int(11) DEFAULT NULL COMMENT '负责人ID',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `attendance_index` (`statisc_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_attendance_leave` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(255) DEFAULT NULL COMMENT '请假类型',
  `start_time` varchar(64) DEFAULT NULL COMMENT '开始时间',
  `end_time` varchar(64) DEFAULT NULL COMMENT '结束时间',
  `hour` varchar(32) DEFAULT NULL COMMENT '时长',
  `remarks` varchar(255) DEFAULT NULL COMMENT '备注',
  `file_ids` varchar(128) DEFAULT NULL COMMENT '附件',
  `create_staff_id` int(11) DEFAULT NULL,
  `createtime` int(11) DEFAULT NULL,
  `updatetime` int(11) DEFAULT NULL,
  `deletetime` int(11) DEFAULT NULL,
  `flow_id` int(11) DEFAULT NULL COMMENT '审核流程ID',
  `order_id` int(11) DEFAULT NULL COMMENT '审批流程步骤id',
  `flow_staff_ids` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '流程审批人ID',
  `check_staff_ids` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '已审批人IDs',
  `check_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0待审核、1审核中、2审核通过、3审核未通过、4撤销、',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_attendance_rule` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) DEFAULT NULL COMMENT '规则名称',
  `staff_id` text COMMENT '员工ID',
  `type` tinyint(1) DEFAULT '0' COMMENT '0:上班 1：外出',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_attendance_statisc` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `staff_id` int(11) DEFAULT NULL COMMENT '员工ID',
  `number` varchar(32) DEFAULT NULL COMMENT '打卡编码',
  `time` date DEFAULT NULL COMMENT '统计时间',
  `clock_in` datetime DEFAULT NULL COMMENT '上班打卡',
  `clock_in_status` tinyint(2) DEFAULT '0' COMMENT '0 正常 1 缺卡 2 旷工 3 迟到/早退打卡 5 补卡 6请假',
  `late_time` int(11) DEFAULT '0' COMMENT '迟到时间(分)',
  `clock_out` datetime DEFAULT NULL COMMENT '下班打卡',
  `clock_out_status` tinyint(2) DEFAULT '0' COMMENT '0 正常 1 缺卡 2 旷工  3 迟到/早退打卡  5 补卡 6请假',
  `leaver_time` int(11) DEFAULT '0' COMMENT '早退时间(分)',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '修改时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  `start_time` varchar(20) DEFAULT NULL COMMENT '开始时间',
  `end_time` varchar(20) DEFAULT NULL COMMENT '结束时间',
  `ustart_time` varchar(20) DEFAULT NULL COMMENT '可打卡开始时间',
  `uend_time` varchar(20) DEFAULT NULL COMMENT '可打卡结束时间',
  `dstart_time` varchar(20) DEFAULT NULL COMMENT '下班可打卡开始时间',
  `dend_time` varchar(20) DEFAULT NULL COMMENT '下班可打卡结束时间',
  `start_status` tinyint(1) DEFAULT '0' COMMENT '上班打卡0:开启 1：关闭',
  `end_status` tinyint(1) DEFAULT '0' COMMENT '下班打卡0:开启 1：关闭',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `time_index` (`time`) USING BTREE,
  KEY `staff_index` (`staff_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_attendance_time` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `number` varchar(32) DEFAULT NULL COMMENT '编码',
  `start_time` varchar(20) DEFAULT NULL COMMENT '开始时间',
  `end_time` varchar(20) DEFAULT NULL COMMENT '结束时间',
  `ustart_time` varchar(20) DEFAULT NULL COMMENT '可打卡开始时间',
  `uend_time` varchar(20) DEFAULT NULL COMMENT '可打卡结束时间',
  `dstart_time` varchar(20) DEFAULT NULL COMMENT '下班可打卡开始时间',
  `dend_time` varchar(20) DEFAULT NULL COMMENT '下班可打卡结束时间',
  `start_next` int(11) DEFAULT '0' COMMENT '0:非次日   1：次日',
  `end_next` int(11) DEFAULT NULL COMMENT '0:非次日   1：次日',
  `start_status` int(1) DEFAULT '0' COMMENT '上班打卡0:开启 1：关闭',
  `end_status` int(1) DEFAULT '0' COMMENT '下班打卡0:开启 1：关闭',
  `monday` int(1) DEFAULT '0' COMMENT '周一  0未选择 1：已选择',
  `tuesday` int(1) DEFAULT '0' COMMENT '周二  0未选择 1：已选择',
  `wednesday` int(1) DEFAULT '0' COMMENT '周三  0未选择 1：已选择',
  `thursday` int(1) DEFAULT '0' COMMENT '周四  0未选择 1：已选择',
  `friday` int(1) DEFAULT '0' COMMENT '周五  0未选择 1：已选择',
  `saturday` int(1) DEFAULT '0' COMMENT '周六  0未选择 1：已选择',
  `weekday` int(1) DEFAULT '0' COMMENT '周日  0未选择 1：已选择',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `number_index` (`number`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_business` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `customer_id` int(11) NOT NULL COMMENT '客户ID',
  `contract_status` int(1) DEFAULT '0' COMMENT '成交状态 0：未成交 1：成交',
  `name` varchar(80) DEFAULT NULL COMMENT '商机名称',
  `money` varchar(10) DEFAULT NULL COMMENT '商机金额',
  `expect_time` datetime DEFAULT NULL COMMENT '预计成交时间',
  `next_time` datetime DEFAULT NULL COMMENT '下次联系时间',
  `status` varchar(30) DEFAULT '0' COMMENT '状态 验证客户、需求分析 、方案/报价 、赢单 、输单',
  `remark` varchar(255) DEFAULT NULL COMMENT '备注',
  `create_staff_id` int(11) DEFAULT NULL COMMENT '创建人',
  `owner_staff_id` int(11) DEFAULT NULL COMMENT '负责人',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `customer_index` (`customer_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_business_other` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '商机id',
  `otherdata` text CHARACTER SET utf8 COMMENT '自定义信息 json',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_business_product` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `business_id` int(11) NOT NULL COMMENT '商机id',
  `product_id` int(11) DEFAULT NULL COMMENT '产品id',
  `number` tinyint(5) DEFAULT NULL COMMENT '数量',
  `price` double(10,2) DEFAULT NULL COMMENT '价格',
  `parts` varchar(1000) DEFAULT NULL COMMENT '产品配置',
  `ship_status` tinyint(1) DEFAULT '0' COMMENT '0 待发货 1发货 2已收货',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_business_status` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `business_id` int(11) DEFAULT NULL COMMENT '商机ID',
  `type` int(1) DEFAULT '0' COMMENT '类型0:初期沟通 1：立项跟踪 2：方案/报价 3:谈判审核4:赢单5：输单 6：无效',
  `file` varchar(255) DEFAULT NULL COMMENT '图片',
  `remark` varchar(255) DEFAULT NULL COMMENT '备注',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `business_id` (`business_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_contract_ratio` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `contract_id` int(11) NOT NULL COMMENT '合同id',
  `ratio` decimal(10,2) DEFAULT NULL COMMENT '比例',
  `staff_id` int(11) DEFAULT NULL,
  `ratio_money` double(18,2) DEFAULT NULL COMMENT '分成金额',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_daily_draft` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(20) DEFAULT NULL COMMENT ' 日 周 月 季 年',
  `other` text COMMENT '其他',
  `reminds_id` varchar(255) NOT NULL COMMENT '提醒人员列表',
  `create_staff_id` int(11) NOT NULL COMMENT '创建用户id',
  `createtime` int(11) DEFAULT NULL,
  `updatetime` int(11) DEFAULT NULL,
  `deletetime` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='日报提醒人';
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_ding_contacts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` int(1) DEFAULT '0' COMMENT '0:钉钉  1:微信',
  `instance_id` varchar(64) DEFAULT NULL COMMENT '数据ID',
  `customer_id` int(11) NOT NULL COMMENT '客户ID',
  `name` varchar(64) DEFAULT '' COMMENT '姓名',
  `post` varchar(32) DEFAULT NULL COMMENT '职务',
  `email` varchar(32) DEFAULT NULL COMMENT '邮箱',
  `mobile` varchar(32) DEFAULT NULL COMMENT '手机号',
  `remarks` varchar(255) DEFAULT NULL COMMENT '备注信息',
  `create_staff_id` varchar(50) DEFAULT NULL COMMENT '创建人ID',
  `owner_staff_id` varchar(50) DEFAULT NULL COMMENT '负责人ID',
  `status` int(1) DEFAULT '0' COMMENT '0:未同步  1:已同步',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '修改时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `customer_id_index` (`customer_id`) USING BTREE,
  KEY `mobile` (`mobile`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_ding_customer` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `type` int(1) DEFAULT '0' COMMENT '0:钉钉  1:微信',
  `customer_id` int(11) DEFAULT NULL COMMENT 'CRM客户ID',
  `instance_id` varchar(64) DEFAULT NULL COMMENT '数据ID',
  `user_id` varchar(100) DEFAULT NULL COMMENT '用户ID',
  `name` varchar(100) DEFAULT NULL COMMENT '客户名称',
  `address` varchar(100) DEFAULT NULL COMMENT '地址',
  `address_detail` varchar(100) DEFAULT NULL COMMENT '详细地址',
  `source` varchar(50) DEFAULT NULL COMMENT '来源',
  `remark` varchar(255) DEFAULT NULL COMMENT '备注',
  `owner_staff_id` varchar(100) DEFAULT NULL COMMENT '负责人',
  `create_staff_id` varchar(100) DEFAULT NULL COMMENT '创建人',
  `status` int(1) DEFAULT '0' COMMENT '0:未同步  1：已同步',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_ding_record` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` int(1) DEFAULT '0' COMMENT '0:钉钉  1:微信',
  `instance_id` varchar(64) CHARACTER SET utf8 DEFAULT NULL COMMENT '数据ID',
  `customer_id` int(11) DEFAULT NULL COMMENT '客户ID',
  `content` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '跟进内容',
  `create_staff_id` varchar(64) DEFAULT NULL COMMENT '创建用户id',
  `status` int(1) DEFAULT '0' COMMENT '0:未同步 1：已同步',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `instance_index` (`instance_id`) USING BTREE,
  KEY `customer_index` (`customer_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_ding_staff` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `type` int(1) DEFAULT '0' COMMENT '0:钉钉 1：企业微信 ',
  `staff_id` int(11) DEFAULT NULL COMMENT '员工ID',
  `dept_id` int(11) DEFAULT NULL COMMENT '部门ID',
  `user_id` varchar(100) DEFAULT NULL COMMENT '钉钉用户ID',
  `name` varchar(30) DEFAULT NULL COMMENT '姓名',
  `mobile` varchar(12) DEFAULT NULL,
  `status` tinyint(1) DEFAULT '0' COMMENT '0:未同步  1：已同步',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `dept_index` (`dept_id`) USING BTREE,
  KEY `user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_fauser` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL COMMENT 'fast用户ID',
  `staff_id` int(11) DEFAULT NULL COMMENT '员工ID',
  `relation_id` int(11) DEFAULT NULL COMMENT '关联ID',
  `type` tinyint(1) DEFAULT '0' COMMENT '0:客户  1：线索',
  `status` tinyint(1) DEFAULT '0' COMMENT '0:未同步 1同步',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `user_index` (`user_id`) USING BTREE,
  KEY `status_index` (`status`) USING BTREE,
  KEY `type_index` (`type`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_form_field` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `types` varchar(30) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '分类',
  `types_id` int(11) NOT NULL DEFAULT '0' COMMENT '分类ID(审批等)',
  `field` varchar(50) CHARACTER SET utf8mb4 NOT NULL COMMENT '字段名',
  `name` varchar(50) CHARACTER SET utf8mb4 NOT NULL COMMENT '标识名',
  `form_type` varchar(20) CHARACTER SET utf8mb4 NOT NULL COMMENT '字段类型',
  `info_type` varchar(128) CHARACTER SET utf8mb4 DEFAULT 'main' COMMENT '信息类型',
  `default_value` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '默认值',
  `max_length` int(4) DEFAULT '0' COMMENT '字数上限',
  `is_unique` tinyint(1) DEFAULT '0' COMMENT '是否唯一(1是，0否)',
  `is_null` tinyint(1) DEFAULT '0' COMMENT '是否必填(1是，0否)',
  `list_show` tinyint(1) DEFAULT '1' COMMENT '列表显示(1是，0否)',
  `add_show` tinyint(1) DEFAULT '1' COMMENT '添加显示(1是，0否)',
  `input_tips` varchar(100) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '输入提示',
  `setting` text CHARACTER SET utf8mb4 COMMENT '设置',
  `order_id` int(4) NOT NULL DEFAULT '0' COMMENT '排序ID',
  `operating` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0改删，1改，2删，3无',
  `createtime` int(11) NOT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='自定义字段';
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_goods` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type_id` int(11) DEFAULT NULL COMMENT '分类ID',
  `name` varchar(128) NOT NULL DEFAULT '' COMMENT '产品名称',
  `unit` varchar(128) DEFAULT '箱' COMMENT '单位',
  `price` decimal(18,2) DEFAULT '0.00' COMMENT '价格',
  `min_price` decimal(10,2) DEFAULT '0.00' COMMENT '最低销售价',
  `cost_price` decimal(10,2) DEFAULT NULL COMMENT '成本价',
  `wholesale` decimal(10,2) DEFAULT NULL COMMENT '批发价',
  `status` varchar(32) NOT NULL DEFAULT '上架' COMMENT '是否上架',
  `description` text COMMENT '产品描述',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(10) DEFAULT NULL COMMENT '删除时间',
  `specs_type` int(11) DEFAULT '0' COMMENT '是否启用规格 1:启用',
  `specs_id` int(11) DEFAULT NULL COMMENT '规格',
  `image` varchar(255) DEFAULT NULL COMMENT '图片',
  `content` text COMMENT '商品详情',
  `num` varchar(64) DEFAULT NULL COMMENT '编号',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='商品';
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_goods_unit` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(128) NOT NULL DEFAULT '' COMMENT '名称',
  `sort` int(10) DEFAULT '0' COMMENT '权重',
  `status` tinyint(1) DEFAULT '1' COMMENT '状态 0：隐藏  1：显示',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(10) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='商品单位';
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_product_part` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `product_id` int(11) DEFAULT NULL,
  `name` varchar(128) NOT NULL DEFAULT '' COMMENT '产品名称',
  `img` varchar(200) DEFAULT NULL COMMENT '产品图片',
  `description` text COMMENT '产品描述',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(10) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品配件';
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_record` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `follow_type` varchar(32) CHARACTER SET utf8 DEFAULT NULL COMMENT '跟进类型',
  `follow_time` datetime DEFAULT NULL,
  `follow` varchar(32) CHARACTER SET utf8 DEFAULT NULL COMMENT '跟进状态',
  `content` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '跟进内容',
  `reminds_id` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '提醒人员列表',
  `next_time` datetime DEFAULT NULL COMMENT '下次跟进时间',
  `relation_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '关联类型  1客户 2联系人 3合同 4线索 5商机',
  `relation_id` int(11) NOT NULL DEFAULT '0' COMMENT '关联ID',
  `create_staff_id` int(11) DEFAULT '0' COMMENT '创建用户id',
  `status` int(1) DEFAULT '0' COMMENT '跟进状态 0：未跟进 1：已跟进',
  `createtime` int(11) DEFAULT NULL,
  `updatetime` int(11) DEFAULT NULL,
  `deletetime` int(11) DEFAULT NULL,
  `location` varchar(128) CHARACTER SET utf8 DEFAULT NULL COMMENT '定位信息',
  `lng` double(16,12) DEFAULT NULL COMMENT '地理位置经度',
  `lat` double(16,12) DEFAULT NULL COMMENT '地理位置维度',
  `staff_id` int(11) NULL COMMENT '创建人',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=utf8mb4 COMMENT='操作记录';
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_record_file` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `record_id` int(11) DEFAULT NULL COMMENT '日志ID',
  `file_id` int(11) DEFAULT NULL COMMENT '附件ID',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COMMENT='跟进附件';
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_record_read` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `admin_id` int(11) DEFAULT NULL,
  `staff_id` int(11) DEFAULT NULL,
  `record_id` int(11) DEFAULT NULL,
  `createtime` int(11) DEFAULT NULL,
  `updatetime` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `staff_id` (`staff_id`) USING BTREE,
  KEY `record_id` (`record_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=utf8mb4 COMMENT='跟进已读';
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_remind` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `type` varchar(32) DEFAULT 'customer' COMMENT 'customer:客户 record:跟进记录 approval：工作报告',
  `staff_ids` varchar(255) DEFAULT NULL COMMENT '员工ID',
  `remark` varchar(255) DEFAULT NULL COMMENT '备注',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='跟进提醒';
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_seas_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(128) DEFAULT NULL COMMENT '部门名称',
  `remarks` varchar(255) DEFAULT NULL COMMENT '备注',
  `rules` text COMMENT '权限',
  `createtime` int(11) DEFAULT NULL,
  `updatetime` int(11) DEFAULT NULL,
  `deletetime` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_specs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `pid` int(11) DEFAULT NULL COMMENT '上级',
  `name` varchar(128) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '规格名称',
  `content` text CHARACTER SET utf8 COMMENT '详情',
  `status` tinyint(1) DEFAULT NULL COMMENT '状态 1启用 0',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(10) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='商品规格';
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_staff_ratio` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL COMMENT '名称',
  `ratio` text COMMENT '比例',
  `status` tinyint(1) DEFAULT '0',
  `createtime` int(11) DEFAULT NULL,
  `updatetime` int(11) DEFAULT NULL,
  `deletetime` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='业绩比例';
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_staff_role` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(128) DEFAULT NULL COMMENT '角色名称',
  `role_type` tinyint(1) DEFAULT NULL COMMENT '角色权限',
  `rules` text CHARACTER SET utf8mb4,
  `createtime` int(11) DEFAULT NULL,
  `updatetime` int(11) DEFAULT NULL,
  `deletetime` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='员工角色';
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_word_template` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(32) DEFAULT NULL COMMENT '类型',
  `name` varchar(128) DEFAULT NULL COMMENT '模板名称',
  `url` varchar(255) DEFAULT NULL COMMENT '模板地址',
  `createtime` int(11) DEFAULT NULL,
  `updatetime` int(11) DEFAULT NULL,
  `deletetime` int(10) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='word模板';
CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_sea_operation` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `customer_id` int(11) DEFAULT NULL COMMENT '客户ID',
  `type` tinyint(1) DEFAULT '0' COMMENT '类型：0领取 1回收',
  `owner_staff_id` int(11) DEFAULT NULL COMMENT '负责人',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`),
  KEY `customer_index` (`customer_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='客户公海记录';


ALTER TABLE `__PREFIX__qingdongams_achievement_records`
ADD COLUMN `flow_id` int(11) NULL COMMENT '审核流程ID' AFTER `flow_staff_ids`,
ADD COLUMN `order_id` int(11) NULL COMMENT '审批流程步骤id' AFTER `flow_id`,
ADD COLUMN `owner_staff_id` int(11) NULL DEFAULT NULL COMMENT '负责人id' AFTER `check_staff_ids`;

ALTER TABLE `__PREFIX__qingdongams_comment`
ADD COLUMN `operator` int(11) NULL DEFAULT NULL COMMENT '审核人' AFTER `ip`,
ADD COLUMN `checktime` datetime NULL DEFAULT NULL COMMENT '审核时间' AFTER `operator`;

ALTER TABLE `__PREFIX__qingdongams_consume`
ADD COLUMN `consume_time` date NULL DEFAULT NULL COMMENT '消费日期' AFTER `customer_id`,
ADD COLUMN   `consume_type` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '消费方式' AFTER `consume_time`,
ADD COLUMN `flow_staff_ids` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '流程审批人ID' AFTER `check_status`,
ADD COLUMN `flow_id` int(11) NULL DEFAULT NULL COMMENT '审核流程ID' AFTER `flow_staff_ids`,
ADD COLUMN `order_id` int(11) NULL DEFAULT NULL COMMENT '审批流程步骤id' AFTER `flow_id`,
ADD COLUMN `file_ids` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件ID' AFTER `remark`;

ALTER TABLE `__PREFIX__qingdongams_contract`
ADD COLUMN `business_id` int(11) NULL DEFAULT NULL COMMENT '商机ID' AFTER `order_staff_id`,
ADD COLUMN `flow_id` int(11) NULL DEFAULT NULL COMMENT '审核流程ID' AFTER `remarks`,
ADD COLUMN `order_id` int(11) NULL DEFAULT NULL COMMENT '审批流程步骤id' AFTER `flow_id`,
ADD COLUMN `ratio_id` int(11) NULL DEFAULT NULL COMMENT '绩效ID' AFTER `order_id`,
ADD COLUMN `ratios` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业绩比例' AFTER `ratio_id`;

ALTER TABLE `__PREFIX__qingdongams_contract_product`
ADD COLUMN `parts` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品配置' AFTER `price`,
ADD COLUMN `ship_status` tinyint(1) NULL DEFAULT 0 COMMENT '0 待发货 1发货 2已收货' AFTER `parts`;

ALTER TABLE `__PREFIX__qingdongams_customer`
ADD COLUMN `seas_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属公海' AFTER `type`,
ADD COLUMN `sea_time` int(11) NULL DEFAULT NULL COMMENT '放入公海时间' AFTER `seas_id`,
ADD COLUMN `mobile` varchar(15) DEFAULT NULL COMMENT '手机号' AFTER `sea_time`,
ADD COLUMN `ro_staff_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '只读权限' AFTER `owner_staff_id`,
ADD COLUMN `rw_staff_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '读写权限' AFTER `ro_staff_id`;

ALTER TABLE `__PREFIX__qingdongams_event`
ADD COLUMN `auto_end` tinyint(1) NOT NULL DEFAULT 1 COMMENT '自动结束 0否 1是' AFTER `car_number`,
ADD COLUMN `owner_staff_id` int(11) NOT NULL DEFAULT 0 COMMENT '指派人' AFTER `auto_end`;

ALTER TABLE `__PREFIX__qingdongams_field`
ADD COLUMN `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `type`,
ADD COLUMN `data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL AFTER `name`;

ALTER TABLE `__PREFIX__qingdongams_flow`
ADD COLUMN `status` tinyint(1) NULL DEFAULT NULL COMMENT '1 固定审批 0 授权审批' AFTER `examine_ids`,
ADD COLUMN `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注' AFTER `status`,
ADD COLUMN `relation_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关联类型' AFTER `remark`,
ADD COLUMN `group_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关联角色组' AFTER `relation_type`,
ADD COLUMN `weight` tinyint(4) NULL DEFAULT NULL COMMENT '权重' AFTER `group_ids`,
ADD COLUMN `last_modified` int(11) NULL DEFAULT NULL COMMENT '最后修改时间' AFTER `weight`,
ADD COLUMN `last_admin_id` int(11) NULL DEFAULT NULL COMMENT '最后修改人' AFTER `type`;

ALTER TABLE `__PREFIX__qingdongams_form_approval`
ADD COLUMN `examine_ids` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '默认审核人id' AFTER `flow_staff_ids`,
ADD COLUMN `status` tinyint(1) NULL DEFAULT NULL COMMENT '1 固定审批 0 授权审批' AFTER `examine_ids`;

ALTER TABLE `__PREFIX__qingdongams_leads`
ADD COLUMN `tranfer_stff_id` int(10) NULL DEFAULT NULL COMMENT '转派人ID' AFTER `follow`,
ADD COLUMN `receive_time` int(11) NULL DEFAULT NULL COMMENT '分配时间' AFTER `tranfer_stff_id`;

ALTER TABLE `__PREFIX__qingdongams_notice_template`
ADD COLUMN `enterprise_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '企业微信' AFTER `data`;

ALTER TABLE `__PREFIX__qingdongams_order`
ADD COLUMN `is_account` tinyint(1) NULL DEFAULT 0 COMMENT '是否已到账' AFTER `show_staff_id`;

ALTER TABLE `__PREFIX__qingdongams_parts_stock_reload`
ADD COLUMN `flow_id` int(11) NULL DEFAULT NULL COMMENT '审核流程ID' AFTER `check_staff_ids`,
ADD COLUMN `order_id` int(11) NULL DEFAULT NULL COMMENT '审批流程步骤id' AFTER `flow_id`;

ALTER TABLE `__PREFIX__qingdongams_product`
ADD COLUMN `goods_id` int(11) NULL DEFAULT NULL COMMENT '商品ID' AFTER `content`,
ADD COLUMN `type` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '规格' AFTER `goods_id`,
ADD COLUMN `min_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '最低销售价' AFTER `type`,
ADD COLUMN `cost_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '成本价' AFTER `min_price`,
ADD COLUMN `wholesale` decimal(10, 2) NULL DEFAULT NULL COMMENT '批发价' AFTER `cost_price`;

ALTER TABLE `__PREFIX__qingdongams_product_type`
ADD COLUMN `image` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '分类图片' AFTER `create_staff_id`,
ADD COLUMN `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '内容' AFTER `image`,
ADD COLUMN `status` tinyint(1) NULL DEFAULT NULL COMMENT '状态' AFTER `content`;

ALTER TABLE `__PREFIX__qingdongams_quote`
ADD COLUMN `flow_id` int(11) NULL DEFAULT NULL COMMENT '审核流程ID' AFTER `product_type`,
ADD COLUMN `order_id` int(11) NULL DEFAULT NULL COMMENT '审批流程步骤id' AFTER `flow_id`,
ADD COLUMN `ro_staff_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '只读权限' AFTER `order_id`,
ADD COLUMN `rw_staff_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '读写权限' AFTER `ro_staff_id`;

ALTER TABLE `__PREFIX__qingdongams_receivables`
ADD COLUMN `flow_id` int(11) NULL DEFAULT NULL COMMENT '审核流程ID' AFTER `owner_staff_id`,
ADD COLUMN `order_id` int(11) NULL DEFAULT NULL COMMENT '审批流程步骤id' AFTER `flow_id`;

ALTER TABLE `__PREFIX__qingdongams_staff`
ADD COLUMN `touser` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '企业微信touser' AFTER `status`;

ALTER TABLE `__PREFIX__qingdongams_staff_department`
ADD COLUMN `type` int(1) NULL DEFAULT 0 COMMENT '0:钉钉  1：微信' AFTER `pid`,
ADD COLUMN `number` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信唯一编号' AFTER `type`,
ADD COLUMN `status` int(1) NULL DEFAULT 0 COMMENT '0:未同步 1已同步' AFTER `number`,
ADD COLUMN `role_id` int(11) NULL DEFAULT NULL COMMENT '同步ID' AFTER `status`;

ALTER TABLE `__PREFIX__qingdongams_staff_sign_in`
ADD COLUMN `other` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL AFTER `trip_distance`,
ADD COLUMN `next_time` datetime NULL DEFAULT NULL COMMENT '下次跟进时间' AFTER `other`;

ALTER TABLE `__PREFIX__qingdongams_workorder`
ADD COLUMN `flow_id` int(11) NULL DEFAULT NULL COMMENT '审核流程ID' AFTER `is_charge`,
ADD COLUMN `order_id` int(11) NULL DEFAULT NULL COMMENT '审批流程步骤id' AFTER `flow_id`;

ALTER TABLE `__PREFIX__qingdongams_contract_other`
CHANGE COLUMN `other` `otherdata` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '自定义信息 json' AFTER `id`;

ALTER TABLE `__PREFIX__qingdongams_contacts_other`
CHANGE COLUMN `other` `otherdata` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '自定义信息 json' AFTER `id`;

ALTER TABLE `__PREFIX__qingdongams_customer_other`
CHANGE COLUMN `other` `otherdata` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '自定义信息 json' AFTER `id`;

ALTER TABLE `__PREFIX__qingdongams_leads_other`
CHANGE COLUMN `other` `otherdata` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '自定义信息 json' AFTER `id`;

ALTER TABLE `__PREFIX__qingdongams_receivables_other`
CHANGE COLUMN `other` `otherdata` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '自定义信息 json' AFTER `id`;

ALTER TABLE `__PREFIX__qingdongams_approval`
ADD COLUMN `file_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件' AFTER `create_staff_id`,
ADD COLUMN `flow_id` int(11) NULL DEFAULT NULL COMMENT '审核流程ID' AFTER `file_ids`,
ADD COLUMN `order_id` int(11) NULL DEFAULT NULL COMMENT '审批流程步骤id' AFTER `flow_id`;

ALTER TABLE `__PREFIX__qingdongams_record`
    ADD COLUMN  `staff_id` int(11) NULL COMMENT '创建人' AFTER `lat`;
ALTER TABLE `__PREFIX__qingdongams_ding_staff`
MODIFY COLUMN `user_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '钉钉用户ID' AFTER `dept_id`;
ALTER TABLE `__PREFIX__qingdongams_ding_customer`
MODIFY COLUMN `user_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户ID' AFTER `instance_id`,
MODIFY COLUMN `owner_staff_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '负责人' AFTER `remark`,
MODIFY COLUMN `create_staff_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人' AFTER `owner_staff_id`;
ALTER TABLE `__PREFIX__qingdongams_ding_contacts`
MODIFY COLUMN `create_staff_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人ID' AFTER `remarks`,
MODIFY COLUMN `owner_staff_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '负责人ID' AFTER `create_staff_id`;

CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_notice_read` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `staff_id` int(11) DEFAULT NULL COMMENT '员工ID',
  `notice_id` int(11) DEFAULT NULL COMMENT '公告ID',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) DEFAULT NULL COMMENT '修改时间',
  `deletetime` int(11) DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `staff_id` (`staff_id`) USING BTREE,
  KEY `notice_id` (`notice_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='公告已读记录';

CREATE TABLE IF NOT EXISTS `__PREFIX__qingdongams_invoice`  (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `number` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '发票编号',
  `customer_id` int(11) NULL DEFAULT NULL COMMENT '客户ID',
  `contract_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '合同ID',
  `money` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开票金额',
  `time` datetime(0) NULL DEFAULT NULL COMMENT '开票日期',
  `type` int(2) NULL DEFAULT 0 COMMENT '开票类型：0：增值税专用发票 1：增值税普通发票 2：国税通用机打发票 3：地税通用机打发票 4:收据',
  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `head_type` int(1) NULL DEFAULT 0 COMMENT '抬头类型0：单位 1：个人',
  `invoice_header` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '发票抬头',
  `taxpayer_number` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '纳税人识别号',
  `bank_deposit` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开户行',
  `bank_account` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开户账户',
  `invoice_address` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开票地址',
  `invoice_mobile` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电话',
  `contacts` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系人',
  `phone` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系方式',
  `address` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮寄地址',
  `address_detail` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '详细地址',
  `flow_id` int(11) NULL DEFAULT NULL COMMENT '审核流程ID',
  `order_id` int(11) NULL DEFAULT NULL COMMENT '审批流程步骤id',
  `flow_staff_ids` varchar(150) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '流程审批人ID',
  `check_staff_ids` varchar(150) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '已审批人IDs',
  `create_staff_id` int(11) NULL DEFAULT NULL COMMENT '创建人',
  `owner_staff_id` int(11) NULL DEFAULT NULL COMMENT '负责人',
  `check_status` int(2) NULL DEFAULT NULL COMMENT '审核状态：0待审核、1审核中、2审核通过、3审核未通过、4撤销',
  `invoice_number` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '发票号码',
  `invoice_time` date NULL DEFAULT NULL COMMENT '实际开票日期',
  `logistics` varchar(150) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '物流单号',
  `image` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '凭证',
  `createtime` int(11) NULL DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(11) NULL DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(11) NULL DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `customer_index`(`customer_id`) USING BTREE,
  INDEX `contract_index`(`contract_id`) USING BTREE,
  INDEX `number_index`(`number`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT= '发票';

ALTER TABLE `__PREFIX__qingdongams_push_reload`
MODIFY COLUMN `data` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '数据' AFTER `template_id`;


INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (1, 'menus', 0, 'menu', '小程序菜单权限', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (3, 'menus', 1, 'seas', '公海', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (4, 'menus', 1, 'leads', '线索', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (5, 'menus', 1, 'business', '商机', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (6, 'menus', 1, 'leadspool', '线索池', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (7, 'menus', 1, 'attendance', '打卡', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (8, 'menus', 1, 'quote', '报价单', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (9, 'menus', 1, 'order', '订单', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (10, 'menus', 1, 'visit', '回访', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (11, 'menus', 1, 'product', '产品', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (12, 'menus', 1, 'parts', '库存', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (13, 'menus', 1, 'achievement', '目标', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (14, 'menus', 1, 'consume', '费用', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (15, 'menus', 1, 'cashier', '出纳', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (16, 'menus', 1, 'receivables', '收款', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (17, 'menus', 1, 'aftermarket', '知识库', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (18, 'menus', 1, 'work_report', '日志', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (19, 'menus', 1, 'map', '地图', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (20, 'menus', 1, 'daily', '工作报告', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (21, 'menus', 1, 'contract', '合同', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (22, 'menus', 1, 'workorder', '工单', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (23, 'menus', 1, 'event', '任务', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (24, 'menus', 1, 'approval', '办公', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (26, 'menus', 1, 'staff_list', '员工列表', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (30, 'menus', 1, 'statistics', '数据统计', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (31, 'menus', 1, 'sign_in', '出差签到', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (32, 'menus', 0, 'seas', '公海权限', '', 1, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (33, 'data', 32, '1', '默认公海', '', 0, '');
INSERT INTO `__PREFIX__qingdongams_staff_rule`(`id`, `type`, `pid`, `name`, `title`, `remark`, `weigh`, `status`) VALUES (34, 'menus', 1, 'invoice', '发票', '', 0, '');

INSERT INTO `__PREFIX__qingdongams_text_template` VALUES (1, '任务内容', '[{\"field\":\"客户服务_上门_认识\"},{\"field\":\"客户服务_上门_报价\"},{\"field\":\"客户服务_上门_签合同\"},{\"field\":\"客户服务_上门_收款\"},{\"field\":\"售后服务_上门_上门安装\"},{\"field\":\"售后服务_上门_上门维修\"},{\"field\":\"售后服务_电话\"},{\"field\":\"售后服务_返厂维修\"},{\"field\":\"设计工单\"}]', 1626236423, 1646985836, NULL);
INSERT INTO `__PREFIX__qingdongams_text_template` VALUES (2, '任务备注', '[{\"field\":\"任务1\"},{\"field\":\"内容3\"},{\"field\":\"内容34\"},{\"field\":\"内容55\"}]', 1626236423, 1645870896, NULL);
INSERT INTO `__PREFIX__qingdongams_text_template` VALUES (3, '回款备注', '[{\"field\":\"任务1\"},{\"field\":\"内容3\"},{\"field\":\"内容34\"}]', 1626236423, NULL, NULL);
INSERT INTO `__PREFIX__qingdongams_text_template` VALUES (4, '服务费用', '[{\"field\":\"安装费\"},{\"field\":\"服务费\"}]', 1627095896, 1640338731, NULL);
INSERT INTO `__PREFIX__qingdongams_text_template` VALUES (5, '任务目的', '[{\"field\":\"认识下\"},{\"field\":\"打样\"},{\"field\":\"报价\"},{\"field\":\"签合同\"},{\"field\":\"要尾款\"}]', 1634027949, 1634027949, NULL);
INSERT INTO `__PREFIX__qingdongams_text_template` VALUES (6, '返厂服务费用', '[{\"field\":\"维修费\"}]', 1634028003, 1641196693, NULL);
INSERT INTO `__PREFIX__qingdongams_text_template` VALUES (7, '费用主题', '[{\"field\":\"费用1\"},{\"field\":\"费用2\"}]', 1634030533, 1634030533, NULL);
INSERT INTO `__PREFIX__qingdongams_text_template` VALUES (9, '客户需求', '[{\"field\":\"客户需求1\"},{\"field\":\"客户需求2\"},{\"field\":\"客户需求4\"},{\"field\":\"客户需求6\"}]', 1638443105, 1638443105, NULL);
INSERT INTO `__PREFIX__qingdongams_text_template` VALUES (10, '安装未完成原因', '[{\"field\":\"安装未完成原因1\"},{\"field\":\"安装未完成原因2\"},{\"field\":\"安装未完成原因4\"}]', 1638497576, 1638497576, NULL);
INSERT INTO `__PREFIX__qingdongams_text_template` VALUES (11, '级别变更原因', '[{\"field\":\"联系不上\"},{\"field\":\"有意向\"},{\"field\":\"签合同\"}]', 1639188604, 1639188604, NULL);
INSERT INTO `__PREFIX__qingdongams_text_template` VALUES (12, '工单标题', '[{\"field\":\"安装\"},{\"field\":\"喷胶机\"},{\"field\":\"等离子\"},{\"field\":\"热胶机\"},{\"field\":\"刮胶机\"},{\"field\":\"平台\"},{\"field\":\"贴头\"}]', 1641553341, 1641553341, NULL);
INSERT INTO `__PREFIX__qingdongams_text_template` VALUES (13, '工单类型', '[{\"field\":\"设计工单\"},{\"field\":\"生产工单\"},{\"field\":\"产品发货\"},{\"field\":\"上门安装\"},{\"field\":\"配件配送\"},{\"field\":\"配件安装\"},{\"field\":\"上门维修\"},{\"field\":\"返厂维修\"},{\"field\":\"品质异常单\"},{\"field\":\"电话售后\"}]', 1642123485, 1645166553, NULL);

INSERT INTO `__PREFIX__qingdongams_form` VALUES (11, '线索管理', 'leads', '{\"data\":[{\"id\":\"name\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"线索名称\",\"readonly\":false,\"placeholder\":\"线索名称\",\"required\":true,\"is_delete\":false}},{\"id\":\"source\",\"name\":\"下拉选择框\",\"type\":1,\"component\":\"select\",\"config\":{\"label\":\"线索来源\",\"type\":null,\"content\":[{\"key\":\"\",\"value\":\"电话营销\",\"nodeKey\":1,\"isEdit\":false,\"label\":\"电话营销\",\"children\":[],\"expand\":true,\"__label\":\"电话营销\",\"__value\":[\"电话营销\"]},{\"key\":\"\",\"value\":\"主动来电\",\"__label\":\"拜访\",\"__value\":[\"主动来电\"],\"nodeKey\":2,\"isEdit\":false,\"label\":\"拜访\"}],\"required\":true,\"multiple\":false,\"is_delete\":false,\"placeholder\":\"请选择线索来源\"}},{\"id\":\"industry\",\"name\":\"下拉选择框\",\"type\":1,\"component\":\"select\",\"config\":{\"label\":\"客户行业\",\"type\":null,\"content\":[{\"key\":\"\",\"value\":\"行业1\",\"__label\":\"互联网\",\"__value\":[\"行业1\"],\"nodeKey\":1,\"isEdit\":false,\"label\":\"互联网\"},{\"key\":\"\",\"value\":\"行业2\",\"__value\":[\"行业2\"],\"nodeKey\":2,\"isEdit\":false,\"label\":\"信息化\",\"__label\":\"信息化\"}],\"required\":true,\"multiple\":false,\"is_delete\":true,\"placeholder\":\"请选择客户行业\"}},{\"id\":\"mobile\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"手机号\",\"readonly\":false,\"placeholder\":\"手机号\",\"required\":true,\"is_delete\":false}},{\"id\":\"level\",\"name\":\"评分\",\"type\":1,\"component\":\"Rate\",\"config\":{\"label\":\"客户级别\",\"allowHalf\":true,\"disabled\":false,\"type\":\"default\",\"is_delete\":true}},{\"id\":\"telephone\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"电话\",\"readonly\":false,\"placeholder\":\"电话\",\"required\":false,\"is_delete\":true}},{\"id\":\"address_detail\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"地址\",\"readonly\":false,\"row\":2,\"placeholder\":\"请输入地址\",\"required\":false,\"is_delete\":true}},{\"id\":\"next_time\",\"name\":\"时间选择框\",\"type\":1,\"component\":\"TimePicker\",\"config\":{\"label\":\"下次联系时间\",\"placeholder\":\"点击选择\",\"type\":\"time\",\"format\":\"YYYY-MM-DD HH:mm:ss\",\"confirm\":true,\"required\":false,\"readonly\":false,\"is_delete\":true}},{\"id\":\"remarks\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"备注信息\",\"readonly\":false,\"row\":2,\"placeholder\":\"备注信息\",\"required\":false,\"is_delete\":true}}]}', 1619592288, 1655433791, NULL);
INSERT INTO `__PREFIX__qingdongams_form`
VALUES (12, '客户管理', 'customer', '{\"data\":[{\"id\":\"name\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"客户名称\",\"readonly\":false,\"placeholder\":\"请输入客户名称\",\"required\":true,\"is_delete\":false}},{\"id\":\"subname\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"助记名称\",\"readonly\":false,\"placeholder\":\"请输入助记名称\",\"required\":false,\"is_delete\":true}},{\"id\":\"mobile\",\"name\":\"数字框\",\"type\":1,\"value\":\"\",\"component\":\"input\",\"config\":{\"label\":\"手机号\",\"placeholder\":\"请输入手机号\",\"required\":true,\"is_delete\":false,\"value\":\"\",\"infoType\":\"main\",\"only\":false,\"listShow\":false,\"addShow\":false}},{\"id\":\"industry\",\"name\":\"下拉选择框\",\"type\":1,\"component\":\"select\",\"config\":{\"label\":\"客户所属\",\"type\":null,\"content\":[{\"key\":\"\",\"value\":\"终端客户\",\"__label\":\"重点客户\",\"__value\":[\"终端客户\"],\"nodeKey\":1,\"isEdit\":false,\"label\":\"重点客户\"},{\"key\":\"\",\"value\":\"代理商\",\"__label\":\"普通客户\",\"__value\":[\"代理商\"],\"nodeKey\":2,\"isEdit\":false,\"label\":\"普通客户\"},{\"key\":\"\",\"value\":\"同行\",\"__value\":[\"同行\"],\"nodeKey\":3,\"isEdit\":false,\"label\":\"非优先客户\",\"__label\":\"非优先客户\"}],\"required\":true,\"multiple\":false,\"is_delete\":false,\"placeholder\":\"请输入客户所属\"}},{\"id\":\"follow\",\"name\":\"下拉选择框\",\"type\":1,\"component\":\"select\",\"config\":{\"label\":\"客户状态\",\"type\":null,\"content\":[{\"key\":\"\",\"value\":\"初次接触\",\"__label\":\"初次接触\",\"__value\":[\"初次接触\"],\"nodeKey\":1,\"isEdit\":false,\"label\":\"初次接触\"},{\"key\":\"\",\"value\":\"正在跟进\",\"__label\":\"正在跟进\",\"__value\":[\"正在跟进\"],\"nodeKey\":2,\"isEdit\":false,\"label\":\"正在跟进\"},{\"key\":\"\",\"value\":\"准备购买\",\"__label\":\"准备购买\",\"__value\":[\"准备购买\"],\"nodeKey\":3,\"isEdit\":false,\"label\":\"准备购买\"},{\"key\":\"\",\"value\":\"准备付款\",\"__label\":\"准备付款\",\"__value\":[\"准备付款\"],\"nodeKey\":4,\"isEdit\":false,\"label\":\"准备付款\"},{\"key\":\"\",\"value\":\"已经购买\",\"__label\":\"已经购买\",\"__value\":[\"已经购买\"],\"nodeKey\":5,\"isEdit\":false,\"label\":\"已经购买\"},{\"key\":\"\",\"value\":\"暂时搁置\",\"__label\":\"暂时搁置\",\"__value\":[\"暂时搁置\"],\"nodeKey\":6,\"isEdit\":false,\"label\":\"暂时搁置\"}],\"required\":true,\"multiple\":false,\"is_delete\":false,\"placeholder\":\"请输入客户状态\"}},{\"id\":\"level\",\"name\":\"评分\",\"type\":1,\"component\":\"Rate\",\"config\":{\"label\":\"客户星级\",\"allowHalf\":true,\"disabled\":false,\"type\":\"default\",\"is_delete\":true,\"placeholder\":\"客户星级\"}},{\"id\":\"source\",\"name\":\"下拉选择框\",\"type\":1,\"component\":\"select\",\"config\":{\"label\":\"客户来源\",\"type\":null,\"content\":[{\"key\":\"\",\"value\":\"行业活动\",\"__label\":\"行业活动\",\"__value\":[\"行业活动\"],\"nodeKey\":1,\"isEdit\":false,\"label\":\"行业活动\"},{\"key\":\"\",\"value\":\"搜索引擎\",\"__label\":\"搜索引擎\",\"__value\":[\"搜索引擎\"],\"nodeKey\":2,\"isEdit\":false,\"label\":\"搜索引擎\"},{\"key\":\"\",\"value\":\"客户转介绍\",\"__label\":\"客户转介绍\",\"__value\":[\"客户转介绍\"],\"nodeKey\":3,\"isEdit\":false,\"label\":\"客户转介绍\"},{\"key\":\"\",\"value\":\"展会\",\"__label\":\"展会\",\"__value\":[\"展会\"],\"nodeKey\":4,\"isEdit\":false,\"label\":\"展会\"},{\"key\":\"\",\"value\":\"朋友介绍\",\"__label\":\"朋友介绍\",\"__value\":[\"朋友介绍\"],\"nodeKey\":5,\"isEdit\":false,\"label\":\"朋友介绍\"},{\"key\":\"\",\"value\":\"市场推广\",\"__value\":[\"市场推广\"],\"nodeKey\":6,\"isEdit\":false,\"label\":\"市场推广\",\"__label\":\"市场推广\"}],\"required\":true,\"multiple\":false,\"is_delete\":false,\"placeholder\":\"客户来源\"}},{\"id\":\"other_12771\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"备注信息\",\"row\":2,\"placeholder\":\"请输入备注信息\",\"required\":false,\"is_delete\":true}}]}', 1619592291, 1665543214, NULL);
INSERT INTO `__PREFIX__qingdongams_form`
VALUES (13, '联系人管理', 'contacts',
        '{\"data\":[{\"id\":\"name\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"联系人姓名\",\"readonly\":false,\"placeholder\":\"请输入联系人姓名\",\"required\":true,\"is_delete\":false}},{\"id\":\"subname\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"尊称\",\"readonly\":false,\"placeholder\":\"请输入尊称\",\"required\":false,\"is_delete\":true}},{\"id\":\"other_21517\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"电话\",\"placeholder\":\"请输入联系人电话\",\"required\":false,\"is_delete\":true}},{\"id\":\"mobile\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"手机号\",\"placeholder\":\"请输入联系人手机号\",\"required\":true,\"is_delete\":false}},{\"id\":\"role\",\"name\":\"下拉选择框\",\"type\":1,\"component\":\"select\",\"config\":{\"label\":\"角色\",\"type\":null,\"content\":[{\"key\":\"\",\"value\":\"普通员工\",\"__label\":\"普通员工\",\"__value\":[\"普通员工\"],\"nodeKey\":1,\"isEdit\":false,\"label\":\"普通员工\"},{\"key\":\"\",\"value\":\"决策人\",\"__label\":\"决策人\",\"__value\":[\"决策人\"],\"nodeKey\":2,\"isEdit\":false,\"label\":\"决策人\"},{\"key\":\"\",\"value\":\"分项决策人\",\"__label\":\"分项决策人\",\"__value\":[\"分项决策人\"],\"nodeKey\":3,\"isEdit\":false,\"label\":\"分项决策人\"},{\"key\":\"\",\"value\":\"商务决策\",\"__label\":\"商务决策\",\"__value\":[\"商务决策\"],\"nodeKey\":4,\"isEdit\":false,\"label\":\"商务决策\"},{\"key\":\"\",\"value\":\"财务决策\",\"__label\":\"财务决策\",\"__value\":[\"财务决策\"],\"nodeKey\":5,\"isEdit\":false,\"label\":\"财务决策\"},{\"key\":\"\",\"value\":\"使用人\",\"__label\":\"使用人\",\"__value\":[\"使用人\"],\"nodeKey\":6,\"isEdit\":false,\"label\":\"使用人\"},{\"key\":\"\",\"value\":\"意见影响人\",\"__label\":\"意见影响人\",\"__value\":[\"意见影响人\"],\"nodeKey\":7,\"isEdit\":false,\"label\":\"意见影响人\"},{\"key\":\"\",\"value\":\"采购\",\"__label\":\"采购\",\"__value\":[\"采购\"],\"nodeKey\":8,\"isEdit\":false,\"label\":\"采购\"},{\"key\":\"\",\"value\":\"老板\",\"__label\":\"老板\",\"__value\":[\"老板\"],\"nodeKey\":9,\"isEdit\":false,\"label\":\"老板\"},{\"key\":\"\",\"value\":\"股东\",\"__label\":\"股东\",\"__value\":[\"股东\"],\"nodeKey\":10,\"isEdit\":false,\"label\":\"股东\"},{\"key\":\"\",\"value\":\"职业经理人\",\"__value\":[\"职业经理人\"],\"nodeKey\":11,\"isEdit\":false,\"label\":\"职业经理人\",\"__label\":\"职业经理人\"}],\"required\":true,\"multiple\":false,\"is_delete\":true,\"placeholder\":\"请选择角色\"}},{\"id\":\"post\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"部门职务\",\"placeholder\":\"请输入部门职务\",\"required\":true,\"is_delete\":true}},{\"id\":\"other_4367\",\"name\":\"日期选择框\",\"type\":1,\"component\":\"DatePicker\",\"config\":{\"label\":\"生日\",\"placeholder\":\"请输入联系人生日\",\"type\":\"date\",\"value\":\"\",\"required\":false,\"is_delete\":true}},{\"id\":\"email\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"邮箱\",\"placeholder\":\"请输入邮箱\",\"required\":false,\"is_delete\":true}},{\"id\":\"other_17344\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"微信\",\"placeholder\":\"请输入联系人微信\",\"required\":false,\"is_delete\":true}},{\"id\":\"other_23536\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"备注信息\",\"row\":2,\"placeholder\":\"请输入备注信息\",\"required\":false,\"is_delete\":true}}]}',
        1619592291, 1643096926, NULL);
INSERT INTO `__PREFIX__qingdongams_form`
VALUES (14, '合同管理', 'contract',
        '{\"data\":[{\"id\":\"num\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"合同编号\",\"readonly\":false,\"placeholder\":\"输入合同编号\",\"required\":true,\"is_delete\":false}},{\"id\":\"name\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"合同名称\",\"readonly\":false,\"placeholder\":\"请输入合同名称\",\"required\":true,\"is_delete\":false}},{\"id\":\"money\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"合同金额\",\"readonly\":false,\"placeholder\":\"请输入合同金额\",\"required\":true,\"is_delete\":false}},{\"id\":\"order_date\",\"name\":\"时间选择框\",\"type\":1,\"component\":\"TimePicker\",\"config\":{\"label\":\"签约时间\",\"placeholder\":\"点击选择\",\"type\":\"time\",\"format\":\"HH:mm:ss\",\"confirm\":true,\"required\":true,\"readonly\":false,\"is_delete\":false}},{\"id\":\"start_time\",\"name\":\"日期选择框\",\"type\":1,\"component\":\"DatePicker\",\"config\":{\"label\":\"合同生效时间\",\"placeholder\":\"点击选择\",\"type\":\"date\",\"format\":\"\",\"value\":\"\",\"required\":true,\"readonly\":false,\"is_delete\":false}},{\"id\":\"end_time\",\"name\":\"日期选择框\",\"type\":1,\"component\":\"DatePicker\",\"config\":{\"label\":\"合同线束时间\",\"placeholder\":\"点击选择\",\"type\":\"date\",\"format\":\"\",\"value\":\"\",\"required\":true,\"readonly\":false,\"is_delete\":false}},{\"id\":\"other_47006\",\"name\":\"单选框\",\"type\":1,\"component\":\"radio\",\"config\":{\"label\":\"是否含税\",\"content\":[{\"key\":\"\",\"value\":\"含税\"},{\"key\":\"\",\"value\":\"不含税\"}],\"placeholder\":\"请输入\",\"required\":false,\"is_delete\":true}}]}',
        1619592291, 1643020154, NULL);
INSERT INTO `__PREFIX__qingdongams_form`
VALUES (15, '回款管理', 'examine',
        '{\"data\":[{\"id\":\"number\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"回款编号\",\"placeholder\":\"请输入回款编号\",\"required\":true,\"is_delete\":false}},{\"id\":\"return_time\",\"name\":\"日期选择框\",\"type\":1,\"component\":\"DatePicker\",\"config\":{\"label\":\"回款日期\",\"placeholder\":\"点击选择\",\"type\":\"date\",\"value\":\"\",\"required\":true,\"is_delete\":false}},{\"id\":\"money\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"回款金额\",\"placeholder\":\"请输入回款金额\",\"required\":true,\"is_delete\":false}},{\"id\":\"return_type\",\"name\":\"下拉选择框\",\"type\":1,\"component\":\"select\",\"config\":{\"label\":\"回款方式\",\"type\":null,\"content\":[{\"key\":\"\",\"value\":\"微信\",\"__label\":\"微信\",\"__value\":[\"微信\"],\"nodeKey\":1,\"isEdit\":false,\"label\":\"微信\"}],\"required\":true,\"is_delete\":true}}]}',
        1619592291, 1643020163, NULL);
INSERT INTO `__PREFIX__qingdongams_form` VALUES (16, '日报管理', 'daily', '{\"data\":[{\"id\":\"other_43472\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.1.完成了哪些工作\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":true,\"is_delete\":true}},{\"id\":\"other_48871\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.2.取得了哪些成绩\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":true,\"is_delete\":true}},{\"id\":\"other_33048\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.3.当前进展如何\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":true,\"is_delete\":true}},{\"id\":\"other_82389\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.4.计划实施情况\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":true,\"is_delete\":true}}]}', 1619491859, 1640141699, NULL);
INSERT INTO `__PREFIX__qingdongams_form` VALUES (17, '周报管理', 'weekly', '{\"data\":[{\"id\":\"other_72263\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.1.完成了哪些工作\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":false,\"is_delete\":true}},{\"id\":\"other_22415\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.2.取得了哪些成绩\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":false,\"is_delete\":true}},{\"id\":\"other_41856\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.3.当前进展如何\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":false,\"is_delete\":true}}]}', 1643020163, 1643020163, NULL);
INSERT INTO `__PREFIX__qingdongams_form` VALUES (18, '月报管理', 'monthly', '{\"data\":[{\"id\":\"other_79661\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.1.完成了哪些工作\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":false,\"is_delete\":true}},{\"id\":\"other_52344\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.2.取得了哪些成绩\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":false,\"is_delete\":true}},{\"id\":\"other_15457\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.3.当前进展如何\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":false,\"is_delete\":true}}]}', 1643020163, 1643020163, NULL);
INSERT INTO `__PREFIX__qingdongams_form` VALUES (19, '季报管理', 'quarterly', '{\"data\":[{\"id\":\"other_43472\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.1.完成了哪些工作\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":true,\"is_delete\":true}},{\"id\":\"other_48871\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.2.取得了哪些成绩\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":true,\"is_delete\":true}},{\"id\":\"other_33048\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.3.当前进展如何\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":true,\"is_delete\":true}},{\"id\":\"other_82389\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.4.计划实施情况\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":true,\"is_delete\":true}}]}', 1619491859, 1640141727, NULL);
INSERT INTO `__PREFIX__qingdongams_form` VALUES (20, '年报管理', 'yearly', '{\"data\":[{\"id\":\"other_43472\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.1.完成了哪些工作\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":true,\"is_delete\":true}},{\"id\":\"other_48871\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.2.取得了哪些成绩\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":true,\"is_delete\":true}},{\"id\":\"other_33048\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.3.当前进展如何\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":true,\"is_delete\":true}},{\"id\":\"other_82389\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"1.4.计划实施情况\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":true,\"is_delete\":true}},{\"id\":\"other_90392\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"2.1 面临哪些挑战\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":false,\"is_delete\":true}},{\"id\":\"other_72126\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"2.2 什么原因导致的\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":false,\"is_delete\":true}},{\"id\":\"other_39787\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"2.3 有何改进措施\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":true,\"is_delete\":true}},{\"id\":\"other_66752\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"3.1 节约了哪些成本\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":false,\"is_delete\":true}},{\"id\":\"other_62312\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"3.2 提升了哪些效率\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":false,\"is_delete\":true}},{\"id\":\"other_62889\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"3.3 优化了哪些步骤\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":false,\"is_delete\":true}},{\"id\":\"other_98365\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"3.4 拓宽了哪些渠道\",\"row\":2,\"placeholder\":\"请输入内容\",\"required\":false,\"is_delete\":true}},{\"id\":\"other_80726\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"4.1 下一步的安排\",\"row\":2,\"placeholder\":\"请输入下一步的安排\",\"required\":false,\"is_delete\":true}},{\"id\":\"other_15038\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"4.2 需要的资源支持\",\"row\":2,\"placeholder\":\"请输入需要的资源支持\",\"required\":false,\"is_delete\":true}},{\"id\":\"other_970\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"4.3 预计达到的结果\",\"row\":2,\"placeholder\":\"请输入预计达到的结果\",\"required\":false,\"is_delete\":true}}]}', 1643020163, 1643020163, NULL);
INSERT INTO `__PREFIX__qingdongams_form` VALUES (21, '外勤签到', 'signin', '{\"data\":[{\"id\":\"other_35260\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"备注\",\"row\":2,\"placeholder\":\"请输入备注\",\"required\":false,\"is_delete\":true}},{\"id\":\"other_65453\",\"name\":\"图片上传\",\"type\":1,\"component\":\"uploadImage\",\"config\":{\"label\":\"图片上传\",\"value\":[],\"required\":false,\"placeholder\":\"请上传图片\",\"maxnum\":1,\"is_delete\":true,\"format\":[\"jpg\",\"jpeg\",\"png\"],\"maxSize\":5000}}],\"isAddContact\":true}', 1643020163, 1657163099, NULL);
INSERT INTO `__PREFIX__qingdongams_form` VALUES (22, '商机管理', 'business', '{\"data\":[{\"id\":\"name\",\"name\":\"单行输入框\",\"type\":1,\"component\":\"input\",\"config\":{\"type\":\"text\",\"label\":\"商机名称\",\"readonly\":false,\"placeholder\":\"商机名称\",\"required\":true,\"is_delete\":false}},{\"id\":\"money\",\"name\":\"数字框\",\"type\":1,\"component\":\"input-number\",\"config\":{\"label\":\"商机金额\",\"placeholder\":\"请输入商机金额\",\"required\":true,\"is_delete\":false}},{\"id\":\"expect_time\",\"name\":\"日期选择框\",\"type\":1,\"component\":\"DatePicker\",\"config\":{\"label\":\"预计成交时间\",\"placeholder\":\"请输入预计成交时间\",\"type\":\"date\",\"value\":\"\",\"required\":true,\"is_delete\":true}},{\"id\":\"next_time\",\"name\":\"时间选择框\",\"type\":1,\"component\":\"TimePicker\",\"config\":{\"label\":\"下次跟进时间\",\"placeholder\":\"点击选择\",\"type\":\"time\",\"format\":\"YYYY-MM-DD HH:mm:ss\",\"confirm\":true,\"required\":false,\"readonly\":false,\"is_delete\":true}},{\"id\":\"other_48629\",\"name\":\"图片上传\",\"type\":1,\"component\":\"uploadImage\",\"config\":{\"label\":\"图片上传\",\"value\":[],\"required\":false,\"placeholder\":\"请上传图片\",\"maxnum\":1,\"is_delete\":true,\"format\":[\"jpg\",\"jpeg\",\"png\"],\"maxSize\":5000}},{\"id\":\"remark\",\"name\":\"文本框\",\"type\":1,\"component\":\"textarea\",\"config\":{\"label\":\"备注信息\",\"readonly\":false,\"row\":2,\"placeholder\":\"备注信息\",\"required\":false,\"is_delete\":true}}],\"isAddContact\":true}', 1619592288, 1659082152, NULL);


INSERT INTO `__PREFIX__qingdongams_flow` (id,name,status,examine_ids,relation_type,last_modified,last_admin_id,createtime,updatetime)
VALUES (1, '费用', 0, 0,'consume', 1657014906, 1, 1657014906, 1657014906);
INSERT INTO `__PREFIX__qingdongams_flow`  (id,name,status,examine_ids,relation_type,last_modified,last_admin_id,createtime,updatetime)
VALUES (2, '业绩', 0, 0,'achievement',1657767346, 1, 1657767346, 1657767346);
INSERT INTO `__PREFIX__qingdongams_flow`  (id,name,status,examine_ids,relation_type,last_modified,last_admin_id,createtime,updatetime)
VALUES (3, '回款', 0, 0,'receivables',1658388920, 1, 1658388920, 1658388920);
INSERT INTO `__PREFIX__qingdongams_flow`  (id,name,status,examine_ids,relation_type,last_modified,last_admin_id,createtime,updatetime)
VALUES (4, '合同', 0, 0,'contract', 1658388928, 1, 1658388928, 1658388928);
INSERT INTO `__PREFIX__qingdongams_flow`  (id,name,status,examine_ids,relation_type,last_modified,last_admin_id,createtime,updatetime)
VALUES (5, '补卡', 0, 0,'card',1658388928, 1, 1658388928, 1658388928);
INSERT INTO `__PREFIX__qingdongams_flow`  (id,name,status,examine_ids,relation_type,last_modified,last_admin_id,createtime,updatetime)
VALUES (6, '请假', 0, 0, 'leave',1658388928, 1, 1658388928, 1658388928);
INSERT INTO `__PREFIX__qingdongams_flow`(`id`, `name`, `status`, `type`, `examine_ids`, `remark`, `relation_type`, `group_ids`, `weight`, `last_modified`, `last_admin_id`, `createtime`, `updatetime`, `deletetime`)
VALUES (7, '出入库', 0, NULL, 0, '', 'parts', '', NULL, 1665216023, 1, 1665216023, 1665216023, NULL);
INSERT INTO `__PREFIX__qingdongams_flow`(`id`, `name`, `status`, `type`, `examine_ids`, `remark`, `relation_type`, `group_ids`, `weight`, `last_modified`, `last_admin_id`, `createtime`, `updatetime`, `deletetime`)
VALUES (8, '工单', 0, NULL, 0, '', 'workorder', '', NULL, 1665226685, 1, 1665226685, 1665226685, NULL);
INSERT INTO `__PREFIX__qingdongams_flow`(`id`, `name`, `status`, `type`, `examine_ids`, `remark`, `relation_type`, `group_ids`, `weight`, `last_modified`, `last_admin_id`, `createtime`, `updatetime`, `deletetime`)
VALUES (9, '报价', 0, NULL, 0, '', 'quote', '', NULL, 1665541798, 1, 1665541798, 1665541798, NULL);

INSERT INTO `__PREFIX__qingdongams_seas_type` VALUES (1, '默认公海', '客户不满足其他公海规则时，会移入当前公海', NULL, NULL, NULL, NULL);

INSERT INTO `__PREFIX__qingdongams_field`(`id`, `type`, `name`, `data`, `field`) VALUES (1, 'other', '跟进类型', '[\"到访\",\"电话\",\"微信\",\"签约\",\"邮件\"]', NULL);
INSERT INTO `__PREFIX__qingdongams_field`(`id`, `type`, `name`, `data`, `field`) VALUES (2, 'other', '消费方式', '[\"吃饭\",\"住酒店\"]', NULL);
INSERT INTO `__PREFIX__qingdongams_field`(`id`, `type`, `name`, `data`, `field`) VALUES (3, 'examine', '回款方式', '[\"微信\"]', NULL);
INSERT INTO `__PREFIX__qingdongams_field`(`id`, `type`, `name`, `data`, `field`) VALUES (4, 'contacts', '角色', '[\"普通员工\",\"决策人\",\"分项决策人\",\"商务决策\",\"财务决策\",\"使用人\",\"意见影响人\",\"采购\",\"老板\",\"股东\",\"职业经理人\"]', NULL);
INSERT INTO `__PREFIX__qingdongams_field`(`id`, `type`, `name`, `data`, `field`) VALUES (5, 'leads', '线索来源', '[\"拜访\",\"上门\"]', NULL);
INSERT INTO `__PREFIX__qingdongams_field`(`id`, `type`, `name`, `data`, `field`) VALUES (6, 'leads', '客户行业', '[\"互联网\",\"信息化\",\"测试\"]', NULL);
INSERT INTO `__PREFIX__qingdongams_field`(`id`, `type`, `name`, `data`, `field`) VALUES (7, 'customer', '客户所属', '[\"重点客户\",\"普通客户\",\"非优先客户\"]', NULL);
INSERT INTO `__PREFIX__qingdongams_field`(`id`, `type`, `name`, `data`, `field`) VALUES (8, 'customer', '客户状态', '[\"初次接触\",\"正在跟进\",\"准备购买\",\"准备付款\",\"已经购买\",\"暂时搁置\"]', NULL);
INSERT INTO `__PREFIX__qingdongams_field`(`id`, `type`, `name`, `data`, `field`) VALUES (9, 'customer', '客户来源', '[\"行业活动\",\"搜索引擎\",\"客户转介绍\",\"展会\",\"朋友介绍\",\"市场推广\"]', NULL);
INSERT INTO `__PREFIX__qingdongams_field`(`id`, `type`, `name`, `data`, `field`) VALUES (10, 'business', '商机阶段', '[\"验证客户\",\"需求分析\",\"方案\\/报价\",\"赢单\",\"输单\"]', NULL);


INSERT INTO `__PREFIX__qingdongams_notice_template`(`id`, `name`, `type`, `data`, `enterprise_data`, `createtime`, `updatetime`, `deletetime`) VALUES (1, '审批通知', 'examine', '{\"template_id\":\"\",\"first\":\"{{staff_name}}发起一个《审批》指定由您处理\",\"keyword1\":\"{{customer_name}}\",\"keyword1_color\":\"#666\",\"keyword2\":\"{{date}}\",\"keyword2_color\":\"#666\",\"keyword3\":\"\",\"keyword3_color\":\"#666\",\"keyword4\":\"\",\"keyword4_color\":\"#666\",\"keyword5\":\"\",\"keyword5_color\":\"#666\",\"remark\":\"请及时处理！\",\"remark_color\":\"#666\"}', NULL, NULL, NULL, NULL);
INSERT INTO `__PREFIX__qingdongams_notice_template`(`id`, `name`, `type`, `data`, `enterprise_data`, `createtime`, `updatetime`, `deletetime`) VALUES (3, '新建跟进记录通知', 'record', '{\"template_id\":\"\",\"first\":\"{{staff_name}}刚刚新建了一条《跟进记录》指定由您审阅\",\"keyword1\":\"{{customer_name}}\",\"keyword1_color\":\"#666\",\"keyword2\":\"{{customer_follow}}\",\"keyword2_color\":\"#666\",\"keyword3\":\"{{date}}\",\"keyword3_color\":\"#666\",\"keyword4\":\"\",\"keyword4_color\":\"#666\",\"keyword5\":\"\",\"keyword5_color\":\"#666\",\"remark\":\"请及时处理！\",\"remark_color\":\"#666\"}', NULL, NULL, NULL, NULL);
INSERT INTO `__PREFIX__qingdongams_notice_template`(`id`, `name`, `type`, `data`, `enterprise_data`, `createtime`, `updatetime`, `deletetime`) VALUES (4, '新建工作报告通知', 'daily', '{\"template_id\":\"\",\"first\":\"{{staff_name}}刚刚新建了一条《工作报告》指定由您审阅\",\"keyword1\":\"{{date}}\",\"keyword1_color\":\"#666\",\"keyword2\":\"{{daily_type}}\",\"keyword2_color\":\"#666\",\"keyword3\":\"\",\"keyword3_color\":\"#666\",\"keyword4\":\"\",\"keyword4_color\":\"#666\",\"keyword5\":\"\",\"keyword5_color\":\"#666\",\"remark\":\"\",\"remark_color\":\"#666\"}', NULL, NULL, NULL, NULL);
INSERT INTO `__PREFIX__qingdongams_notice_template`(`id`, `name`, `type`, `data`, `enterprise_data`, `createtime`, `updatetime`, `deletetime`) VALUES (5, '回收客户到公海通知', 'seas', '{\"template_id\":\"\",\"first\":\"您的客户长时间未跟进，已被系统自动回收到公海池内。\",\"keyword1\":\"{{customer_name}}\",\"keyword1_color\":\"#666\",\"keyword2\":\"{{day}}\",\"keyword2_color\":\"#666\",\"keyword3\":\"{{date}}\",\"keyword3_color\":\"#666\",\"keyword4\":\"\",\"keyword4_color\":\"#666\",\"keyword5\":\"\",\"keyword5_color\":\"#666\",\"remark\":\"建议客户及时跟进！\",\"remark_color\":\"#666\"}', NULL, NULL, NULL, NULL);
INSERT INTO `__PREFIX__qingdongams_notice_template`(`id`, `name`, `type`, `data`, `enterprise_data`, `createtime`, `updatetime`, `deletetime`) VALUES (7, '审批通过通知', 'examine_adopt', '{\"template_id\":\"\",\"first\":\"您提交的审批已审核通过！\",\"keyword1\":\"{{check_name}}\",\"keyword1_color\":\"#666\",\"keyword2\":\"{{examine_type}}\",\"keyword2_color\":\"#666\",\"keyword3\":\"{{submit_time}}\",\"keyword3_color\":\"#666\",\"keyword4\":\"\",\"keyword4_color\":\"#666\",\"keyword5\":\"\",\"keyword5_color\":\"#666\",\"remark\":\"审核通过！\",\"remark_color\":\"#666\"}', NULL, NULL, NULL, NULL);
INSERT INTO `__PREFIX__qingdongams_notice_template`(`id`, `name`, `type`, `data`, `enterprise_data`, `createtime`, `updatetime`, `deletetime`) VALUES (8, '审批拒绝通知', 'examine_refuse', '{\"template_id\":\"\",\"first\":\"您提交的审批被拒绝！\",\"keyword1\":\"{{staff_name}}\",\"keyword1_color\":\"#666\",\"keyword2\":\"{{check_name}}\",\"keyword2_color\":\"#666\",\"keyword3\":\"{{check_name}}\",\"keyword3_color\":\"#666\",\"keyword4\":\"{{examine_desc}}\",\"keyword4_color\":\"#666\",\"keyword5\":\"\",\"keyword5_color\":\"#666\",\"remark\":\"审核拒绝！\",\"remark_color\":\"#666\"}', NULL, NULL, NULL, NULL);
INSERT INTO `__PREFIX__qingdongams_notice_template`(`id`, `name`, `type`, `data`, `enterprise_data`, `createtime`, `updatetime`, `deletetime`) VALUES (9, '合同到期通知', 'contract_expire', '{\"template_id\":\"\",\"first\":\"合同即将到期，请尽快跟进回款\",\"keyword1\":\"{{customer_name}}\",\"keyword1_color\":\"#666\",\"keyword2\":\"{{money}}\",\"keyword2_color\":\"#666\",\"keyword3\":\"{{submit_time}}\",\"keyword3_color\":\"#666\",\"keyword4\":\"\",\"keyword4_color\":\"#666\",\"keyword5\":\"\",\"keyword5_color\":\"#666\",\"remark\":\"请及时跟进！\",\"remark_color\":\"#666\"}', NULL, NULL, NULL, NULL);
INSERT INTO `__PREFIX__qingdongams_notice_template`(`id`, `name`, `type`, `data`, `enterprise_data`, `createtime`, `updatetime`, `deletetime`) VALUES (10, '回款计划到期通知', 'plan_expire', '{\"template_id\":\"\",\"first\":\"已到计划回款约定时间，请尽快跟进回款\",\"keyword1\":\"{{customer_name}}\",\"keyword1_color\":\"#666\",\"keyword2\":\"{{plan_money}}\",\"keyword2_color\":\"#666\",\"keyword3\":\"{{plan_time}}\",\"keyword3_color\":\"#666\",\"keyword4\":\"\",\"keyword4_color\":\"#666\",\"keyword5\":\"\",\"keyword5_color\":\"#666\",\"remark\":\"请及时跟进！\",\"remark_color\":\"#666\"}', NULL, NULL, NULL, NULL);
INSERT INTO `__PREFIX__qingdongams_notice_template`(`id`, `name`, `type`, `data`, `enterprise_data`, `createtime`, `updatetime`, `deletetime`) VALUES (11, '评论通知', 'comment', '{\"template_id\":\"\",\"first\":\"评论了您提交的跟进记录！\",\"keyword1\":\"{{staff_name}}\",\"keyword1_color\":\"#666\",\"keyword2\":\"{{content}}\",\"keyword2_color\":\"#666\",\"keyword3\":\"{{date}}\",\"keyword3_color\":\"#666\",\"keyword4\":\"\",\"keyword4_color\":\"#666\",\"keyword5\":\"\",\"keyword5_color\":\"#666\",\"remark\":\"请及时处理！\",\"remark_color\":\"#666\"}', NULL, NULL, NULL, NULL);

INSERT INTO  `__PREFIX__qingdongams_ocr_type`(`id`, `name`, `type`, `action`) VALUES (1, '增值税发票识别', 1, 'vat_invoice');
INSERT INTO  `__PREFIX__qingdongams_ocr_type`(`id`, `name`, `type`, `action`) VALUES (2, '增值税发票验真', 1, 'vat_invoice_verification');
INSERT INTO  `__PREFIX__qingdongams_ocr_type`(`id`, `name`, `type`, `action`) VALUES (3, '定额发票识别', 1, 'quota_invoice');
INSERT INTO  `__PREFIX__qingdongams_ocr_type`(`id`, `name`, `type`, `action`) VALUES (4, '通用机打发票识别', 1, 'invoice');
INSERT INTO  `__PREFIX__qingdongams_ocr_type`(`id`, `name`, `type`, `action`) VALUES (5, '火车票识别', 1, 'train_ticket');
INSERT INTO  `__PREFIX__qingdongams_ocr_type`(`id`, `name`, `type`, `action`) VALUES (6, '出租车票识别', 1, 'taxi_receipt');
INSERT INTO  `__PREFIX__qingdongams_ocr_type`(`id`, `name`, `type`, `action`) VALUES (7, '飞机行程单识别', 1, 'air_ticket');
INSERT INTO  `__PREFIX__qingdongams_ocr_type`(`id`, `name`, `type`, `action`) VALUES (8, '汽车票识别', 1, 'bus_ticket');
INSERT INTO  `__PREFIX__qingdongams_ocr_type`(`id`, `name`, `type`, `action`) VALUES (9, '过路过桥费发票识别', 1, 'toll_invoice');
INSERT INTO  `__PREFIX__qingdongams_ocr_type`(`id`, `name`, `type`, `action`) VALUES (10, '船票识别', 1, 'ferry_ticket');
INSERT INTO  `__PREFIX__qingdongams_ocr_type`(`id`, `name`, `type`, `action`) VALUES (11, '网约车行程单识别', 1, 'online_taxi_itinerary');
INSERT INTO  `__PREFIX__qingdongams_ocr_type`(`id`, `name`, `type`, `action`) VALUES (12, '通用票据识别', 1, 'receipt');
INSERT INTO  `__PREFIX__qingdongams_ocr_type`(`id`, `name`, `type`, `action`) VALUES (13, '车牌识别', 1, 'license_plate');
INSERT INTO  `__PREFIX__qingdongams_ocr_type`(`id`, `name`, `type`, `action`) VALUES (14, '名片识别', 1, 'business_card');


