/*
 Navicat Premium Data Transfer

 Source Server         : localhost_3306
 Source Server Type    : MySQL
 Source Server Version : 80023 (8.0.23)
 Source Host           : localhost:3306
 Source Schema         : rfid_db

 Target Server Type    : MySQL
 Target Server Version : 80023 (8.0.23)
 File Encoding         : 65001

 Date: 11/01/2024 17:57:15
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for tb_asset_borrow_record
-- ----------------------------
DROP TABLE IF EXISTS `tb_asset_borrow_record`;
CREATE TABLE `tb_asset_borrow_record`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
  `asset_id` bigint NOT NULL COMMENT '借出资产ID',
  `user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '借出人用户名',
  `borrow_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '借出时间',
  `borrow_location_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '借出位置编码',
  `expected_return_time` timestamp NOT NULL COMMENT '预计归还时间',
  `is_return` int NOT NULL DEFAULT 0 COMMENT '是否归还，0：否，1：是',
  `return_time` timestamp NULL DEFAULT NULL COMMENT '归还时间',
  `return_location_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '归还位置编码',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `asset_id`(`asset_id` ASC) USING BTREE,
  INDEX `borrow_location_number`(`borrow_location_number` ASC) USING BTREE,
  INDEX `return_location_number`(`return_location_number` ASC) USING BTREE,
  CONSTRAINT `tb_asset_borrow_record_ibfk_1` FOREIGN KEY (`asset_id`) REFERENCES `tb_asset_information` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `tb_asset_borrow_record_ibfk_2` FOREIGN KEY (`borrow_location_number`) REFERENCES `tb_location` (`number`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `tb_asset_borrow_record_ibfk_3` FOREIGN KEY (`return_location_number`) REFERENCES `tb_location` (`number`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '资产借用记录表' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;
