diff --git a/src/InController.java b/src/InController.java new file mode 100644 index 0000000..71048f8 --- /dev/null +++ b/src/InController.java @@ -0,0 +1,32 @@ +package com.example.hosdata.controller; + +import com.example.hosdata.pojo.Information; +import com.example.hosdata.pojo.RegisterRecord; +import com.example.hosdata.service.DocyzService; +import com.example.hosdata.service.InService; +import com.example.hosdata.service.RegisterService; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.util.HtmlUtils; + +import java.util.List; + +@RestController +public class InController { + @Autowired + InService inService; + + @CrossOrigin + @GetMapping("/api/setting") + public List listuser() throws Exception { + return inService.listbyuser(); + } + + @CrossOrigin + @PostMapping("/api/setting") + public Information Update(@RequestBody Information information) throws Exception { + inService.update(information); + return information; + } +} diff --git a/src/InDAO.java b/src/InDAO.java new file mode 100644 index 0000000..a3207cd --- /dev/null +++ b/src/InDAO.java @@ -0,0 +1,12 @@ +package com.example.hosdata.dao; + +import com.example.hosdata.pojo.Information; +import com.example.hosdata.pojo.RegisterRecord; +import com.example.hosdata.pojo.User; +import org.springframework.data.domain.Page; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; +public interface InDAO extends JpaRepository{ + List findByUsername(String username); +} diff --git a/src/InService.java b/src/InService.java new file mode 100644 index 0000000..33bf04b --- /dev/null +++ b/src/InService.java @@ -0,0 +1,26 @@ +package com.example.hosdata.service; + +import com.example.hosdata.dao.InDAO; +import com.example.hosdata.dao.RegisterDAO; +import com.example.hosdata.pojo.Information; +import com.example.hosdata.pojo.RegisterRecord; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class InService { + @Autowired + InDAO inDAO; + static public String userna; + + public List listbyuser() { + return inDAO.findByUsername(userna); + } + + public void update(Information information) { + inDAO.save(information); + } +} diff --git a/src/Information.java b/src/Information.java new file mode 100644 index 0000000..968ccb6 --- /dev/null +++ b/src/Information.java @@ -0,0 +1,52 @@ +package com.example.hosdata.pojo; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import javax.persistence.*; + +@Entity +@Table(name = "user") +@JsonIgnoreProperties({"handler","hibernateLazyInitializer"}) + +public class Information { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + String id; + + String username; + String password; + + String realname; + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getRealname() { + return realname; + } + + public void setRealname(String realname) { + this.realname = realname; + } +} diff --git a/src/set/setIndex.vue b/src/set/setIndex.vue new file mode 100644 index 0000000..9f81bca --- /dev/null +++ b/src/set/setIndex.vue @@ -0,0 +1,180 @@ + + + + +