就业项目

  1. 1. Controller分析
  2. 2. 建议文本未形成对应回答,均为静态

Controller分析

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
@Controller
@RequestMapping("/evaluation")
public class HelloContraller {

@Autowired
private LocationRepository locationRepository;

@Autowired
private EvaluationService evaluationService;

@ResponseBody
@RequestMapping("/title")
public List<Title> title(){
// List<Title> titles=locationRepository.findAll();
List<Title> titles=evaluationService.getLocationsByName();
return titles;
}

// @ResponseBody
// @RequestMapping(value="/calculate/{answer}", produces = "appliaction/json;charset=utf-8")
// public String[] calculate(@PathVariable(value = "answer") final String answer){
// String[] calculateResult = evaluationService.calculateResult(answer);
// System.out.println(answer);
// return calculateResult;
// }
//
// @RequestMapping(value="/calculate", produces = "appliaction/json;charset=utf-8")
// public ResponseEntity<String[]> calculate(@RequestBody final String answer){
// String[] calculateResult = evaluationService.calculateResult(answer);
// System.out.println(answer);
// return new ResponseEntity(calculateResult, HttpStatus.OK);
// }

@ResponseBody
@RequestMapping(value="/calculate")
public List calculate(@RequestBody final String answer){
List calculateResult = evaluationService.calculateResult(answer);
System.out.println(answer);
return calculateResult;
}

}

建议文本未形成对应回答,均为静态