-- 房屋租赁主表 DROP TABLE IF EXISTS `house_lease`; CREATE TABLE `house_lease` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', `office` varchar(100) NOT NULL COMMENT '办事处', `user_name` varchar(100) NOT NULL COMMENT '使用人', `resident_staff` varchar(100) NOT NULL COMMENT '驻省人员', `address` varchar(255) NOT NULL COMMENT '地址', `rent_start_date` date NOT NULL COMMENT '起租时间', `contract_start_date` date NOT NULL COMMENT '合同起租日', `contract_end_date` date NOT NULL COMMENT '合同到期日', `tenant` varchar(100) NOT NULL COMMENT '承租人', `party_a` varchar(100) NOT NULL COMMENT '合同甲方', `phone` varchar(20) DEFAULT NULL COMMENT '电话', `area` decimal(18,2) DEFAULT NULL COMMENT '面积', `payment_method` varchar(50) NOT NULL COMMENT '支付方式', `deposit` decimal(18,2) DEFAULT NULL COMMENT '押金', `rent` decimal(18,2) NOT NULL COMMENT '租金(元/月)', `create_user` int DEFAULT NULL COMMENT '创建者', `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', `update_user` int DEFAULT NULL COMMENT '更新者', `update_time` timestamp NULL DEFAULT NULL COMMENT '更新时间', `tenant_id` int DEFAULT NULL COMMENT '租户ID', `dept_id` bigint DEFAULT NULL COMMENT '部门ID', `remark` varchar(500) DEFAULT NULL COMMENT '备注', `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='房屋租赁管理主表'; -- 房屋租赁费用子表 DROP TABLE IF EXISTS `house_lease_cost`; CREATE TABLE `house_lease_cost` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', `lease_id` bigint(20) NOT NULL COMMENT '租赁表ID', `month` varchar(7) NOT NULL COMMENT '月份 (YYYY-MM)', `rent` decimal(18,2) DEFAULT '0.00' COMMENT '房租', `water_electricity` decimal(18,2) DEFAULT '0.00' COMMENT '水电', `property` decimal(18,2) DEFAULT '0.00' COMMENT '物业', `express` decimal(18,2) DEFAULT '0.00' COMMENT '快递', `broadband` decimal(18,2) DEFAULT '0.00' COMMENT '宽带', `create_user` int DEFAULT NULL COMMENT '创建者', `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', `update_user` int DEFAULT NULL COMMENT '更新者', `update_time` timestamp NULL DEFAULT NULL COMMENT '更新时间', `tenant_id` int DEFAULT NULL COMMENT '租户ID', `dept_id` bigint DEFAULT NULL COMMENT '部门ID', `remark` varchar(500) DEFAULT NULL COMMENT '备注', `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)', PRIMARY KEY (`id`), UNIQUE KEY `idx_lease_month` (`lease_id`, `month`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='房屋租赁管理费用子表';