You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.6 KiB
58 lines
1.6 KiB
package com.example.demo.controller;
|
|
|
|
import com.example.demo.domain.work.One;
|
|
import com.example.demo.domain.work.Three;
|
|
import com.example.demo.domain.work.Two;
|
|
import com.example.demo.sevice.OneService;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.List;
|
|
|
|
@RestController
|
|
@RequestMapping("/One")
|
|
@RequiredArgsConstructor
|
|
@Slf4j
|
|
@CrossOrigin
|
|
public class OneController {
|
|
private final OneService oneService;
|
|
|
|
// 定义一个DTO类来封装请求参数
|
|
public static class RequestParams {
|
|
private String token;
|
|
private List<String> areas;
|
|
|
|
// Getter和Setter方法
|
|
public String getToken() {
|
|
return token;
|
|
}
|
|
|
|
public void setToken(String token) {
|
|
this.token = token;
|
|
}
|
|
|
|
public List<String> getAreas() {
|
|
return areas;
|
|
}
|
|
|
|
public void setAreas(List<String> areas) {
|
|
this.areas = areas;
|
|
}
|
|
}
|
|
|
|
@PostMapping("/getOne")
|
|
public One getOne(@RequestBody RequestParams requestParams) throws Exception {
|
|
return oneService.getOne(requestParams.getToken(), requestParams.getAreas());
|
|
}
|
|
|
|
@PostMapping("/getTwo")
|
|
public Two getTwo(@RequestBody RequestParams requestParams) throws Exception {
|
|
return oneService.getTwo(requestParams.getToken(), requestParams.getAreas());
|
|
}
|
|
|
|
@PostMapping("/getThree")
|
|
public Three getThree(@RequestBody RequestParams requestParams) throws Exception {
|
|
return oneService.getThree(requestParams.getToken(), requestParams.getAreas());
|
|
}
|
|
}
|