You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
11 KiB

/*
Navicat Premium Data Transfer
Source Server : 测试
Source Server Type : MariaDB
Source Server Version : 100318
Source Host : test.tall.wiki:3306
Source Schema : pims
Target Server Type : MariaDB
Target Server Version : 100318
File Encoding : 65001
Date: 13/05/2021 15:12:35
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for t_company
-- ----------------------------
DROP TABLE IF EXISTS `t_company`;
CREATE TABLE `t_company` (
`id` bigint(20) NOT NULL,
`project_id` bigint(20) NULL DEFAULT 0 COMMENT '项目id',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '公司名',
`balance` bigint(20) NULL DEFAULT 0 COMMENT '余额',
`created_at` timestamp NOT NULL DEFAULT current_timestamp,
`updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
`rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `project_index`(`project_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '公司信息表' ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for t_cost_log
-- ----------------------------
DROP TABLE IF EXISTS `t_cost_log`;
CREATE TABLE `t_cost_log` (
`id` bigint(20) NOT NULL,
`cost_type_id` bigint(20) NULL DEFAULT 0 COMMENT '成本类型id 如果是产品成本就是产品id',
`product_cost` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '是否是产品成本 0不是 1是',
`year_time` int(11) NULL DEFAULT 0 COMMENT '',
`month_time` int(11) NULL DEFAULT 0 COMMENT '月份',
`predict_cost` bigint(20) NULL DEFAULT 0 COMMENT '预计成本',
`real_cost` bigint(20) NULL DEFAULT 0 COMMENT '实际成本',
`created_at` timestamp NOT NULL DEFAULT current_timestamp,
`updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
`rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `cost_type_index`(`cost_type_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '成本表' ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for t_cost_type
-- ----------------------------
DROP TABLE IF EXISTS `t_cost_type`;
CREATE TABLE `t_cost_type` (
`id` bigint(20) NOT NULL,
`company_id` bigint(20) NULL DEFAULT 0 COMMENT '公司id',
`project_id` bigint(20) NULL DEFAULT 0 COMMENT '项目id',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '成本类型名',
`level` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '类型等级,0大类型 1细分类型',
`parent_id` bigint(20) NULL DEFAULT 0 COMMENT '父id 大类型为0',
`created_at` timestamp NOT NULL DEFAULT current_timestamp,
`updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
`rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `company_index`(`company_id`) USING BTREE,
INDEX `project_index`(`project_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '成本类型表' ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for t_income_statements
-- ----------------------------
DROP TABLE IF EXISTS `t_income_statements`;
CREATE TABLE `t_income_statements` (
`id` bigint(20) NOT NULL,
`company_id` bigint(20) NULL DEFAULT 0 COMMENT '项目id',
`project_id` bigint(20) NULL DEFAULT 0 COMMENT '项目id',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '名字',
`created_at` timestamp NOT NULL DEFAULT current_timestamp,
`updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
`rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `company_index`(`company_id`) USING BTREE,
INDEX `project_index`(`project_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '损益类型表' ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for t_income_statements_log
-- ----------------------------
DROP TABLE IF EXISTS `t_income_statements_log`;
CREATE TABLE `t_income_statements_log` (
`id` bigint(20) NOT NULL,
`company_id` bigint(20) NULL DEFAULT 0 COMMENT '项目id',
`project_id` bigint(20) NULL DEFAULT 0 COMMENT '项目id',
`income_statements_id` bigint(20) NULL DEFAULT 0 COMMENT '变动事宜表id',
`year_income` int(11) NULL DEFAULT 0 COMMENT '',
`month_time` int(11) NULL DEFAULT 0 COMMENT '月份',
`predict_money` bigint(20) NULL DEFAULT 0 COMMENT '预计收入',
`real_money` bigint(20) NULL DEFAULT 0 COMMENT '实际收入',
`created_at` timestamp NOT NULL DEFAULT current_timestamp,
`updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
`rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `company_index`(`company_id`) USING BTREE,
INDEX `project_index`(`project_id`) USING BTREE,
INDEX `income_statements_index`(`income_statements_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '损益表详细收入金额' ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for t_money_flow
-- ----------------------------
DROP TABLE IF EXISTS `t_money_flow`;
CREATE TABLE `t_money_flow` (
`id` bigint(20) NOT NULL,
`company_id` bigint(20) NULL DEFAULT 0 COMMENT '项目id',
`project_id` bigint(20) NULL DEFAULT 0 COMMENT '项目id',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '变动的事宜',
`money_type` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '现金流变动类型 0收入 1支出',
`created_at` timestamp NOT NULL DEFAULT current_timestamp,
`updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
`rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `company_index`(`company_id`) USING BTREE,
INDEX `project_index`(`project_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '现金流变动表' ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for t_money_flow_log
-- ----------------------------
DROP TABLE IF EXISTS `t_money_flow_log`;
CREATE TABLE `t_money_flow_log` (
`id` bigint(20) NOT NULL,
`company_id` bigint(20) NULL DEFAULT 0 COMMENT '项目id',
`project_id` bigint(20) NULL DEFAULT 0 COMMENT '项目id',
`money_flow_id` bigint(20) NULL DEFAULT 0 COMMENT '变动事宜表id',
`year_income` int(11) NULL DEFAULT 0 COMMENT '',
`month_time` int(11) NULL DEFAULT 0 COMMENT '月份',
`predict_money` bigint(20) NULL DEFAULT 0 COMMENT '预计变动的金额',
`real_money` bigint(20) NULL DEFAULT 0 COMMENT '实际变动的金额',
`created_at` timestamp NOT NULL DEFAULT current_timestamp,
`updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
`rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `company_index`(`company_id`) USING BTREE,
INDEX `project_index`(`project_id`) USING BTREE,
INDEX `money_flow_index`(`money_flow_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '现金流变动详细金额表' ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for t_product
-- ----------------------------
DROP TABLE IF EXISTS `t_product`;
CREATE TABLE `t_product` (
`id` bigint(20) NOT NULL,
`company_id` bigint(20) NULL DEFAULT 0 COMMENT '公司id',
`project_id` bigint(20) NULL DEFAULT 0 COMMENT '项目id',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '产品名',
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注/产品详情',
`product_type_id` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '产品分类( 0战略业务 1增值业务)',
`pricing` bigint(20) NULL DEFAULT 0 COMMENT '定价',
`price_units` bigint(20) NULL DEFAULT 0 COMMENT '价格单位(元)',
`gross_margin` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '毛利(%)',
`significance_sort` tinyint(2) UNSIGNED NULL DEFAULT 0 COMMENT '重要性排序,数字越大越重要',
`created_at` timestamp NOT NULL DEFAULT current_timestamp,
`updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
`rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `company_index`(`company_id`) USING BTREE,
INDEX `project_index`(`project_id`) USING BTREE,
INDEX `product_type_index`(`product_type_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '产品或服务表' ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for t_product_income
-- ----------------------------
DROP TABLE IF EXISTS `t_product_income`;
CREATE TABLE `t_product_income` (
`id` bigint(20) NOT NULL,
`product_id` bigint(20) NULL DEFAULT 0 COMMENT '产品id',
`year_income` int(11) NULL DEFAULT 0 COMMENT '哪一年 例:2020',
`month_time` int(11) NULL DEFAULT 0 COMMENT '月份,一月,二月,三月。。。等',
`predict_income` bigint(20) NULL DEFAULT 0 COMMENT '预计收入',
`real_income` bigint(20) NULL DEFAULT 0 COMMENT '实际收入',
`created_at` timestamp NOT NULL DEFAULT current_timestamp,
`updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
`rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `product_index`(`product_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '产品收入表' ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for t_product_type
-- ----------------------------
DROP TABLE IF EXISTS `t_product_type`;
CREATE TABLE `t_product_type` (
`id` bigint(20) NOT NULL,
`company_id` bigint(20) NULL DEFAULT 0 COMMENT '公司id',
`project_id` bigint(20) NULL DEFAULT 0 COMMENT '项目id',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '分类名称',
`created_at` timestamp NOT NULL DEFAULT current_timestamp,
`updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
`rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `company_index`(`company_id`) USING BTREE,
INDEX `project_index`(`project_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '公司信息表' ROW_FORMAT = Compact;
SET FOREIGN_KEY_CHECKS = 1;