登录注册(成功版)

Change-Id: I340bc8047774dd5ded63865812c44e33bbb734a5
diff --git a/data.sql b/data.sql
new file mode 100644
index 0000000..dadf755
--- /dev/null
+++ b/data.sql
@@ -0,0 +1,199 @@
+-- MySQL dump 10.13  Distrib 8.0.36, for Win64 (x86_64)
+--
+-- Host: 127.0.0.1    Database: ptpdata
+-- ------------------------------------------------------
+-- Server version	8.0.36
+
+/*!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 utf8mb4 */;
+/*!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 `assement`
+--
+
+DROP TABLE IF EXISTS `assement`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `assement` (
+  `ID` int NOT NULL AUTO_INCREMENT,
+  `username` varchar(255) DEFAULT NULL,
+  `assementLevel` int DEFAULT NULL,
+  `startDate` date DEFAULT NULL,
+  `uploadNow` int DEFAULT NULL,
+  `downloadNow` int DEFAULT NULL,
+  `magicPointNow` int DEFAULT NULL,
+  PRIMARY KEY (`ID`),
+  KEY `username` (`username`),
+  KEY `assementLevel` (`assementLevel`),
+  CONSTRAINT `assement_ibfk_1` FOREIGN KEY (`username`) REFERENCES `user` (`username`),
+  CONSTRAINT `assement_ibfk_2` FOREIGN KEY (`assementLevel`) REFERENCES `assement_standerd` (`levelStanderd`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `assement`
+--
+
+LOCK TABLES `assement` WRITE;
+/*!40000 ALTER TABLE `assement` DISABLE KEYS */;
+/*!40000 ALTER TABLE `assement` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `assement_standerd`
+--
+
+DROP TABLE IF EXISTS `assement_standerd`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `assement_standerd` (
+  `levelStanderd` int NOT NULL,
+  `registTime` int DEFAULT NULL,
+  `uploadDemand` int DEFAULT NULL,
+  `downloadDemand` int DEFAULT NULL,
+  `magicPointDemand` int DEFAULT NULL,
+  PRIMARY KEY (`levelStanderd`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `assement_standerd`
+--
+
+LOCK TABLES `assement_standerd` WRITE;
+/*!40000 ALTER TABLE `assement_standerd` DISABLE KEYS */;
+/*!40000 ALTER TABLE `assement_standerd` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `invite_code`
+--
+
+DROP TABLE IF EXISTS `invite_code`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `invite_code` (
+  `ID` int NOT NULL AUTO_INCREMENT,
+  `code` varchar(8) NOT NULL,
+  `generateUser` varchar(20) DEFAULT NULL,
+  `isUsed` tinyint(1) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`ID`),
+  KEY `generateUser` (`generateUser`),
+  CONSTRAINT `invite_code_ibfk_1` FOREIGN KEY (`generateUser`) REFERENCES `user` (`username`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `invite_code`
+--
+
+LOCK TABLES `invite_code` WRITE;
+/*!40000 ALTER TABLE `invite_code` DISABLE KEYS */;
+INSERT INTO `invite_code` (`ID`, `code`, `generateUser`, `isUsed`) VALUES (1,'123','test',1);
+/*!40000 ALTER TABLE `invite_code` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `resourse`
+--
+
+DROP TABLE IF EXISTS `resourse`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `resourse` (
+  `ID` int NOT NULL AUTO_INCREMENT,
+  `username` varchar(255) DEFAULT NULL,
+  `resourseName` varchar(255) DEFAULT NULL,
+  `info` text,
+  `upload_date` date DEFAULT NULL,
+  `file_size` int DEFAULT NULL,
+  `discount` enum('yes','no') DEFAULT NULL,
+  PRIMARY KEY (`ID`),
+  KEY `username` (`username`),
+  CONSTRAINT `resourse_ibfk_1` FOREIGN KEY (`username`) REFERENCES `user` (`username`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `resourse`
+--
+
+LOCK TABLES `resourse` WRITE;
+/*!40000 ALTER TABLE `resourse` DISABLE KEYS */;
+/*!40000 ALTER TABLE `resourse` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `testdata`
+--
+
+DROP TABLE IF EXISTS `testdata`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `testdata` (
+  `name` varchar(100) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `testdata`
+--
+
+LOCK TABLES `testdata` WRITE;
+/*!40000 ALTER TABLE `testdata` DISABLE KEYS */;
+INSERT INTO `testdata` (`name`) VALUES ('zzz'),('newtest'),('newtest2');
+/*!40000 ALTER TABLE `testdata` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `user`
+--
+
+DROP TABLE IF EXISTS `user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `user` (
+  `username` varchar(20) NOT NULL,
+  `password` varchar(200) NOT NULL,
+  `authority` enum('USER','ADMIN','LIMIT','BAN') NOT NULL DEFAULT 'USER',
+  `level` int DEFAULT '0',
+  `registTime` date NOT NULL,
+  `lastLogin` date DEFAULT NULL,
+  `upload` int DEFAULT '0',
+  `download` int DEFAULT '0',
+  `shareRate` int DEFAULT '100',
+  `magicPoints` int DEFAULT '0',
+  PRIMARY KEY (`username`),
+  CONSTRAINT `user_chk_1` CHECK ((`level` between 0 and 6)),
+  CONSTRAINT `user_chk_2` CHECK ((`shareRate` between 0 and 100))
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `user`
+--
+
+LOCK TABLES `user` WRITE;
+/*!40000 ALTER TABLE `user` DISABLE KEYS */;
+INSERT INTO `user` (`username`, `password`, `authority`, `level`, `registTime`, `lastLogin`, `upload`, `download`, `shareRate`, `magicPoints`) VALUES ('test','123456','USER',0,'2025-04-19',NULL,0,0,100,0),('ww','8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92','USER',0,'2025-04-20',NULL,0,0,100,0),('xxx','8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92','USER',0,'2025-04-20',NULL,0,0,100,0),('zzz','8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92','USER',0,'2025-04-20',NULL,0,0,100,0);
+/*!40000 ALTER TABLE `user` 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-04-20 21:30:15