GorbachevAV/Gorbachev.sql

388 lines
15 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- MySQL dump 10.13 Distrib 8.0.36, for Win64 (x86_64)
--
-- Host: 80.90.179.235 Database: pozorisp_GorbzchevAV
-- ------------------------------------------------------
-- Server version 8.0.42
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `Clients`
--
DROP TABLE IF EXISTS `Clients`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Clients` (
`idClients` int NOT NULL AUTO_INCREMENT,
`Client_Name` varchar(45) NOT NULL,
`idid` int NOT NULL,
PRIMARY KEY (`idClients`,`idid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Clients`
--
LOCK TABLES `Clients` WRITE;
/*!40000 ALTER TABLE `Clients` DISABLE KEYS */;
INSERT INTO `Clients` VALUES (1,'Иванов И.И.',0),(2,'Петрова А.А.',0),(3,'Сидоров С.С.',0),(4,'Смирнова О.О.',0);
/*!40000 ALTER TABLE `Clients` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Employees`
--
DROP TABLE IF EXISTS `Employees`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Employees` (
`idEmployees` int NOT NULL AUTO_INCREMENT,
`employeeWorkPlace` int NOT NULL,
`rate` decimal(10,2) NOT NULL,
`isFindPartners` tinyint NOT NULL,
`birthDay` date NOT NULL,
`isMedCard` tinyint NOT NULL,
`isAccessEquip` tinyint NOT NULL,
`task` varchar(50) NOT NULL,
`name` varchar(45) NOT NULL,
`userId` int NOT NULL,
`Idishka` int NOT NULL,
`idUser` int NOT NULL,
PRIMARY KEY (`idEmployees`),
KEY `employeeWP_FK_idx` (`employeeWorkPlace`),
KEY `user_fk_idx` (`idUser`),
KEY `user_fk_Idishka` (`Idishka`),
KEY `employeeUs_FK` (`userId`),
CONSTRAINT `employeeWP_FK` FOREIGN KEY (`employeeWorkPlace`) REFERENCES `WorkPlace` (`idWorkPlace`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Employees`
--
LOCK TABLES `Employees` WRITE;
/*!40000 ALTER TABLE `Employees` DISABLE KEYS */;
INSERT INTO `Employees` VALUES (1,1,4.50,1,'1985-01-01',1,1,'Ремонт автомобиля','Иванов И.И.',0,0,0),(2,2,4.70,0,'1990-03-15',1,0,'Ожидает распределения','Петрова А.А.',0,0,0),(3,1,4.20,1,'1980-07-10',1,1,'Диагностика автомобиля','Сидоров С.С.',0,0,0),(4,2,4.60,1,'1986-11-22',1,0,'Ремонт двигателя','Смирнова О.О.',0,0,0),(5,3,4.00,0,'1992-09-05',1,1,'Управление складом','Козлов В.В.',0,0,0);
/*!40000 ALTER TABLE `Employees` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Materials`
--
DROP TABLE IF EXISTS `Materials`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Materials` (
`idMaterials` int NOT NULL AUTO_INCREMENT,
`MaterialsName` varchar(45) NOT NULL,
PRIMARY KEY (`idMaterials`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Materials`
--
LOCK TABLES `Materials` WRITE;
/*!40000 ALTER TABLE `Materials` DISABLE KEYS */;
INSERT INTO `Materials` VALUES (1,'Тормозные колодки'),(2,'Масло маторное'),(3,'Фильтр воздушный'),(4,'Свечи зажигания');
/*!40000 ALTER TABLE `Materials` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Measure`
--
DROP TABLE IF EXISTS `Measure`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Measure` (
`idMeasure` int NOT NULL AUTO_INCREMENT,
`MeasureName` varchar(45) NOT NULL,
PRIMARY KEY (`idMeasure`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Measure`
--
LOCK TABLES `Measure` WRITE;
/*!40000 ALTER TABLE `Measure` DISABLE KEYS */;
INSERT INTO `Measure` VALUES (1,'Шт.'),(2,'Литр');
/*!40000 ALTER TABLE `Measure` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Package`
--
DROP TABLE IF EXISTS `Package`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Package` (
`idPackage` int NOT NULL AUTO_INCREMENT,
`PackageName` varchar(45) NOT NULL,
PRIMARY KEY (`idPackage`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Package`
--
LOCK TABLES `Package` WRITE;
/*!40000 ALTER TABLE `Package` DISABLE KEYS */;
INSERT INTO `Package` VALUES (1,'Пачка'),(2,'Бочка');
/*!40000 ALTER TABLE `Package` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Request`
--
DROP TABLE IF EXISTS `Request`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Request` (
`idRequest` int NOT NULL AUTO_INCREMENT,
`client` int NOT NULL,
`isOffered` tinyint NOT NULL,
`price` int NOT NULL,
`deadline` int NOT NULL,
`idStatus` int NOT NULL,
`timeIn` varchar(45) NOT NULL,
`timeOut` varchar(45) NOT NULL,
`WorkHours` int NOT NULL,
`idMaterials` int NOT NULL,
`idType` int NOT NULL,
`idPartner` int NOT NULL,
`idPackage` int NOT NULL,
`idMeasure` int NOT NULL,
`MaterialPrice` int NOT NULL,
`materialOnWarehouseAmount` int NOT NULL,
`minMaterialAmount` int NOT NULL,
`historyOfChange` date NOT NULL,
`idUsers` varchar(45) NOT NULL,
PRIMARY KEY (`idRequest`),
KEY `Cl_FK_ID_idx` (`client`),
KEY `Ma_Fk_id_idx` (`idMaterials`),
KEY `Meas_Fk_id_idx` (`idMeasure`),
KEY `Pack_Fk_id_idx` (`idPackage`),
KEY `Partn_Fk_id_idx` (`idPartner`),
KEY `St_Fk_Id_idx` (`idStatus`),
KEY `Type_Fk_id_idx` (`idType`),
CONSTRAINT `Cl_FK_ID` FOREIGN KEY (`client`) REFERENCES `Clients` (`idClients`),
CONSTRAINT `Ma_Fk_id` FOREIGN KEY (`idMaterials`) REFERENCES `Warehouse` (`idWarehouse`),
CONSTRAINT `Meas_Fk_id` FOREIGN KEY (`idMeasure`) REFERENCES `Measure` (`idMeasure`),
CONSTRAINT `Pack_Fk_id` FOREIGN KEY (`idPackage`) REFERENCES `Package` (`idPackage`),
CONSTRAINT `Partn_Fk_id` FOREIGN KEY (`idPartner`) REFERENCES `partners` (`idpartners`),
CONSTRAINT `St_Fk_Id` FOREIGN KEY (`idStatus`) REFERENCES `Status` (`idStatus`),
CONSTRAINT `Type_Fk_id` FOREIGN KEY (`idType`) REFERENCES `Type` (`idType`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Request`
--
LOCK TABLES `Request` WRITE;
/*!40000 ALTER TABLE `Request` DISABLE KEYS */;
INSERT INTO `Request` VALUES (1,1,1,5000,3,1,'8:00','17:00',8,1,1,1,1,1,500,100,10,'2025-01-01',''),(2,2,1,3000,5,2,'9:00','18:00',8,2,2,3,2,2,700,150,20,'2025-01-02',''),(3,3,1,7000,7,1,'8:30','17:30',8,3,1,3,1,1,250,80,15,'2025-01-03',''),(4,4,1,4500,2,2,'8:00','17:00',8,4,1,1,1,1,300,120,10,'2025-01-04','');
/*!40000 ALTER TABLE `Request` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Status`
--
DROP TABLE IF EXISTS `Status`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Status` (
`idStatus` int NOT NULL AUTO_INCREMENT,
`StatusName` varchar(45) NOT NULL,
PRIMARY KEY (`idStatus`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Status`
--
LOCK TABLES `Status` WRITE;
/*!40000 ALTER TABLE `Status` DISABLE KEYS */;
INSERT INTO `Status` VALUES (1,'Завершена'),(2,'Ожидает');
/*!40000 ALTER TABLE `Status` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Type`
--
DROP TABLE IF EXISTS `Type`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Type` (
`idType` int NOT NULL AUTO_INCREMENT,
`TypeName` varchar(45) NOT NULL,
PRIMARY KEY (`idType`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Type`
--
LOCK TABLES `Type` WRITE;
/*!40000 ALTER TABLE `Type` DISABLE KEYS */;
INSERT INTO `Type` VALUES (1,'Запчасть'),(2,'Масло');
/*!40000 ALTER TABLE `Type` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Warehouse`
--
DROP TABLE IF EXISTS `Warehouse`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Warehouse` (
`idWarehouse` int NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
`description` varchar(45) NOT NULL,
`iamge` mediumblob,
`minPrice` int NOT NULL,
`timeCompleting` int NOT NULL,
`itselfPrice` int NOT NULL,
`boxNumbers` int NOT NULL,
`employeeId` int NOT NULL,
`Material` int NOT NULL,
`Arrived` int NOT NULL,
`Reserved` int NOT NULL,
`Used` int NOT NULL,
`ArrivedUsed` int NOT NULL,
`Warehouse` int NOT NULL,
`MaterialNumber` int NOT NULL,
PRIMARY KEY (`idWarehouse`),
KEY `Emp_Fk_id_idx` (`employeeId`),
KEY `Mat_Fk_id_idx` (`Material`),
CONSTRAINT `Emp_Fk_id` FOREIGN KEY (`employeeId`) REFERENCES `Employees` (`idEmployees`),
CONSTRAINT `Mat_Fk_id` FOREIGN KEY (`Material`) REFERENCES `Materials` (`idMaterials`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Warehouse`
--
LOCK TABLES `Warehouse` WRITE;
/*!40000 ALTER TABLE `Warehouse` DISABLE KEYS */;
INSERT INTO `Warehouse` VALUES (1,'Тормозные колодки','Для ремонта тормозной системы',_binary '?',500,30,300,1,1,1,100,50,20,50,80,1),(2,'Масло мотороне','Матороное масло для автомобилей',_binary '?',700,40,400,2,2,2,200,100,30,7,170,2),(3,'Фильтр воздушный','Воздушный фильтр для авто',_binary '?',250,20,150,3,3,3,150,50,30,50,120,3),(4,'Свечи зажигания','Свечи для автомобилей',_binary '?',300,25,180,4,4,4,120,60,20,40,100,4);
/*!40000 ALTER TABLE `Warehouse` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `WorkPlace`
--
DROP TABLE IF EXISTS `WorkPlace`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `WorkPlace` (
`idWorkPlace` int NOT NULL AUTO_INCREMENT,
`WorkPlaceName` varchar(45) NOT NULL,
PRIMARY KEY (`idWorkPlace`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `WorkPlace`
--
LOCK TABLES `WorkPlace` WRITE;
/*!40000 ALTER TABLE `WorkPlace` DISABLE KEYS */;
INSERT INTO `WorkPlace` VALUES (1,'Менеджер по партнёрам'),(2,'Менеджер по продажам'),(3,'Администратор');
/*!40000 ALTER TABLE `WorkPlace` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `partners`
--
DROP TABLE IF EXISTS `partners`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `partners` (
`idpartners` int NOT NULL AUTO_INCREMENT,
`idType` int NOT NULL,
`partnersName` varchar(45) NOT NULL,
`INN` varchar(45) NOT NULL,
`phone` varchar(45) NOT NULL,
`email` varchar(45) NOT NULL,
`rate` decimal(10,2) NOT NULL,
PRIMARY KEY (`idpartners`),
KEY `PartnersTypeFK_idx` (`idType`),
CONSTRAINT `PartnersTypeFK` FOREIGN KEY (`idType`) REFERENCES `typePartners` (`idtypePartners`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `partners`
--
LOCK TABLES `partners` WRITE;
/*!40000 ALTER TABLE `partners` DISABLE KEYS */;
INSERT INTO `partners` VALUES (1,1,'ООО \"Запчасти 24\"','1234567890','+7 (495) 123-45-67','parts24@exmaple.com',4.00),(2,2,'ООО \"Логистикс\"','987654321','+7 (495) 234-56-78','logistics@exmaple.com',6.00),(3,1,'ООО \"АвтоЗапчасти\"','1122334455','+7 (495) 678-90-12','partsauto@exmaple.com',9.00),(4,2,'ООО \"ТранспортГруз\"','5544332211','+7 (495) 987-65-43','translogistics@exmaple.com',2.00);
/*!40000 ALTER TABLE `partners` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `typePartners`
--
DROP TABLE IF EXISTS `typePartners`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `typePartners` (
`idtypePartners` int NOT NULL AUTO_INCREMENT,
`nameTP` varchar(45) NOT NULL,
PRIMARY KEY (`idtypePartners`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `typePartners`
--
LOCK TABLES `typePartners` WRITE;
/*!40000 ALTER TABLE `typePartners` DISABLE KEYS */;
INSERT INTO `typePartners` VALUES (1,'Магазин запчастей'),(2,'Логистика');
/*!40000 ALTER TABLE `typePartners` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2025-05-12 12:14:31