SubjectController.java
1.6 KB
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
43
44
45
46
47
48
49
50
51
52
53
package com.bsth.controller.subject;
import com.bsth.controller.BaseController;
import com.bsth.entity.subject.Subject;
import com.bsth.service.subject.SubjectService;
import com.bsth.service.subject.SubjectUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("subject")
public class SubjectController extends BaseController<Subject, Integer> {
private static final Logger LOGGER = LoggerFactory.getLogger(SubjectController.class);
@Autowired
SubjectService subjectService;
@Autowired
SubjectUserService subjectUserService;
@RequestMapping("/subjectList")
public List<Subject> subjectList(){
List<Subject> r=subjectService.subjectAll();
return r;
}
@RequestMapping("/selectSubject")
public Map<String,String> selectSubject(@RequestParam() Map<String, Object> map){
Map<String,String> result=new HashMap<>();
try {
String[] arr=map.get("ids").toString().split(",");
subjectUserService.selectSubject(arr);
result.put("result","成功");
return result;
} catch (Exception e) {
LOGGER.error("",e);
// TODO: handle exception
result.put("result","失败");
return result;
}
}
}