Initial Commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package com.example.springdemo.controller;
|
||||
|
||||
import com.example.springdemo.entities.Business;
|
||||
import com.example.springdemo.config.DataBaseProperties;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/student")
|
||||
public class StudentController {
|
||||
|
||||
@Resource
|
||||
DataBaseProperties dbProps;
|
||||
|
||||
@GetMapping("/get")
|
||||
public List<String> getStudent() {
|
||||
// DataBaseProperties dbProps = new DataBaseProperties();
|
||||
return List.of(dbProps.getUsername(), dbProps.getPassword(), dbProps.getDbUrl());
|
||||
}
|
||||
|
||||
@GetMapping("/getBy")
|
||||
public Business getStudentById(@RequestParam String id) {
|
||||
|
||||
var bs = Business.builder()
|
||||
.name(id)
|
||||
.tel(dbProps.getPassword())
|
||||
.build();
|
||||
|
||||
if (!Objects.equals(bs.getTel(), "")) {
|
||||
bs.setTel("");
|
||||
}
|
||||
|
||||
return bs;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user