diff --git a/cmkg/pom.xml b/cmkg/pom.xml
index f9f4e81..3c172c7 100644
--- a/cmkg/pom.xml
+++ b/cmkg/pom.xml
@@ -53,6 +53,27 @@
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ mysql
+ mysql-connector-java
+ runtime
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+
+ com.h2database
+ h2
+ runtime
+
org.apache.spark
diff --git a/cmkg/src/main/java/com/cmkg/cmkg/Controller/LoginRegisterController.java b/cmkg/src/main/java/com/cmkg/cmkg/Controller/LoginRegisterController.java
index 0129941..8caa524 100644
--- a/cmkg/src/main/java/com/cmkg/cmkg/Controller/LoginRegisterController.java
+++ b/cmkg/src/main/java/com/cmkg/cmkg/Controller/LoginRegisterController.java
@@ -1,22 +1,56 @@
-// package com.cmkg.cmkg.Controller;
+package com.cmkg.cmkg.Controller;
-// import com.cmkg.cmkg.database.ReturnData;
-// import org.springframework.data.repository.query.Param;
-// import org.springframework.web.bind.annotation.RequestMapping;
-// import org.springframework.web.bind.annotation.RequestParam;
+import com.cmkg.cmkg.database.user;
+import com.cmkg.cmkg.repository.Login_Register_Repository;
+import com.cmkg.cmkg.server.ReturnData;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
-// @RequestMapping("/request")
-// public class LoginRegisterController {
+@RestController
+@RequestMapping("/request")
+public class LoginRegisterController {
-// @RequestMapping("/login")
-// public ReturnData LoginGet(@RequestParam("phonenumber") String phonenumber, @RequestParam("password") String password){
+ @Autowired
+ Login_Register_Repository login_register_repository;
-// }
+ @RequestMapping("/login")
+ public ReturnData LoginGet(@RequestParam("phonenumber") String phonenumber, @RequestParam("password") String password){
+ ReturnData returnData=new ReturnData();
+ user user=login_register_repository.findById(phonenumber).orElse(null);
+ if(user==null){
+ returnData.setMsg("该用户不存在");
+ }
+ else{
+ if(user.getPassword().equals(password)){
+ returnData.setMsg("登录成功");
+ returnData.setData(user.getUsername());
+ }else{
+ returnData.setData("密码错误,登陆失败");
+ }
+ }
+ return returnData;
-// @RequestMapping("/register")
-// public ReturnData RegisterGet(@RequestParam("phonenumber") String phonenumber, @RequestParam("username") String username,@RequestParam("password") String password,
-// @RequestParam("region") String region, @RequestParam("age") Long age){
+ }
-// }
-// }
+ @RequestMapping("/register")
+ public ReturnData RegisterGet(@RequestParam("phonenumber") String phonenumber, @RequestParam("username") String username,@RequestParam("password") String password,
+ @RequestParam("region") String region, @RequestParam("age") Integer age,@RequestParam("sex") Integer sex){
+ ReturnData returnData=new ReturnData();
+ user user=login_register_repository.findById(phonenumber).orElse(null);
+ if(user==null) {
+ login_register_repository.save(new user(phonenumber, username, password, age, sex, region));
+ returnData.setCode(200);
+ returnData.setMsg("注册成功");
+ returnData.setData(null);
+ }else{
+ returnData.setCode(404);
+ returnData.setMsg("注册失败");
+ returnData.setData(null);
+ }
+
+ return returnData;
+ }
+}