Browse Source

Merge remote-tracking branch 'origin/master' into ywx

tags/正式版本
雍文秀 2 years ago
parent
commit
b5d252276d

+ 17
- 2
sstudy/src/main/java/com/xhkjedu/sstudy/controller/subjectbook/SubjectQuestiontypeController.java View File

@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
12 12
 import org.springframework.web.bind.annotation.RestController;
13 13
 
14 14
 import java.util.List;
15
+import java.util.Map;
15 16
 
16 17
 /**
17 18
  * @ClassName SubjectQuestiontypeController
@@ -50,8 +51,22 @@ public class SubjectQuestiontypeController {
50 51
     @PostMapping("/listsel")
51 52
     public ResultVo listSubjectsForSel(@RequestBody TSubjectQuestiontype qtype){
52 53
         N_Utils.validation(new Object[]{qtype.getSubjectid(),"科目",1});
53
-        List<SubjectQuestiontypeVo> lst = subjectQuestiontypeService.listQuestiontypesForSel(qtype);
54
-        return new ResultVo(0,"查询科目集合成功",lst);
54
+        List<Map> lst = subjectQuestiontypeService.listQuestiontypesForSel(qtype);
55
+        return new ResultVo(0,"成功获取题型",lst);
56
+    }
57
+
58
+    /**
59
+     * @Description 获取题型,英语学科添加听力题
60
+     * @Param [qtype]
61
+     * @Return com.xhkjedu.vo.ResultVo
62
+     * @Author wn
63
+     * @Date 2022/8/17 10:22
64
+     **/
65
+    @PostMapping("/qtypesel")
66
+    public ResultVo listTypesForSearchQuestion(@RequestBody TSubjectQuestiontype qtype){
67
+        N_Utils.validation(new Object[]{qtype.getSubjectid(),"科目",1});
68
+        List<Map> lst = subjectQuestiontypeService.listTypesForSearchQuestion(qtype);
69
+        return new ResultVo(0,"成功获取题型",lst);
55 70
     }
56 71
 
57 72
     /**

+ 3
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/subjectbook/SubjectMapper.java View File

@@ -62,4 +62,7 @@ public interface SubjectMapper extends TkMapper<TSubject> {
62 62
 
63 63
     //根据科目ids获取名称列表
64 64
     List<Map<String, String>> listNameByIds(@Param("subjectids") List<String> subjectids);
65
+
66
+    //根据科目id获取科目名称
67
+    String getSubjectnameById(@Param("subjectid") String subjectid);
65 68
 }

+ 5
- 1
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/subjectbook/SubjectQuestiontypeMapper.java View File

@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
7 7
 import org.springframework.stereotype.Repository;
8 8
 
9 9
 import java.util.List;
10
+import java.util.Map;
10 11
 
11 12
 /**
12 13
  * @ClassName SubjectQuestiontype
@@ -19,7 +20,10 @@ public interface SubjectQuestiontypeMapper extends TkMapper<TSubjectQuestiontype
19 20
 
20 21
     List<TSubjectQuestiontype> listQuestiontypes(@Param("type") TSubjectQuestiontype type);
21 22
 
22
-    List<SubjectQuestiontypeVo> listQuestiontypesForSel(@Param("type") TSubjectQuestiontype type);
23
+    List<Map> listQuestiontypesForSel(@Param("type") TSubjectQuestiontype type);
24
+
25
+    //获取有听力题的题型
26
+    List<Map> listQtypesHasHear(@Param("type") TSubjectQuestiontype type);
23 27
 
24 28
     //查找使用题型的模块
25 29
     String findUseModule(String qtypeid);

+ 4
- 1
sstudy/src/main/java/com/xhkjedu/sstudy/model/question/TQuestion.java View File

@@ -24,7 +24,10 @@ public class TQuestion extends BaseBean {
24 24
     //处理题型1单选题2多选题3主观题4判断对错5判断√×6判断TF7完形填空8阅读理解9课堂画图题10任务型阅读11复合题12听力题
25 25
     private Integer ctype;
26 26
 
27
-    //听力题文件ctype=12
27
+    //是否是听力题0不是1是
28
+    private Integer hashear;
29
+
30
+    //听力题文件地址
28 31
     private String hearfile;
29 32
 
30 33
     //试题题型id

+ 3
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/model/subjectbook/TSubjectQuestiontype.java View File

@@ -25,6 +25,9 @@ public class TSubjectQuestiontype extends BaseBean {
25 25
     //处理题型1单选题2多选题3主观题4判断对错5判断✔6判断TF7完形填空8阅读理解
26 26
     private Integer ctype;
27 27
 
28
+    //是否删除0未删除1已删除
29
+    private Integer deleted;
30
+
28 31
     //创建人id
29 32
     private Integer createid;
30 33
 

+ 33
- 2
sstudy/src/main/java/com/xhkjedu/sstudy/service/subjectbook/SubjectQuestiontypeService.java View File

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.sstudy.service.subjectbook;
2 2
 
3
+import com.xhkjedu.sstudy.mapper.subjectbook.SubjectMapper;
3 4
 import com.xhkjedu.sstudy.mapper.subjectbook.SubjectQuestiontypeMapper;
4 5
 import com.xhkjedu.sstudy.model.subjectbook.TSubjectQuestiontype;
5 6
 import com.xhkjedu.sstudy.utils.StudyUtil;
@@ -8,7 +9,9 @@ import com.xhkjedu.sstudy.vo.subjectbook.SubjectQuestiontypeVo;
8 9
 import org.springframework.beans.factory.annotation.Autowired;
9 10
 import org.springframework.stereotype.Service;
10 11
 
12
+import java.util.HashMap;
11 13
 import java.util.List;
14
+import java.util.Map;
12 15
 
13 16
 /**
14 17
  * @ClassName SubjectQuestiontypeService
@@ -20,6 +23,8 @@ import java.util.List;
20 23
 public class SubjectQuestiontypeService {
21 24
     @Autowired
22 25
     private SubjectQuestiontypeMapper subjectQuestiontypeMapper;
26
+    @Autowired
27
+    private SubjectMapper subjectMapper;
23 28
 
24 29
     /**
25 30
      *功能描述 获取科目下所有题型
@@ -39,7 +44,7 @@ public class SubjectQuestiontypeService {
39 44
      * @param  * @param sqtype
40 45
      * @return java.util.List<com.xhkjedu.vo.subjectbook.SubjectQuestiontypeVo>
41 46
      */
42
-    public List<SubjectQuestiontypeVo> listQuestiontypesForSel(TSubjectQuestiontype sqtype){
47
+    public List<Map> listQuestiontypesForSel(TSubjectQuestiontype sqtype){
43 48
         return subjectQuestiontypeMapper.listQuestiontypesForSel(sqtype);
44 49
     }
45 50
 
@@ -52,6 +57,7 @@ public class SubjectQuestiontypeService {
52 57
      */
53 58
     public Integer addQuestiontype(TSubjectQuestiontype sqtype){
54 59
         String id = StudyUtil.getId();
60
+        sqtype.setDeleted(0);
55 61
         sqtype.setQtypeid(id);
56 62
         sqtype.setCreatetime(N_Utils.getSecondTimestamp());
57 63
         return subjectQuestiontypeMapper.insertSelective(sqtype);
@@ -89,4 +95,29 @@ public class SubjectQuestiontypeService {
89 95
         }
90 96
         return useModule;
91 97
     }
92
-}
98
+
99
+    /**
100
+     * @Description 获取题型,英语学科添加听力题
101
+     * @Param [sqtype]
102
+     * @Return java.util.List<java.util.Map>
103
+     * @Author wn
104
+     * @Date 2022/8/17 10:21
105
+     **/
106
+    public List<Map> listTypesForSearchQuestion(TSubjectQuestiontype sqtype) {
107
+        List<Map> list = subjectQuestiontypeMapper.listQuestiontypesForSel(sqtype);
108
+        //根据科目id获取科目名称
109
+        String  subjectname = subjectMapper.getSubjectnameById(sqtype.getSubjectid());
110
+        if(subjectname.contains("英语")){
111
+            //如果是英语题获取英语题对应试题包含听力题的题型
112
+            List<Map> heartypes = subjectQuestiontypeMapper.listQtypesHasHear(sqtype);
113
+            if(heartypes!=null && heartypes.size()>0){
114
+                Map tlmap = new HashMap();
115
+                tlmap.put("qtypename","听力题");
116
+                tlmap.put("qtypes",heartypes);
117
+                list.add(0,tlmap);
118
+            }
119
+        }
120
+        return list;
121
+    }
122
+
123
+    }

+ 3
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/question/QuestionVo.java View File

@@ -45,6 +45,9 @@ public class QuestionVo {
45 45
     //创建人
46 46
     private String createname;
47 47
 
48
+    //是否是听力题0不是1是
49
+    private Integer hashear;
50
+
48 51
     //听力题文件地址
49 52
     private String hearfile;
50 53
 

+ 7
- 5
sstudy/src/main/resources/mapper/question/QuestionMapper.xml View File

@@ -68,6 +68,7 @@
68 68
         <result property="count" column="count"></result>
69 69
         <result property="directorid" column="directorid"></result>
70 70
         <result property="directorname" column="directorname"></result>
71
+        <result property="hashear" column="hashear"></result>
71 72
         <result property="hearfile" column="hearfile"></result>
72 73
         <result property="belong" column="belong"></result>
73 74
         <result property="createid" column="createid"></result>
@@ -102,7 +103,7 @@
102 103
         where qp.questionid=#{questionid}
103 104
     </select>
104 105
     <select id="listQuestions" resultMap="questionResult">
105
-        select q.questionid,q.score,q.complexity,q.ctype,q.qstem,q.qoption,q.qanswer,q.qanalyze,q.belong
106
+        select q.questionid,q.score,q.complexity,q.ctype,q.qstem,q.qoption,q.qanswer,q.qanalyze,q.belong,q.hashear,q.hearfile
106 107
         ,q.qtypeid,q.qtypename,q.createtime,u.username createname,q.count,qd.directorid,d.directorname,0 pointid
107 108
         from t_question q left join t_user u on u.userid = q.createid
108 109
         left join t_question_director qd on q.questionid=qd.questionid
@@ -116,7 +117,7 @@
116 117
     <select id="findById" resultMap="questionResult">
117 118
         select q.questionid,q.score,q.complexity,q.ctype,q.qstem,q.qoption,q.qanswer,q.qanalyze,q.belong
118 119
         ,q.qtypeid,q.qtypename,q.createtime,q.source,q.year,q.region,q.schoolname,q.subjectid,q.schoolid
119
-        ,qd.directorid,d.directorall directorname,d.lsbid,q.hearfile,q.qlevel,
120
+        ,qd.directorid,d.directorall directorname,d.lsbid,q.hashear,q.hearfile,q.qlevel,
120 121
         sb.level,sb.subjectid,s.subjectname,v.versionname,sb.lsbname
121 122
         ,(select a.areaall from t_areazone a where a.areacode=q.region)areaall
122 123
         from t_question q left join t_question_director qd on q.questionid=qd.questionid
@@ -213,6 +214,7 @@
213 214
         <result property="schoolname" column="schoolname"></result>
214 215
         <result property="qlevel" column="qlevel"></result>
215 216
         <result property="snum" column="snum"></result>
217
+        <result property="hashear" column="hashear"></result>
216 218
         <result property="hearfile" column="hearfile"></result>
217 219
         <collection property="sonqlist" ofType="java.util.Map"
218 220
                     column="questionid" select="listSonQuestionForSelect">
@@ -223,7 +225,7 @@
223 225
     <select id="listForSelect" resultMap="directPointQuestions">
224 226
         select q.questionid,q.score,q.complexity,q.qstem,q.qoption,q.qanswer,q.qanalyze
225 227
         ,q.qtypeid,q.qtypename,q.count,GROUP_CONCAT(p.pointname)points,q.ctype
226
-        ,q.source,q.year,q.region,q.schoolname,q.qlevel,q.hearfile
228
+        ,q.source,q.year,q.region,q.schoolname,q.qlevel,q.hearfile,q.hashear
227 229
         from t_question q left join t_question_point qp on q.questionid = qp.questionid
228 230
         left join t_point p on p.pointid=qp.pointid
229 231
         left join t_question_director qd on q.questionid=qd.questionid
@@ -301,12 +303,12 @@
301 303
     <!--批量保存-->
302 304
     <insert id="saveBathQuestion" parameterType="com.xhkjedu.sstudy.model.question.TQuestion">
303 305
         INSERT INTO t_question (questionid,qstem,qstemtxt,qoption,qanswer,qanalyze,score,complexity,
304
-                                ctype,hearfile,qtypeid,qtypename, subjectid,qlevel,snum,sorder,questionpid,
306
+                                ctype,hashear,hearfile,qtypeid,qtypename, subjectid,qlevel,snum,sorder,questionpid,
305 307
                                 qstate,source,year,region,schoolname,createid,createtime,belong,schoolid)
306 308
         VALUES
307 309
         <foreach collection ="list" item="p" index= "index" separator =",">
308 310
             (#{p.questionid},#{p.qstem},#{p.qstemtxt},#{p.qoption},#{p.qanswer},#{p.qanalyze},#{p.score},#{p.complexity},
309
-             #{p.ctype},#{p.hearfile},#{p.qtypeid},#{p.qtypename},#{p.subjectid},#{p.qlevel},#{p.snum},#{p.sorder},#{p.questionpid},
311
+             #{p.ctype},#{p.hashear},#{p.hearfile},#{p.qtypeid},#{p.qtypename},#{p.subjectid},#{p.qlevel},#{p.snum},#{p.sorder},#{p.questionpid},
310 312
              #{p.qstate},#{p.source},#{p.year},#{p.region},#{p.schoolname},#{p.createid},#{p.createtime},#{p.belong},#{p.schoolid})
311 313
         </foreach>
312 314
     </insert>

+ 5
- 0
sstudy/src/main/resources/mapper/subjectbook/SubjectMapper.xml View File

@@ -64,4 +64,9 @@
64 64
             #{subjectid}
65 65
         </foreach>
66 66
     </select>
67
+
68
+    <!--根据科目id获取科目名称-->
69
+    <select id="getSubjectnameById" resultType="java.lang.String">
70
+        select subjectname from t_subject where subjectid=#{subjectid}
71
+    </select>
67 72
 </mapper>

+ 15
- 3
sstudy/src/main/resources/mapper/subjectbook/SubjectQuestiontypeMapper.xml View File

@@ -7,7 +7,7 @@
7 7
         SELECT s.qtypeid,s.qtypename,s.subjectid,s.qtypeorder,s.ctype,s.createid,s.createtime,
8 8
         u.username AS createname,s.belong
9 9
         FROM t_subject_questiontype s LEFT JOIN t_user u ON s.createid=u.userid
10
-        WHERE s.subjectid=#{type.subjectid} and (s.belong=1
10
+        WHERE s.subjectid=#{type.subjectid} and s.deleted=0 and (s.belong=1
11 11
         <if test="type.schoolid!=null">
12 12
             or s.schoolid=#{type.schoolid}
13 13
         </if>)
@@ -15,15 +15,27 @@
15 15
     </select>
16 16
 
17 17
     <!-- 根据科目下题型列表用于选择题型 -->
18
-    <select id="listQuestiontypesForSel" resultType="com.xhkjedu.sstudy.vo.subjectbook.SubjectQuestiontypeVo">
18
+    <select id="listQuestiontypesForSel" resultType="java.util.Map">
19 19
         SELECT qtypeid,qtypename,qtypeorder,ctype,belong from t_subject_questiontype
20
-        WHERE subjectid=#{type.subjectid} and (belong=1
20
+        WHERE subjectid=#{type.subjectid} and deleted=0 and (belong=1
21 21
         <if test="type.schoolid!=null">
22 22
             or schoolid=#{type.schoolid}
23 23
         </if>)
24 24
         order by qtypeorder asc
25 25
     </select>
26 26
 
27
+    <!--获取有听力题的题型-->
28
+    <select id="listQtypesHasHear" resultType="java.util.Map">
29
+        select q.qtypeid,s.qtypename,s.qtypeorder,s.ctype,s.belong from t_question q
30
+        left join t_subject_questiontype s on q.qtypeid=s.qtypeid
31
+        where q.hashear=1 and q.qstate=1 and q.subjectid=#{type.subjectid} and s.deleted=0
32
+        and (q.belong=1
33
+        <if test="type.schoolid!=null">
34
+            or q.schoolid=#{type.schoolid}
35
+        </if>)
36
+        group by q.qtypeid order by s.qtypeorder
37
+    </select>
38
+
27 39
     <!--查找使用题型的模块-->
28 40
     <select id="findUseModule" resultType="java.lang.String">
29 41
         SELECT CONCAT((select (case when count(*)>0 then '试题' else '' end) from t_question where qtypeid=#{qtypeid})

Loading…
Cancel
Save