Browse Source

作业、预习、背诵获取教师权限班级完善

作业设置批阅方式完善
tags/正式3.10.0
雍文秀 1 year ago
parent
commit
c64807a160
20 changed files with 102 additions and 75 deletions
  1. 2
    1
      sstudy/src/main/java/com/xhkjedu/sstudy/controller/paper/PaperAnalyzeController.java
  2. 2
    7
      sstudy/src/main/java/com/xhkjedu/sstudy/controller/paper/PaperController.java
  3. 1
    1
      sstudy/src/main/java/com/xhkjedu/sstudy/controller/paper/PaperTeaAppController.java
  4. 2
    2
      sstudy/src/main/java/com/xhkjedu/sstudy/controller/recite/ReciteController.java
  5. 5
    4
      sstudy/src/main/java/com/xhkjedu/sstudy/controller/resource/GuideController.java
  6. 1
    1
      sstudy/src/main/java/com/xhkjedu/sstudy/mapper/gradeclass/ClassMapper.java
  7. 3
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/mapper/recite/ReciteMapper.java
  8. 2
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/mapper/resource/GuideMapper.java
  9. 2
    2
      sstudy/src/main/java/com/xhkjedu/sstudy/service/gradeclass/ClassService.java
  10. 6
    2
      sstudy/src/main/java/com/xhkjedu/sstudy/service/paper/PaperService.java
  11. 3
    3
      sstudy/src/main/java/com/xhkjedu/sstudy/service/paper/PaperTeaAppService.java
  12. 5
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/service/recite/ReciteService.java
  13. 2
    2
      sstudy/src/main/java/com/xhkjedu/sstudy/service/recite/ReciteStudentService.java
  14. 1
    1
      sstudy/src/main/java/com/xhkjedu/sstudy/service/resource/GuideGroupService.java
  15. 5
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/service/resource/GuideService.java
  16. 2
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/vo/paper/AnalyzeSearchVo.java
  17. 3
    1
      sstudy/src/main/resources/mapper/gradeclass/ClassMapper.xml
  18. 2
    2
      sstudy/src/main/resources/mapper/paper/PaperMapper.xml
  19. 27
    24
      sstudy/src/main/resources/mapper/recite/ReciteMapper.xml
  20. 26
    22
      sstudy/src/main/resources/mapper/resource/GuideMapper.xml

+ 2
- 1
sstudy/src/main/java/com/xhkjedu/sstudy/controller/paper/PaperAnalyzeController.java View File

@@ -188,7 +188,8 @@ public class PaperAnalyzeController {
188 188
         Integer pageSize = paper.getPageSize();
189 189
         Integer teacherid = paper.getTeacherid();
190 190
         Integer gradeid = paper.getGradeid();
191
-        N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1,teacherid,"教师id",1,gradeid,"年级id",1});
191
+        N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1,teacherid,"教师id",1
192
+                ,gradeid,"年级id",1,paper.getCreateid(),"创建人id",1});
192 193
         //paperAnalyzeService.setYear(paper);
193 194
         paperAnalyzeService.setClassIds(paper);//设置教师权限班级
194 195
         PageHelper.startPage(page, pageSize);

+ 2
- 7
sstudy/src/main/java/com/xhkjedu/sstudy/controller/paper/PaperController.java View File

@@ -206,7 +206,7 @@ public class PaperController {
206 206
         Integer pageSize = paper.getPageSize();
207 207
         N_Utils.validation(new Object[]{lsbid,"教材关联关系id",2,createid,"教师id",1,page,"显示页码",1,pageSize,"显示条数",1});
208 208
         //获取当前教师权限班级
209
-        Map classMap = classService.getQxClassidsByTeacherid(createid);
209
+        Map classMap = classService.getQxClassidsByTeacherid(createid, null);
210 210
         String bxclassids = classMap.get("bxclassids").toString();//本校权限班级
211 211
         paper.setBxclassids(bxclassids);
212 212
         paper.setClassids(classMap.get("classids").toString());
@@ -220,12 +220,7 @@ public class PaperController {
220 220
     @PostMapping("/set_checktype")
221 221
     public ResultVo setCheckType(@RequestBody PaperParam param) {
222 222
         N_Utils.validation(new Object[]{param.getPaperid(),"试卷id",1,param.getChecktype(),"批改方式",1});
223
-        try {
224
-            paperService.setCheckType(param);
225
-        } catch (Exception e) {
226
-            return new ResultVo(1, "设置失败");
227
-        }
228
-        return new ResultVo(0,"设置成功");
223
+        return paperService.setCheckType(param);
229 224
     }
230 225
 
231 226
     @PostMapping("/check_students")

+ 1
- 1
sstudy/src/main/java/com/xhkjedu/sstudy/controller/paper/PaperTeaAppController.java View File

@@ -47,7 +47,7 @@ public class PaperTeaAppController {
47 47
         N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1
48 48
                 ,teacherid,"教师id",1,paperSearch.getSchoolid(),"学校id",1});
49 49
         //获取当前教师权限班级
50
-        Map classMap = paperTeaAppService.getQxClassidsByTeacherid(teacherid);
50
+        Map classMap = paperTeaAppService.getQxClassidsByTeacherid(teacherid, null);
51 51
         String bxclassids = classMap.get("bxclassids").toString();//本校权限班级
52 52
         paperSearch.setBxclassids(bxclassids);
53 53
         paperSearch.setClassids(classMap.get("classids").toString());

+ 2
- 2
sstudy/src/main/java/com/xhkjedu/sstudy/controller/recite/ReciteController.java View File

@@ -111,7 +111,7 @@ public class ReciteController {
111 111
         N_Utils.validation(new Object[]{
112 112
                 recite.getPage(), "显示页码", 1, recite.getPageSize(), "显示条数", 1,
113 113
                 recite.getCreateid(), "创建人", 1,recite.getSchoolid(),"学校id",1});
114
-        Map classmap = classService.getQxClassidsByTeacherid(recite.getCreateid());
114
+        Map classmap = classService.getQxClassidsByTeacherid(recite.getCreateid(), null);
115 115
         recite.setClassids(classmap.get("classids").toString());
116 116
         recite.setBxclassids(classmap.get("bxclassids").toString());
117 117
         PageHelper.startPage(recite.getPage(), recite.getPageSize());
@@ -125,7 +125,7 @@ public class ReciteController {
125 125
     public ResultVo listClass(@RequestBody TRecite recite) {
126 126
         Integer reciteid = recite.getReciteid();
127 127
         N_Utils.validation(new Object[]{reciteid, "背诵id", 1,recite.getCreateid(),"教师id",1,recite.getSchoolid(),"学校id",1});
128
-        Map classmap = classService.getQxClassidsByTeacherid(recite.getCreateid());
128
+        Map classmap = classService.getQxClassidsByTeacherid(recite.getCreateid(), reciteService.getYearById(reciteid));
129 129
         recite.setClassids(classmap.get("classids").toString());
130 130
         recite.setBxclassids(classmap.get("bxclassids").toString());
131 131
         Map list = reciteService.listClass(recite);

+ 5
- 4
sstudy/src/main/java/com/xhkjedu/sstudy/controller/resource/GuideController.java View File

@@ -47,7 +47,7 @@ public class GuideController {
47 47
         String subjectid = guide.getSubjectid();
48 48
         N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1,createid,"教师id",1
49 49
                 ,subjectid,"科目",2});
50
-        Map<String, String> map = classService.getQxClassidsByTeacherid(createid);
50
+        Map<String, String> map = classService.getQxClassidsByTeacherid(createid, null);
51 51
         guide.setClassids(map.get("classids"));
52 52
         guide.setBxclassids(map.get("bxclassids"));
53 53
         if (N_Utils.isEmpty(guide.getSchoolid())) {
@@ -67,7 +67,7 @@ public class GuideController {
67 67
         String subjectid = guide.getSubjectid();
68 68
         N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1,createid,"教师id",1
69 69
                 ,subjectid,"科目",2});
70
-        Map<String, String> map = classService.getQxClassidsByTeacherid(createid);
70
+        Map<String, String> map = classService.getQxClassidsByTeacherid(createid, null);
71 71
         guide.setClassids(map.get("classids"));
72 72
         guide.setBxclassids(map.get("bxclassids"));
73 73
         if (N_Utils.isEmpty(guide.getSchoolid())) {
@@ -88,7 +88,7 @@ public class GuideController {
88 88
         Integer guideid = guide.getGuideid();
89 89
         N_Utils.validation(new Object[]{guideid, "预习id", 1,guide.getCreateid(),"教师id",1
90 90
                 ,guide.getSchoolid(),"学校id",1});
91
-        Map<String, String> map = classService.getQxClassidsByTeacherid(guide.getCreateid());
91
+        Map<String, String> map = classService.getQxClassidsByTeacherid(guide.getCreateid(), guideService.getYearById(guideid));
92 92
         guide.setClassids(map.get("classids"));
93 93
         guide.setBxclassids(map.get("bxclassids"));
94 94
         Map list = guideService.listGuideClassByGuide(guide);
@@ -182,7 +182,8 @@ public class GuideController {
182 182
         Integer pageSize = paper.getPageSize();
183 183
         Integer teacherid = paper.getTeacherid();
184 184
         Integer gradeid = paper.getGradeid();
185
-        N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1,teacherid,"教师id",1,gradeid,"年级id",1});
185
+        N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1,teacherid,"教师id",1
186
+                ,gradeid,"年级id",1,paper.getCreateid(),"创建人id",1});
186 187
         //guideService.setYear(paper);
187 188
         guideService.setClassIds(paper);
188 189
         PageHelper.startPage(page, pageSize);

+ 1
- 1
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/gradeclass/ClassMapper.java View File

@@ -28,5 +28,5 @@ public interface ClassMapper extends TkMapper<TClass> {
28 28
     List<Map> listByClassIds(@Param("classids") List<Integer> classids,@Param("paperid") Integer paperid);
29 29
 
30 30
     //获取教师权限下班级包含伙伴学校-
31
-    List<Map> listQxClassByTeacherid(@Param("teacherid") Integer teacherid);
31
+    List<Map> listQxClassByTeacherid(@Param("teacherid") Integer teacherid,@Param("year") Integer year);
32 32
 }

+ 3
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/recite/ReciteMapper.java View File

@@ -44,4 +44,7 @@ public interface ReciteMapper extends TkMapper<TRecite> {
44 44
      * @Date 2022/6/21 10:36
45 45
      **/
46 46
     List<Map> listClass(@Param("recite") TRecite recite);
47
+
48
+    //获取背诵年份
49
+    Integer getYearById(@Param("reciteid") Integer reciteid);
47 50
 }

+ 2
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/resource/GuideMapper.java View File

@@ -68,4 +68,6 @@ public interface GuideMapper extends TkMapper<TGuide> {
68 68
     //预习关联班级
69 69
     List<Map> listGuideClassByGuide(@Param("guide") TGuide guide);
70 70
 
71
+    //获取预习年份
72
+    Integer getYearById(@Param("guideid") Integer guideid);
71 73
 }

+ 2
- 2
sstudy/src/main/java/com/xhkjedu/sstudy/service/gradeclass/ClassService.java View File

@@ -26,9 +26,9 @@ public class ClassService {
26 26
     * @Author WN
27 27
     * @Date 2023/4/12 14:31
28 28
     */
29
-    public Map getQxClassidsByTeacherid(Integer teacherid){
29
+    public Map getQxClassidsByTeacherid(Integer teacherid, Integer year){
30 30
         //获取教师权限下班级包含集团校
31
-        List<Map> classlist = classMapper.listQxClassByTeacherid(teacherid);
31
+        List<Map> classlist = classMapper.listQxClassByTeacherid(teacherid, year);
32 32
 
33 33
         //所有权限班级集合
34 34
         List<Integer> classidlist = classlist.stream().map(s -> Integer.parseInt(s.get("classid").toString())).collect(Collectors.toList());

+ 6
- 2
sstudy/src/main/java/com/xhkjedu/sstudy/service/paper/PaperService.java View File

@@ -16,6 +16,7 @@ import com.xhkjedu.sstudy.vo.paperstudent.PaperSearchVo;
16 16
 import com.xhkjedu.sstudy.vo.question.QuestionVo;
17 17
 import com.xhkjedu.sstudy.vo.subjectbook.PointVo;
18 18
 import com.xhkjedu.utils.N_Utils;
19
+import com.xhkjedu.vo.ResultVo;
19 20
 import lombok.extern.slf4j.Slf4j;
20 21
 import org.springframework.beans.factory.annotation.Autowired;
21 22
 import org.springframework.stereotype.Service;
@@ -1053,7 +1054,7 @@ public class PaperService {
1053 1054
      * @return void
1054 1055
      **/
1055 1056
     @Transactional(rollbackFor = Exception.class)
1056
-    public void setCheckType(PaperParam param) throws Exception {
1057
+    public ResultVo setCheckType(PaperParam param) {
1057 1058
         Integer checktype = param.getChecktype();//批改方式1教师批改2学生互改3指定学生批改
1058 1059
         Integer paperid = param.getPaperid();//试卷ID
1059 1060
 
@@ -1062,6 +1063,8 @@ public class PaperService {
1062 1063
             if (checktype == 1){//教师批阅
1063 1064
                 if (N_Utils.isEmptyInteger(param.getTeacherid())) {//不同班级分别指定教师
1064 1065
                     List<PaperCheckParam> checkParams = JSON.parseArray(param.getClassids(), PaperCheckParam.class);
1066
+                    long count = checkParams.stream().filter(c -> N_Utils.isEmptyInteger(c.getCheckid())).count();
1067
+                    if (count != 0) return new ResultVo(1, "有班级未指定批阅人");
1065 1068
                     paperStudentMapper.updateCheckId2(paperid, checkParams);
1066 1069
                 } else {//不同班级指定同一个教师
1067 1070
                     paperStudentMapper.updateCheckId(paperid,param.getTeacherid());//设置批改人
@@ -1113,8 +1116,9 @@ public class PaperService {
1113 1116
         } catch (Exception e) {
1114 1117
             log.error("设置批改方式失败:"+e.getMessage());
1115 1118
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
1116
-            throw new RuntimeException("设置批改方式失败");
1119
+            return new ResultVo(1, "设置失败");
1117 1120
         }
1121
+        return new ResultVo(0,"设置成功");
1118 1122
     }
1119 1123
 
1120 1124
     /**

+ 3
- 3
sstudy/src/main/java/com/xhkjedu/sstudy/service/paper/PaperTeaAppService.java View File

@@ -36,8 +36,8 @@ public class PaperTeaAppService {
36 36
     @Resource
37 37
     private ClassService classService;
38 38
 
39
-    public Map<String, String> getQxClassidsByTeacherid(Integer teacherid) {
40
-        return classService.getQxClassidsByTeacherid(teacherid);
39
+    public Map<String, String> getQxClassidsByTeacherid(Integer teacherid, Integer year) {
40
+        return classService.getQxClassidsByTeacherid(teacherid, year);
41 41
     }
42 42
 
43 43
     //获取作业列表
@@ -70,7 +70,7 @@ public class PaperTeaAppService {
70 70
         Map map = new HashMap();
71 71
         TPaper paper = paperMapper.selectByPrimaryKey(paperid);
72 72
         Integer hashb = paper.getHashb();
73
-        Map<String, String> cmap = getQxClassidsByTeacherid(checkid);
73
+        Map<String, String> cmap = getQxClassidsByTeacherid(checkid, paper.getYear());
74 74
         String classids;
75 75
         if (checkid.equals(paper.getCreateid())) {//自己发布的看所有班级
76 76
             classids = null;

+ 5
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/service/recite/ReciteService.java View File

@@ -259,4 +259,9 @@ public class ReciteService {
259 259
 
260 260
         return rtnMap;
261 261
     }
262
+
263
+    //获取背诵年份
264
+    public Integer getYearById(Integer reciteid){
265
+        return reciteMapper.getYearById(reciteid);
266
+    }
262 267
 }

+ 2
- 2
sstudy/src/main/java/com/xhkjedu/sstudy/service/recite/ReciteStudentService.java View File

@@ -87,9 +87,9 @@ public class ReciteStudentService {
87 87
         TRecite recite = null;
88 88
         if(N_Utils.isEmptyInteger(reciteStudent.getClassid())){
89 89
             //教师网页端获取所有
90
-            Map classidMap = classService.getQxClassidsByTeacherid(reciteStudent.getTeacherid());//教师权限班级
91
-            String classids = "";//教师本校和集团校权限班级
92 90
             recite = reciteMapper.selectByPrimaryKey(reciteStudent.getReciteid());
91
+            Map classidMap = classService.getQxClassidsByTeacherid(reciteStudent.getTeacherid(), recite.getYear());//教师权限班级
92
+            String classids = "";//教师本校和集团校权限班级
93 93
             if (reciteStudent.getTeacherid().equals(recite.getCreateid())) {//自己发布的看所有班级
94 94
                 classids = null;
95 95
             } else if(recite.getHashb() == 1 && recite.getSchoolid().equals(reciteStudent.getSchoolid())){

+ 1
- 1
sstudy/src/main/java/com/xhkjedu/sstudy/service/resource/GuideGroupService.java View File

@@ -48,7 +48,7 @@ public class GuideGroupService {
48 48
             TGuide tGuide = guideMapper.selectByPrimaryKey(guide.getGuideid());
49 49
             Integer hashb = tGuide.getHashb();
50 50
             Integer schoolid = tGuide.getSchoolid();
51
-            Map<String, String> cmap = classService.getQxClassidsByTeacherid(guide.getCreateid());
51
+            Map<String, String> cmap = classService.getQxClassidsByTeacherid(guide.getCreateid(), tGuide.getYear());
52 52
             if (guide.getCreateid().equals(tGuide.getCreateid())) {//自己发布的看所有班级
53 53
                 guide.setClassids(null);
54 54
             } else if (hashb == 1 && guide.getSchoolid().equals(schoolid)) {//有伙伴学校并且是本校发的

+ 5
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/service/resource/GuideService.java View File

@@ -500,4 +500,9 @@ public class GuideService {
500 500
 
501 501
         return rtnMap;
502 502
     }
503
+
504
+    //获取预习年份
505
+    public Integer getYearById(Integer guideid){
506
+        return guideMapper.getYearById(guideid);
507
+    }
503 508
 }

+ 2
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/paper/AnalyzeSearchVo.java View File

@@ -41,4 +41,6 @@ public class AnalyzeSearchVo {
41 41
     private String classids;//班级ids
42 42
 
43 43
     private Integer timestamp;//当前时间戳
44
+
45
+    private Integer createid;//创建人id
44 46
 }

+ 3
- 1
sstudy/src/main/resources/mapper/gradeclass/ClassMapper.xml View File

@@ -53,9 +53,11 @@
53 53
     <select id="listQxClassByTeacherid" resultType="java.util.Map">
54 54
         select c.classid,c.classname,u.schoolid userschoolid,ct.schoolid from t_class_teacher ct
55 55
         left join t_class c on ct.classid=c.classid
56
-        left join t_school s on c.schoolid=s.schoolid and c.`year`=s.`year`
56
+        left join t_school s on c.schoolid=s.schoolid
57 57
         left join t_user u on u.userid=ct.teacherid
58 58
         where ct.teacherid=#{teacherid} and c.classstate=1 and s.schoolstate=1 and c.classtype in (1,2,3)
59
+        <if test="year==null or year==0">and c.`year`=s.year</if>
60
+        <if test="year!=null and year!=0">and c.`year`=#{year}</if>
59 61
         order by s.createtime desc, c.classtype,c.classorder
60 62
     </select>
61 63
 </mapper>

+ 2
- 2
sstudy/src/main/resources/mapper/paper/PaperMapper.xml View File

@@ -304,7 +304,7 @@
304 304
         ,(select u.username from t_user u where u.userid=p.createid)createname
305 305
         from t_paper p left join t_paper_class pg on p.paperid=pg.paperid
306 306
         left join t_class c on pg.classid=c.classid
307
-        where p.createid=#{paper.teacherid} and c.gradeid=#{paper.gradeid} and c.year=#{paper.year}
307
+        where p.createid=#{paper.createid} and c.gradeid=#{paper.gradeid} and c.year=#{paper.year}
308 308
         and pg.schoolid=#{paper.schoolid}
309 309
         <if test="paper.starttime!=null and paper.starttime!=0">
310 310
             and pg.starttime>=#{paper.starttime}
@@ -438,7 +438,7 @@
438 438
         left join t_class c on ct.classid=c.classid
439 439
         left join t_paper_class pg on u.schoolid=pg.schoolid
440 440
         where tp.subjectid=#{param.subjectid} and u.userstate=1 and u.usertype=1 and pg.paperid=#{param.paperid}
441
-        and c.classstate=1 and c.year=#{param.year} and c.classtype in (1,2) and c.gradeid=#{param.gradeid}
441
+        and c.classstate!=10 and c.year=#{param.year} and c.classtype in (1,2) and c.gradeid=#{param.gradeid}
442 442
         group by ct.teacherid order by c.classtype,c.classorder, convert(u.username using gbk)
443 443
     </select>
444 444
     <resultMap id="paperStudentList" type="java.util.Map">

+ 27
- 24
sstudy/src/main/resources/mapper/recite/ReciteMapper.xml View File

@@ -9,7 +9,7 @@
9 9
     <!--获取背诵班级-->
10 10
     <select id="listClass" resultType="java.util.Map">
11 11
         select rs.classid,c.classname,c.gradeid,s.schoolid,s.schoolname,count(distinct rs.rsid)stunum
12
-        ,count(distinct case when rs.rsstate>0 then rs.rsid else null end)commitnum
12
+        ,count(distinct if(rs.rsstate>0, rs.rsid, null))commitnum
13 13
         from t_recite_student rs left join t_class c on rs.classid = c.classid
14 14
         left join t_school s on rs.schoolid=s.schoolid
15 15
         left join t_recite r on rs.reciteid=r.reciteid
@@ -24,24 +24,24 @@
24 24
 
25 25
     <!-- 背诵分页列表 网页 -->
26 26
     <resultMap id="listRecitesMap" type="java.util.Map">
27
-        <result property="reciteid" column="reciteid"></result>
28
-        <result property="recitetitle" column="recitetitle"></result>
29
-        <result property="recitecont" column="recitecont"></result>
30
-        <result property="schoolid" column="schoolid"></result>
31
-        <result property="subjectname" column="subjectname"></result>
32
-        <result property="createid" column="createid"></result>
33
-        <result property="createname" column="createname"></result>
34
-        <result property="createtime" column="createtime"></result>
35
-        <result property="starttime" column="starttime"></result>
36
-        <result property="stoptime" column="stoptime"></result>
37
-        <result property="hashb" column="hashb"></result>
27
+        <result property="reciteid" column="reciteid"/>
28
+        <result property="recitetitle" column="recitetitle"/>
29
+        <result property="recitecont" column="recitecont"/>
30
+        <result property="schoolid" column="schoolid"/>
31
+        <result property="subjectname" column="subjectname"/>
32
+        <result property="createid" column="createid"/>
33
+        <result property="createname" column="createname"/>
34
+        <result property="createtime" column="createtime"/>
35
+        <result property="starttime" column="starttime"/>
36
+        <result property="stoptime" column="stoptime"/>
37
+        <result property="hashb" column="hashb"/>
38 38
         <collection property="reciteStus" ofType="java.util.Map" select="listReciteStu"
39 39
                     javaType="java.util.List" column="reciteid">
40
-            <result property="rsid" column="rsid"></result>
41
-            <result property="classid" column="classid"></result>
42
-            <result property="studentid" column="studentid"></result>
43
-            <result property="studentid" column="studentid"></result>
44
-            <result property="schoolid" column="schoolid"></result>
40
+            <result property="rsid" column="rsid"/>
41
+            <result property="classid" column="classid"/>
42
+            <result property="studentid" column="studentid"/>
43
+            <result property="studentid" column="studentid"/>
44
+            <result property="schoolid" column="schoolid"/>
45 45
         </collection>
46 46
     </resultMap>
47 47
     <select id="listRecites" resultMap="listRecitesMap">
@@ -50,23 +50,26 @@
50 50
         ,r.createid,u.username AS createname,r.createtime,rg.starttime,rg.stoptime
51 51
         FROM t_recite r LEFT JOIN t_user u ON r.createid=u.userid
52 52
         LEFT JOIN t_recite_group rg ON rg.reciteid = r.reciteid
53
-        left join t_class_teacher ct on rg.classid=ct.classid
54
-        left join t_teacher_subjectbook ts on ct.teacherid=ts.teacherid
55
-        where ct.teacherid=#{recite.createid} and r.subjectid=ts.subjectid
53
+        left join t_teacher_subjectbook ts on r.subjectid=ts.subjectid
54
+        where ts.teacherid=#{recite.createid} and r.subjectid=ts.subjectid
56 55
         and ((r.hashb=1 and r.schoolid=#{recite.schoolid} and rg.classid in (${recite.classids})) or
57
-        (rg.classid in (${recite.bxclassids})))
56
+        (rg.classid in (${recite.bxclassids})) or r.createid=#{recite.createid})
58 57
         <if test="recite.recitestate==1">
59
-            AND rg.stoptime<![CDATA[ >= ]]>#{recite.nowtime}
58
+            AND rg.stoptime <![CDATA[ >= ]]>#{recite.nowtime}
60 59
         </if>
61 60
         <if test="recite.recitestate==2">
62
-            AND rg.stoptime<![CDATA[ < ]]>#{recite.nowtime}
61
+            AND rg.stoptime <![CDATA[ < ]]>#{recite.nowtime}
63 62
         </if>
64 63
         <if test="recite.recitetitle!=null and recite.recitetitle!=''">
65 64
             AND r.recitetitle like '%${recite.recitetitle}%'
66 65
         </if>
67
-        GROUP BY r.reciteid ORDER BY rg.starttime desc,r.reciteid asc
66
+        GROUP BY r.reciteid ORDER BY rg.starttime desc,r.reciteid
68 67
     </select>
69 68
     <select id="listReciteStu" resultType="java.util.Map">
70 69
         select rsid,classid,studentid,rsstate,schoolid from t_recite_student where reciteid=#{reciteid}
71 70
     </select>
71
+    <!--获取背诵年份-->
72
+    <select id="getYearById" resultType="java.lang.Integer">
73
+        select year from t_recite where reciteid=#{reciteid}
74
+    </select>
72 75
 </mapper>

+ 26
- 22
sstudy/src/main/resources/mapper/resource/GuideMapper.xml View File

@@ -3,13 +3,13 @@
3 3
 <mapper namespace="com.xhkjedu.sstudy.mapper.resource.GuideMapper">
4 4
 
5 5
     <resultMap id="guidesForMap" type="com.xhkjedu.sstudy.vo.resource.GuideVo">
6
-        <result column="guideid" property="guideid"></result>
7
-        <result column="guidename" property="guidename"></result>
8
-        <result column="createname" property="createname"></result>
9
-        <result column="createtime" property="createtime"></result>
10
-        <result column="costtime" property="costtime"></result>
11
-        <result column="subjectname" property="subjectname"></result>
12
-        <result column="createid" property="createid"></result>
6
+        <result column="guideid" property="guideid"/>
7
+        <result column="guidename" property="guidename"/>
8
+        <result column="createname" property="createname"/>
9
+        <result column="createtime" property="createtime"/>
10
+        <result column="costtime" property="costtime"/>
11
+        <result column="subjectname" property="subjectname"/>
12
+        <result column="createid" property="createid"/>
13 13
         <collection property="resources" ofType="java.util.Map"
14 14
                     javaType="java.util.List" select="listResourcesByGuideid" column="{guideid=guideid}">
15 15
         </collection>
@@ -23,7 +23,7 @@
23 23
         left join t_guide_group gg on g.guideid = gg.guideid
24 24
         where g.subjectid=#{guide.subjectid}
25 25
         and ((g.hashb=1 and g.schoolid=#{guide.schoolid} and gg.classid in (${guide.classids})) or
26
-        (gg.classid in (${guide.bxclassids})))
26
+        (gg.classid in (${guide.bxclassids})) or g.createid=#{guide.createid})
27 27
         <if test="guide.lsbid!=null and guide.lsbid!='' and guide.lsbid!='0'.toString()">
28 28
             and g.lsbid = #{guide.lsbid}
29 29
         </if>
@@ -33,7 +33,7 @@
33 33
         <if test="guide.guidename!=null and guide.guidename!=''">
34 34
             and g.guidename like '%${guide.guidename}%'
35 35
         </if>
36
-        group by g.guideid order by g.createtime desc,g.guidename asc
36
+        group by g.guideid order by g.createtime desc,g.guidename
37 37
     </select>
38 38
     <select id="listResourcesByGuideid" resultType="java.util.Map">
39 39
         select r.resourceid, r.resourcename,r.resourceurl,r.resourcecover,r.converted,r.pdfurl,
@@ -46,13 +46,13 @@
46 46
         select g.guideid,g.guidename,g.createtime,
47 47
         g.schoolid,(select u.username from t_user u where g.createid=u.userid)createname,
48 48
         count(DISTINCT gr.resourceid)as filenum,r.suffix,r.resourcecover,r.resourceclass,r.converted,
49
-        sum(r.resourcesize) resourcesize
49
+        sum(r.resourcesize) as resourcesize
50 50
         from t_guide g left join t_guide_resource gr on g.guideid=gr.guideid
51 51
         left join t_resource r on gr.resourceid=r.resourceid
52 52
         left join t_guide_group gg on g.guideid = gg.guideid
53 53
         where g.subjectid=#{guide.subjectid}
54 54
         and ((g.hashb=1 and g.schoolid=#{guide.schoolid} and gg.classid in (${guide.classids})) or
55
-        (gg.classid in (${guide.bxclassids})))
55
+        (gg.classid in (${guide.bxclassids})) or g.createid=#{guide.createid})
56 56
         <if test="guide.lsbid!=null and guide.lsbid!='' and guide.lsbid!='0'.toString()">
57 57
             and g.lsbid = #{guide.lsbid}
58 58
         </if>
@@ -62,7 +62,7 @@
62 62
         <if test="guide.guidename!=null and guide.guidename!=''">
63 63
             and g.guidename like '%${guide.guidename}%'
64 64
         </if>
65
-        group by g.guideid order by g.createtime desc,g.guidename asc limit  #{guide.page},#{guide.pageSize}
65
+        group by g.guideid order by g.createtime desc,g.guidename limit  #{guide.page},#{guide.pageSize}
66 66
     </select>
67 67
 
68 68
     <!--学生预习列表学生网页端-->
@@ -140,7 +140,7 @@
140 140
 
141 141
     <!--预习统计:年级下教师列表-->
142 142
     <select id="listUser" resultType="com.xhkjedu.sstudy.vo.resource.GuideAnalyzeVo">
143
-        select u.userid teacherid,u.username teachername,s.subjectname,c.gradeid
143
+        select u.userid as teacherid,u.username teachername,s.subjectname,c.gradeid
144 144
         from t_class_teacher ct inner join t_class c on ct.classid=c.classid
145 145
         inner join t_teacher_powersb tp on tp.teacherid=ct.teacherid
146 146
         inner join t_subject_book sb on sb.lsbid=tp.lsbid
@@ -162,7 +162,7 @@
162 162
     <!--预习统计:教师预习统计-->
163 163
     <select id="getPreviewAnalyze" resultType="com.xhkjedu.sstudy.vo.resource.GuideAnalyzeVo">
164 164
         select g.createid as teacherid,count(distinct ggs.guideid)fbnum,count(distinct ggs.rgsid)yyxnum,
165
-        count(distinct case when ggs.costtime!=0 then ggs.rgsid else null end)yxnum
165
+        count(distinct if(ggs.costtime!=0, ggs.rgsid, null))yxnum
166 166
         from t_guide g left join t_guide_group_student ggs on ggs.guideid=g.guideid
167 167
         left join t_class c on ggs.classid=c.classid
168 168
         where g.schoolid=#{paper.schoolid} and ggs.schoolid=#{paper.schoolid}
@@ -193,7 +193,7 @@
193 193
         left join t_class c on gg.classid=c.classid
194 194
         left join t_guide_resource gr on g.guideid=gr.guideid
195 195
         where c.gradeid=#{paper.gradeid} and c.year=#{paper.year}
196
-        and g.createid=#{paper.teacherid} and gg.schoolid=#{paper.schoolid}
196
+        and g.createid=#{paper.createid} and gg.schoolid=#{paper.schoolid}
197 197
         <if test="paper.starttime!=null and paper.starttime!=0">
198 198
             and g.createtime>=#{paper.starttime}
199 199
         </if>
@@ -209,14 +209,14 @@
209 209
         <if test="paper.subjectid!='0'.toString() and paper.subjectid!=''">
210 210
             and g.subjectid=#{paper.subjectid}
211 211
         </if>
212
-        group by g.guideid order by g.createtime desc,g.guidename asc,g.guideid asc
212
+        group by g.guideid order by g.createtime desc,g.guidename,g.guideid
213 213
     </select>
214 214
     <!--预习统计-按学生列表-->
215 215
     <select id="listPreviewStuGrade1" resultType="java.util.Map">
216 216
         select a.*,ifnull(truncate(a.commitnum*100/a.sdnum,2),0)commitrate
217 217
         from(select cs.studentid,u.username studentname
218
-        ,count(distinct case when g.guideid is not null then ggs.rgsid else null end)sdnum
219
-        ,count(distinct case when ggs.costtime!=0 and g.guideid is not null then ggs.rgsid else null end)commitnum
218
+        ,count(distinct if(g.guideid is not null, ggs.rgsid, null))sdnum
219
+        ,count(distinct if(ggs.costtime!=0 and g.guideid is not null, ggs.rgsid, null))commitnum
220 220
         from t_class_student cs left join t_class c on cs.classid=c.classid
221 221
         left join t_guide_group_student ggs on c.classid=ggs.classid and ggs.studentid=cs.studentid
222 222
         left join t_guide g on ggs.guideid=g.guideid
@@ -243,8 +243,8 @@
243 243
     <select id="listPreviewStuGrade" resultType="java.util.Map">
244 244
         select a.*,ifnull(truncate(a.commitnum*100/a.sdnum,2),0)commitrate
245 245
         from(select cs.*
246
-        ,count(distinct case when g.guideid is not null then ggs.rgsid else null end)sdnum
247
-        ,count(distinct case when ggs.costtime!=0 and g.guideid is not null then ggs.rgsid else null end)commitnum
246
+        ,count(distinct if(g.guideid is not null, ggs.rgsid, null))sdnum
247
+        ,count(distinct if(ggs.costtime!=0 and g.guideid is not null, ggs.rgsid, null))commitnum
248 248
         from (select cs2.studentid,u.username studentname
249 249
         from t_class_student cs2,t_class c,t_user u
250 250
         where c.schoolid=#{paper.schoolid} and c.gradeid=#{paper.gradeid} and c.year=#{paper.year}
@@ -281,7 +281,7 @@
281 281
     <select id="listPreviewStuDetail" resultType="com.xhkjedu.sstudy.vo.paper.AStudentPaperVo">
282 282
         select a.*,ifnull(truncate(a.commitnum*100/a.sdnum,2),0)commitrate
283 283
         from(select s.subjectname
284
-        ,count(distinct ggs.rgsid)sdnum,count(distinct case when ggs.costtime!=0 then ggs.rgsid else null end)commitnum
284
+        ,count(distinct ggs.rgsid)sdnum,count(distinct if(ggs.costtime!=0, ggs.rgsid, null))commitnum
285 285
         from t_guide_group_student ggs left join t_class c on ggs.classid=c.classid
286 286
         left join t_guide g on ggs.guideid=g.guideid
287 287
         left join t_subject s on g.subjectid=s.subjectid
@@ -329,7 +329,7 @@
329 329
     <!--预习关联班级-->
330 330
     <select id="listGuideClassByGuide" resultType="java.util.Map">
331 331
         select rs.classid,c.classname,c.gradeid,s.schoolid,s.schoolname,count(distinct rs.rgsid)stunum
332
-        ,count(distinct case when rs.readtime>0 then rs.rgsid else null end)commitnum
332
+        ,count(distinct if(rs.readtime>0, rs.rgsid, null))commitnum
333 333
         from t_guide_group_student rs left join t_class c on rs.classid = c.classid
334 334
         left join t_guide g on rs.guideid=g.guideid
335 335
         left join t_school s on rs.schoolid=s.schoolid
@@ -341,4 +341,8 @@
341 341
         </if>
342 342
         group by rs.classid order by s.createtime desc, c.classtype,c.classorder
343 343
     </select>
344
+    <!--获取预习年份-->
345
+    <select id="getYearById" resultType="java.lang.Integer">
346
+        select year from t_guide where guideid=#{guideid}
347
+    </select>
344 348
 </mapper>

Loading…
Cancel
Save