CREATE TABLE `publish` (
    `publish_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '发布需求ID',
    `cate_id` bigint(20) NOT NULL COMMENT '分类ID',
    `parent_cate_id` bigint(20) DEFAULT NULL COMMENT '一级分类ID',
    `member_id` bigint(20) NOT NULL COMMENT '一级分类ID',
    `name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '需求标题',
    `publish_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '需求描述',
    `publish_state`  varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NOT NULL DEFAULT '001' COMMENT '发布状态 code',
    `bid_merchant_id` bigint(20) DEFAULT NULL COMMENT '中标商家',
    `bid_server_user_id` bigint(20) DEFAULT NULL COMMENT '中标用户',
    `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
    `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '创建者',
    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
    `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '更新者',
    `update_time` datetime DEFAULT NULL COMMENT '更新时间',
    `column1` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '预留字段1',
    `column2` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '预留字段2',
    `column3` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '预留字段2',
    PRIMARY KEY (`publish_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='发布需求表';

CREATE TABLE `publish_quote` (
    `quote_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '需求报价ID',
    `publish_id` bigint(20) NOT NULL COMMENT '需求ID',
    `server_user_id` bigint(20) NOT NULL COMMENT '报价服务人员ID',
    `merchant_id` bigint(20) NOT NULL COMMENT '报价人员商户ID',
    `quote_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '报价描述',
    `quote_unit` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '报价单位（code）',
    `other_unit` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '报价单位(code为099其他时，手填单位)',
    `single_price` decimal(10,2) DEFAULT NULL COMMENT '报价单价',
    `single_time` decimal(4,1) DEFAULT NULL COMMENT '单次服务标准时长（小时）',
    `quote_counts` int(5) NOT NULL DEFAULT '0' COMMENT '报价数量',
    `total_price` decimal(10,2) DEFAULT NULL COMMENT '报价总价',
    `total_time` decimal(4,1) DEFAULT NULL COMMENT '服务总时长（小时）',
    `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
    `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '创建者',
    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
    `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '更新者',
    `update_time` datetime DEFAULT NULL COMMENT '更新时间',
    `column1` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '预留字段1',
    `column2` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '预留字段2',
    `column3` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '预留字段2',
    PRIMARY KEY (`quote_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='需求报价表';


CREATE TABLE `publish_quote_reply` (
    `reply_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '报价回复ID',
    `quote_id` bigint(20) NOT NULL COMMENT '需求报价ID',
    `server_user_id` bigint(20) DEFAULT NULL COMMENT '报价服务人员ID',
    `re_reply_id`  bigint(20) DEFAULT NULL COMMENT '回复回复ID',
    `member_id` bigint(20) DEFAULT NULL COMMENT '用户ID',
    `reply_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '0' COMMENT '回复标志（0代表顾客回复 1代表服务人员回复）',
    `reply_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '回复内容',
    `read_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '0' COMMENT '已读标志（0代表未读 1代表已读）',
    `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
    `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '创建者',
    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
    `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '更新者',
    `update_time` datetime DEFAULT NULL COMMENT '更新时间',
    `column1` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '预留字段1',
    `column2` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '预留字段2',
    `column3` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '预留字段2',
    PRIMARY KEY (`reply_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='报价留言回复表';

CREATE TABLE `server_user_follow` (
    `server_user_id` bigint(20) NOT NULL COMMENT '服务人员ID',
    `category_id` bigint(20) NOT NULL COMMENT '分类ID',
    PRIMARY KEY (`server_user_id`,`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='服务人员关注发布类型关联表';

CREATE TABLE `publish_address` (
    `publish_id` bigint(20) NOT NULL COMMENT '发布需求ID',
    `address_id` bigint(20) NOT NULL COMMENT '服务地址ID',
    `address` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '服务地址详情（下单时冗余）',
    `detailed` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NOT NULL COMMENT '门牌号（下单时冗余）',
    `address_longitude` decimal(10,6) NOT NULL COMMENT '服务地址经度',
    `address_latitude` decimal(10,6) NOT NULL COMMENT '服务地址纬度',
    `name` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NOT NULL COMMENT '顾客姓名',
    `sex` bit(1) DEFAULT b'0' COMMENT '性别（0女 1男）',
    `phone` varchar(13) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NOT NULL COMMENT '顾客手机号',
    `privacy_user` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户隐私号',
    `extension_no` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '分机号',
    `subs_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '关系号',
    `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
    `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '创建者',
    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
    `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '更新者',
    `update_time` datetime DEFAULT NULL COMMENT '更新时间',
    `column1` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '预留字段1',
    `column2` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '预留字段2',
    `column3` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '预留字段2',
    PRIMARY KEY (`publish_id`) USING BTREE,
    UNIQUE KEY `publish_id` (`publish_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='需求地址表';

CREATE TABLE `publish_image` (
    `image_id` bigint(20) NOT NULL AUTO_INCREMENT,
    `publish_id` bigint(20) NOT NULL COMMENT '发布需求Id',
    `url` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '资源地址',
    `face_img` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '视频图片资源',
    `type` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '001' COMMENT '资源类型 code004',
    `sorting` int(1) DEFAULT '0' COMMENT '顺序',
    `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
    `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '创建者',
    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
    `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '更新者',
    `update_time` datetime DEFAULT NULL COMMENT '更新时间',
    `column1` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '预留字段1',
    `column2` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '预留字段2',
    `column3` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '预留字段2',
    PRIMARY KEY (`image_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='发布需求图片';

------ code表类型已插入至主库 -------