parent
6de2519511
commit
a405175df3
@ -0,0 +1,37 @@
|
|||||||
|
package com.cmkg.cmkg.Controller;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/modify")
|
||||||
|
public class ModifyController {
|
||||||
|
@Autowired
|
||||||
|
Login_Register_Repository login_register_repository;
|
||||||
|
@RequestMapping("/mutimodify")
|
||||||
|
public ReturnData mutimodify(@RequestParam ("phonenumber") String phonenumber,@RequestParam("username") String username,@RequestParam("sex") Integer sex,@RequestParam("age") Integer age, @RequestParam("region") String region){
|
||||||
|
ReturnData returnData=new ReturnData();
|
||||||
|
user user=login_register_repository.findById(phonenumber).orElse(null);
|
||||||
|
user.setUsername(username);
|
||||||
|
user.setAge(age);
|
||||||
|
user.setSex(sex);
|
||||||
|
user.setRegion(region);
|
||||||
|
user.setPhonenumber(phonenumber);
|
||||||
|
login_register_repository.save(user);
|
||||||
|
return returnData;
|
||||||
|
}
|
||||||
|
@RequestMapping("/passwordmodify")
|
||||||
|
public ReturnData passwordmodify(@RequestParam("phonenumber") String phonenumber,@RequestParam("password") String password){
|
||||||
|
ReturnData returnData=new ReturnData();
|
||||||
|
user user=login_register_repository.findById(phonenumber).orElse(null);
|
||||||
|
user.setPassword(password);
|
||||||
|
login_register_repository.save(user);
|
||||||
|
return returnData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in new issue