Browse Source

作业完善

tags/正式3.9.0
雍文秀 1 year ago
parent
commit
22eaadb459

+ 2
- 1
sstudy/src/main/java/com/xhkjedu/sstudy/controller/resource/GuideController.java View File

@@ -213,7 +213,8 @@ public class GuideController {
213 213
         Integer studentid = paper.getStudentid();
214 214
         Integer gradeid = paper.getGradeid();
215 215
         N_Utils.validation(new Object[]{studentid,"学生id",1,gradeid,"年级id",1
216
-                ,paper.getSchoolid(),"学校id",1,paper.getUsertype(),"用户类型",1});
216
+                ,paper.getSchoolid(),"学校id",1});
217
+        if (paper.getUsertype() == null) return new ResultVo(1,"用户类型不能为空");
217 218
         //guideService.setYear(paper);
218 219
         Map map = guideService.listPreviewStuDetail(paper);
219 220
         return new ResultVo(0,"获取预习统计--按学生详情成功",map);

+ 11
- 6
sstudy/src/main/java/com/xhkjedu/sstudy/utils/StudyUtil.java View File

@@ -189,17 +189,22 @@ public class StudyUtil {
189 189
                 p.setClasses(null);
190 190
                 p.setChecklist(null);
191 191
             } else {
192
-                List<PaperClassVo> classes = p.getClasses();
193
-                for (PaperClassVo c : classes) {
194
-                    if (!N_Utils.isEmptyInteger(c.getClassnum())) {
195
-                        c.setWtjnum(c.getClassnum() - c.getYtjnum());
192
+                List<Map> schools = p.getSchools();
193
+                List<PaperClassVo> classes = new ArrayList<>();
194
+                for (Map school : schools) {
195
+                    List<PaperClassVo> classList = (List<PaperClassVo>) school.get("classes");
196
+                    classes.addAll(classList);
197
+                    for (PaperClassVo c : classList) {
198
+                        if (!N_Utils.isEmptyInteger(c.getClassnum())) {
199
+                            c.setWtjnum(c.getClassnum() - c.getYtjnum());
200
+                        }
196 201
                     }
197 202
                 }
198 203
                 p.setClassnum(classes.stream().mapToInt(c -> c.getClassnum()).sum());
199 204
                 p.setYtjnum(classes.stream().mapToInt(c -> c.getYtjnum()).sum());
200 205
                 p.setYpgnum(classes.stream().mapToInt(c -> c.getYpgnum()).sum());
201 206
 
202
-                if(p.getChecktype() == 3){
207
+                /*if(p.getChecktype() == 3){
203 208
                     List<Map> rtnList = new ArrayList<>();
204 209
                     //指定学生批阅
205 210
                     List<Map> checklist = p.getChecklist();
@@ -216,7 +221,7 @@ public class StudyUtil {
216 221
                         rtnList.add(map);
217 222
                     }
218 223
                     p.setChecklist(rtnList);
219
-                }
224
+                }*/
220 225
             }
221 226
         }
222 227
         return list;

+ 3
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/paper/PaperClassVo.java View File

@@ -40,4 +40,7 @@ public class PaperClassVo {
40 40
 
41 41
     //批改人
42 42
     private Integer checkid;
43
+
44
+    //学校id
45
+    private Integer schoolid;
43 46
 }

+ 3
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/paper/PaperListVo.java View File

@@ -49,6 +49,9 @@ public class PaperListVo {
49 49
     //班级集合
50 50
     private List<PaperClassVo> classes;
51 51
 
52
+    //学校集合
53
+    private List<Map> schools;
54
+
52 55
     //批阅
53 56
     private List<Map> checklist;
54 57
 

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

@@ -75,7 +75,7 @@
75 75
         <result property="classnum" column="classnum"></result>
76 76
         <result property="ytjnum" column="ytjnum"></result>
77 77
         <result property="ypgnum" column="ypgnum"></result>
78
-        <collection property="classes" ofType="com.xhkjedu.sstudy.vo.paper.PaperClassVo" javaType="java.util.List"
78
+        <collection property="schools" ofType="java.util.Map" javaType="java.util.List"
79 79
                     select="listClass" column="{paperid=paperid,createid=createid,checkid=checkid,checktype=checktype,logschoolid=logschoolid,classids=classids}">
80 80
         </collection>
81 81
         <collection property="checklist" ofType="java.util.Map" javaType="java.util.List"
@@ -87,17 +87,22 @@
87 87
             <result property="gradeid" column="gradeid"></result>
88 88
         </collection>
89 89
     </resultMap>
90
-    <resultMap id="classResult" type="com.xhkjedu.sstudy.vo.paper.PaperClassVo">
91
-        <result property="classid" column="classid"></result>
92
-        <result property="classname" column="classname"></result>
93
-        <result property="gradeid" column="gradeid"></result>
94
-        <result property="classnum" column="classnum"></result>
95
-        <result property="ytjnum" column="ytjnum"></result>
96
-        <result property="ypgnum" column="ypgnum"></result>
97
-        <result property="studentname" column="studentname"></result>
98
-        <result property="checkid" column="checkid"></result>
99
-        <result property="teachername" column="teachername"></result>
100
-        <result property="checked" column="checked"></result>
90
+    <resultMap id="classResult" type="java.util.Map">
91
+        <result property="schoolid" column="schoolid"></result>
92
+        <result property="schoolname" column="schoolname"></result>
93
+        <collection property="classes" ofType="com.xhkjedu.sstudy.vo.paper.PaperClassVo" javaType="java.util.List">
94
+            <result property="schoolid" column="schoolid"></result>
95
+            <result property="classid" column="classid"></result>
96
+            <result property="classname" column="classname"></result>
97
+            <result property="gradeid" column="gradeid"></result>
98
+            <result property="classnum" column="classnum"></result>
99
+            <result property="ytjnum" column="ytjnum"></result>
100
+            <result property="ypgnum" column="ypgnum"></result>
101
+            <result property="studentname" column="studentname"></result>
102
+            <result property="checkid" column="checkid"></result>
103
+            <result property="teachername" column="teachername"></result>
104
+            <result property="checked" column="checked"></result>
105
+        </collection>
101 106
     </resultMap>
102 107
     <!--<select id="listClass" resultMap="classResult">
103 108
         select count(*)classnum,ps.classid,c.classname,c.gradeid,pg.checked
@@ -120,24 +125,45 @@
120 125
     </select>-->
121 126
     <!--本校作业班级-->
122 127
     <select id="listClass" resultMap="classResult">
123
-        select count(*) classnum,ps.classid,c.classname,c.gradeid
128
+        select count(*) classnum,ps.classid,c.classname,c.gradeid,c.schoolid,s.schoolname
124 129
         ,count(distinct case when ps.psstate!=0 then ps.psid else null end)ytjnum
125 130
         ,count(distinct case when ps.pschecked=1 then ps.psid else null end)ypgnum
126 131
         from t_paper_student ps left join t_class c on ps.classid=c.classid
127
-        where ps.paperid=#{paperid} and ps.classid in (${classids})
132
+        left join t_school s on c.schoolid = s.schoolid
133
+        where ps.paperid=#{paperid}
134
+        <if test="classids!=null and classids!=''">
135
+            and ps.classid in(${classids})
136
+        </if>
128 137
         group by ps.classid order by c.gradeid,c.classtype,c.classorder
129 138
     </select>
130 139
     <!--本校作业班级批阅人-->
131
-    <select id="listPaperCheckStu" resultType="java.util.Map">
140
+    <resultMap id="checkUserResult" type="java.util.Map">
141
+        <result property="schoolid" column="schoolid"></result>
142
+        <result property="schoolname" column="schoolname"></result>
143
+        <result property="checktype" column="checktype"></result>
144
+        <collection property="classes" ofType="java.util.Map" javaType="java.util.List">
145
+            <result property="schoolid" column="schoolid"></result>
146
+            <result property="classid" column="classid"></result>
147
+            <result property="classname" column="classname"></result>
148
+            <result property="gradeid" column="gradeid"></result>
149
+            <collection property="users" ofType="java.util.Map" javaType="java.util.List">
150
+                <result property="userid" column="userid"></result>
151
+                <result property="username" column="username"></result>
152
+            </collection>
153
+        </collection>
154
+    </resultMap>
155
+    <select id="listPaperCheckStu" resultMap="checkUserResult">
132 156
          <if test="checktype==1">
133
-           select pg.checkid userid,u.username,c.classid,c.classname,c.gradeid from t_paper_class pg
157
+           select pg.checkid userid,u.username,c.classid,c.classname,c.gradeid,pg.schoolid,s.schoolname
158
+           from t_paper_class pg left join t_school s on pg.schoolid=s.schoolid
134 159
            left join t_user u on pg.checkid=u.userid
135 160
            left join t_class c on pg.classid=c.classid
136 161
            where pg.paperid=#{paperid} and pg.schoolid=#{logschoolid}
137 162
            order by c.gradeid,c.classtype,c.classorder,convert(u.username using gbk)
138 163
        </if>
139 164
        <if test="checktype==3">
140
-           select ps.checkid userid,u.username,c.classid,c.classname,c.gradeid from t_paper_student ps
165
+           select ps.checkid userid,u.username,c.classid,c.classname,c.gradeid,ps.schoolid,s.schoolname
166
+           from t_paper_student ps left join t_school s on ps.schoolid=s.schoolid
141 167
            left join t_user u on ps.checkid=u.userid
142 168
            left join t_class c on ps.classid=c.classid
143 169
            where ps.paperid=#{paperid} and ps.schoolid=#{logschoolid}

+ 4
- 2
sstudy/src/main/resources/mapper/resource/GuideMapper.xml View File

@@ -164,7 +164,8 @@
164 164
         count(distinct case when ggs.costtime!=0 then ggs.rgsid else null end)yxnum
165 165
         from t_guide g left join t_guide_group_student ggs on ggs.guideid=g.guideid
166 166
         left join t_class c on ggs.classid=c.classid
167
-        where c.schoolid=#{paper.schoolid} and c.gradeid=#{paper.gradeid} and c.year=#{paper.year}
167
+        where g.schoolid=#{paper.schoolid} and ggs.schoolid=#{paper.schoolid}
168
+        and c.gradeid=#{paper.gradeid} and c.year=#{paper.year}
168 169
         <if test="paper.starttime!=null and paper.starttime!=0">
169 170
             and g.createtime>=#{paper.starttime}
170 171
         </if>
@@ -190,7 +191,8 @@
190 191
         left join t_guide_group gg on gg.guideid=g.guideid
191 192
         left join t_class c on gg.classid=c.classid
192 193
         left join t_guide_resource gr on g.guideid=gr.guideid
193
-        where c.gradeid=#{paper.gradeid} and c.year=#{paper.year} and g.createid=#{paper.teacherid}
194
+        where c.gradeid=#{paper.gradeid} and c.year=#{paper.year}
195
+        and g.createid=#{paper.teacherid} and gg.schoolid=#{paper.schoolid}
194 196
         <if test="paper.starttime!=null and paper.starttime!=0">
195 197
             and g.createtime>=#{paper.starttime}
196 198
         </if>

Loading…
Cancel
Save