|
@@ -0,0 +1,146 @@
|
|
1
|
+package com.xhkjedu.sapi.controller.scantron;
|
|
2
|
+
|
|
3
|
+import com.github.pagehelper.PageHelper;
|
|
4
|
+import com.github.pagehelper.PageInfo;
|
|
5
|
+import com.xhkjedu.sapi.model.scantron.TScantron;
|
|
6
|
+import com.xhkjedu.sapi.service.scantron.ScantronService;
|
|
7
|
+import com.xhkjedu.sapi.service.system.UserService;
|
|
8
|
+import com.xhkjedu.utils.N_Utils;
|
|
9
|
+import com.xhkjedu.utils.PageUtil;
|
|
10
|
+import com.xhkjedu.vo.PageResult;
|
|
11
|
+import com.xhkjedu.vo.ResultVo;
|
|
12
|
+import com.xhkjedu.vo.system.UserVo;
|
|
13
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
14
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
15
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
16
|
+import org.springframework.web.bind.annotation.RestController;
|
|
17
|
+
|
|
18
|
+import javax.annotation.Resource;
|
|
19
|
+import java.util.List;
|
|
20
|
+import java.util.Map;
|
|
21
|
+
|
|
22
|
+/**
|
|
23
|
+ * @Description:答题卡
|
|
24
|
+ * @Author: WN
|
|
25
|
+ * @Date: 2024/10/25 10:15:46
|
|
26
|
+ **/
|
|
27
|
+@RestController
|
|
28
|
+@RequestMapping("/scantron")
|
|
29
|
+public class ScantronController {
|
|
30
|
+ @Resource
|
|
31
|
+ private ScantronService scantronService;
|
|
32
|
+ @Resource
|
|
33
|
+ private UserService userService;
|
|
34
|
+
|
|
35
|
+ /*
|
|
36
|
+ * @Description 答题卡列表-我的
|
|
37
|
+ * @Date 2024/10/25 10:23:08
|
|
38
|
+ * @Author WN
|
|
39
|
+ * @Param [scantron]
|
|
40
|
+ * @Return com.xhkjedu.vo.ResultVo
|
|
41
|
+ **/
|
|
42
|
+ @PostMapping("/list_my")
|
|
43
|
+ public ResultVo listMy(@RequestBody TScantron scantron){
|
|
44
|
+ Integer page = scantron.getPage();
|
|
45
|
+ Integer pageSize = scantron.getPageSize();
|
|
46
|
+ Integer createid = scantron.getCreateid();
|
|
47
|
+ Integer schoolid = scantron.getSchoolid();
|
|
48
|
+ N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1,createid,"用户id",1,schoolid,"学校id",1});
|
|
49
|
+ PageHelper.startPage(page, pageSize);
|
|
50
|
+ List<Map<String,Object>> list = scantronService.listScantrons(scantron);
|
|
51
|
+ PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
|
|
52
|
+ return new ResultVo(0,"查询成功",pageResult);
|
|
53
|
+ }
|
|
54
|
+
|
|
55
|
+ /*
|
|
56
|
+ * @Description 答题卡列表-全部
|
|
57
|
+ * @Date 2024/10/25 10:41:09
|
|
58
|
+ * @Author WN
|
|
59
|
+ * @Param [scantron]
|
|
60
|
+ * @Return com.xhkjedu.vo.ResultVo
|
|
61
|
+ **/
|
|
62
|
+ @PostMapping("/list")
|
|
63
|
+ public ResultVo list(@RequestBody TScantron scantron){
|
|
64
|
+ Integer page = scantron.getPage();
|
|
65
|
+ Integer pageSize = scantron.getPageSize();
|
|
66
|
+ Integer createid = scantron.getCreateid();
|
|
67
|
+ Integer schoolid = scantron.getSchoolid();
|
|
68
|
+ N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1,createid,"教师id",1,schoolid,"学校id",1});
|
|
69
|
+
|
|
70
|
+ //获取用户类型
|
|
71
|
+ UserVo userVo = userService.getUserTypeAndSubjectid(createid);
|
|
72
|
+ if(userVo.getUsertype() == 1){
|
|
73
|
+ //设置教师科目
|
|
74
|
+ scantron.setSubjectid(userVo.getSubjectid());
|
|
75
|
+ }
|
|
76
|
+ if(userVo.getUsertype() == 0){
|
|
77
|
+ //管理员看到学校所有
|
|
78
|
+ scantron.setCreateid(null);
|
|
79
|
+ }
|
|
80
|
+ scantron.setPubliched(1);//全部查看公开的
|
|
81
|
+
|
|
82
|
+ PageHelper.startPage(page, pageSize);
|
|
83
|
+ List<Map<String,Object>> list = scantronService.listScantrons(scantron);
|
|
84
|
+ PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
|
|
85
|
+ return new ResultVo(0,"查询成功",pageResult);
|
|
86
|
+ }
|
|
87
|
+
|
|
88
|
+ //答题卡-新增
|
|
89
|
+ @PostMapping("/add")
|
|
90
|
+ public ResultVo add(@RequestBody TScantron scantron){
|
|
91
|
+ N_Utils.validation(new Object[]{scantron.getCreateid(),"创建人id",1,scantron.getSchoolid(),"学校id",1,
|
|
92
|
+ scantron.getSubjectid(),"科目id",1,scantron.getSname(),"答题卡名称",2});
|
|
93
|
+ scantronService.save(scantron);
|
|
94
|
+ return new ResultVo(0,"保存成功");
|
|
95
|
+ }
|
|
96
|
+
|
|
97
|
+ //答题卡-修改
|
|
98
|
+ @PostMapping("/update")
|
|
99
|
+ public ResultVo update(@RequestBody TScantron scantron){
|
|
100
|
+ N_Utils.validation(new Object[]{scantron.getSid(),"答题卡id",1});
|
|
101
|
+ scantronService.update(scantron);
|
|
102
|
+ return new ResultVo(0,"保存成功");
|
|
103
|
+ }
|
|
104
|
+
|
|
105
|
+ //答题卡-删除
|
|
106
|
+ @PostMapping("/delete")
|
|
107
|
+ public ResultVo delete(@RequestBody TScantron scantron){
|
|
108
|
+ N_Utils.validation(new Object[]{scantron.getSid(),"答题卡id",1});
|
|
109
|
+ scantronService.delete(scantron.getSid());
|
|
110
|
+ return new ResultVo(0,"删除成功");
|
|
111
|
+ }
|
|
112
|
+ //答题卡-详情
|
|
113
|
+ @PostMapping("/detail")
|
|
114
|
+ public ResultVo detail(@RequestBody TScantron scantron){
|
|
115
|
+ N_Utils.validation(new Object[]{scantron.getSid(),"答题卡id",1});
|
|
116
|
+ TScantron st = scantronService.detail(scantron.getSid());
|
|
117
|
+ return new ResultVo(0,"获取成功",st);
|
|
118
|
+ }
|
|
119
|
+
|
|
120
|
+ //答题卡-公开
|
|
121
|
+ @PostMapping("/pub")
|
|
122
|
+ public ResultVo updatePubliched(@RequestBody TScantron scantron){
|
|
123
|
+ N_Utils.validation(new Object[]{scantron.getSid(),"答题卡id",1});
|
|
124
|
+ scantronService.updateScantronPubliched(scantron.getSid(),1);
|
|
125
|
+ return new ResultVo(0,"设置成功");
|
|
126
|
+ }
|
|
127
|
+ //答题卡-取消公开
|
|
128
|
+ @PostMapping("/unpub")
|
|
129
|
+ public ResultVo updateUnPubliched(@RequestBody TScantron scantron){
|
|
130
|
+ N_Utils.validation(new Object[]{scantron.getSid(),"答题卡id",1});
|
|
131
|
+ scantronService.updateScantronPubliched(scantron.getSid(),2);
|
|
132
|
+ return new ResultVo(0,"设置成功");
|
|
133
|
+ }
|
|
134
|
+
|
|
135
|
+ //答题卡-复用
|
|
136
|
+ @PostMapping("/copy")
|
|
137
|
+ public ResultVo copyScantron(@RequestBody TScantron scantron){
|
|
138
|
+ N_Utils.validation(new Object[]{scantron.getSid(),"答题卡id",1,scantron.getCreateid(),"创建人id",1});
|
|
139
|
+ TScantron st = scantronService.copyScantron(scantron);
|
|
140
|
+ return new ResultVo(0,"复用成功",st);
|
|
141
|
+ }
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+}
|