Browse Source

试题添加是否有听力文件,题型标识是否删除,处理选择试题搜索题型条件

tags/正式版本
王宁 2 years ago
parent
commit
cb235babf2

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

12
 import org.springframework.web.bind.annotation.RestController;
12
 import org.springframework.web.bind.annotation.RestController;
13
 
13
 
14
 import java.util.List;
14
 import java.util.List;
15
+import java.util.Map;
15
 
16
 
16
 /**
17
 /**
17
  * @ClassName SubjectQuestiontypeController
18
  * @ClassName SubjectQuestiontypeController
50
     @PostMapping("/listsel")
51
     @PostMapping("/listsel")
51
     public ResultVo listSubjectsForSel(@RequestBody TSubjectQuestiontype qtype){
52
     public ResultVo listSubjectsForSel(@RequestBody TSubjectQuestiontype qtype){
52
         N_Utils.validation(new Object[]{qtype.getSubjectid(),"科目",1});
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
 
62
 
63
     //根据科目ids获取名称列表
63
     //根据科目ids获取名称列表
64
     List<Map<String, String>> listNameByIds(@Param("subjectids") List<String> subjectids);
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
 import org.springframework.stereotype.Repository;
7
 import org.springframework.stereotype.Repository;
8
 
8
 
9
 import java.util.List;
9
 import java.util.List;
10
+import java.util.Map;
10
 
11
 
11
 /**
12
 /**
12
  * @ClassName SubjectQuestiontype
13
  * @ClassName SubjectQuestiontype
19
 
20
 
20
     List<TSubjectQuestiontype> listQuestiontypes(@Param("type") TSubjectQuestiontype type);
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
     String findUseModule(String qtypeid);
29
     String findUseModule(String qtypeid);

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

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

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

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

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

1
 package com.xhkjedu.sstudy.service.subjectbook;
1
 package com.xhkjedu.sstudy.service.subjectbook;
2
 
2
 
3
+import com.xhkjedu.sstudy.mapper.subjectbook.SubjectMapper;
3
 import com.xhkjedu.sstudy.mapper.subjectbook.SubjectQuestiontypeMapper;
4
 import com.xhkjedu.sstudy.mapper.subjectbook.SubjectQuestiontypeMapper;
4
 import com.xhkjedu.sstudy.model.subjectbook.TSubjectQuestiontype;
5
 import com.xhkjedu.sstudy.model.subjectbook.TSubjectQuestiontype;
5
 import com.xhkjedu.sstudy.utils.StudyUtil;
6
 import com.xhkjedu.sstudy.utils.StudyUtil;
8
 import org.springframework.beans.factory.annotation.Autowired;
9
 import org.springframework.beans.factory.annotation.Autowired;
9
 import org.springframework.stereotype.Service;
10
 import org.springframework.stereotype.Service;
10
 
11
 
12
+import java.util.HashMap;
11
 import java.util.List;
13
 import java.util.List;
14
+import java.util.Map;
12
 
15
 
13
 /**
16
 /**
14
  * @ClassName SubjectQuestiontypeService
17
  * @ClassName SubjectQuestiontypeService
20
 public class SubjectQuestiontypeService {
23
 public class SubjectQuestiontypeService {
21
     @Autowired
24
     @Autowired
22
     private SubjectQuestiontypeMapper subjectQuestiontypeMapper;
25
     private SubjectQuestiontypeMapper subjectQuestiontypeMapper;
26
+    @Autowired
27
+    private SubjectMapper subjectMapper;
23
 
28
 
24
     /**
29
     /**
25
      *功能描述 获取科目下所有题型
30
      *功能描述 获取科目下所有题型
39
      * @param  * @param sqtype
44
      * @param  * @param sqtype
40
      * @return java.util.List<com.xhkjedu.vo.subjectbook.SubjectQuestiontypeVo>
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
         return subjectQuestiontypeMapper.listQuestiontypesForSel(sqtype);
48
         return subjectQuestiontypeMapper.listQuestiontypesForSel(sqtype);
44
     }
49
     }
45
 
50
 
52
      */
57
      */
53
     public Integer addQuestiontype(TSubjectQuestiontype sqtype){
58
     public Integer addQuestiontype(TSubjectQuestiontype sqtype){
54
         String id = StudyUtil.getId();
59
         String id = StudyUtil.getId();
60
+        sqtype.setDeleted(0);
55
         sqtype.setQtypeid(id);
61
         sqtype.setQtypeid(id);
56
         sqtype.setCreatetime(N_Utils.getSecondTimestamp());
62
         sqtype.setCreatetime(N_Utils.getSecondTimestamp());
57
         return subjectQuestiontypeMapper.insertSelective(sqtype);
63
         return subjectQuestiontypeMapper.insertSelective(sqtype);
89
         }
95
         }
90
         return useModule;
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
     //创建人
45
     //创建人
46
     private String createname;
46
     private String createname;
47
 
47
 
48
+    //是否是听力题0不是1是
49
+    private Integer hashear;
50
+
48
     //听力题文件地址
51
     //听力题文件地址
49
     private String hearfile;
52
     private String hearfile;
50
 
53
 

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

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

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

64
             #{subjectid}
64
             #{subjectid}
65
         </foreach>
65
         </foreach>
66
     </select>
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
 </mapper>
72
 </mapper>

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

7
         SELECT s.qtypeid,s.qtypename,s.subjectid,s.qtypeorder,s.ctype,s.createid,s.createtime,
7
         SELECT s.qtypeid,s.qtypename,s.subjectid,s.qtypeorder,s.ctype,s.createid,s.createtime,
8
         u.username AS createname,s.belong
8
         u.username AS createname,s.belong
9
         FROM t_subject_questiontype s LEFT JOIN t_user u ON s.createid=u.userid
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
         <if test="type.schoolid!=null">
11
         <if test="type.schoolid!=null">
12
             or s.schoolid=#{type.schoolid}
12
             or s.schoolid=#{type.schoolid}
13
         </if>)
13
         </if>)
15
     </select>
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
         SELECT qtypeid,qtypename,qtypeorder,ctype,belong from t_subject_questiontype
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
         <if test="type.schoolid!=null">
21
         <if test="type.schoolid!=null">
22
             or schoolid=#{type.schoolid}
22
             or schoolid=#{type.schoolid}
23
         </if>)
23
         </if>)
24
         order by qtypeorder asc
24
         order by qtypeorder asc
25
     </select>
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
     <select id="findUseModule" resultType="java.lang.String">
40
     <select id="findUseModule" resultType="java.lang.String">
29
         SELECT CONCAT((select (case when count(*)>0 then '试题' else '' end) from t_question where qtypeid=#{qtypeid})
41
         SELECT CONCAT((select (case when count(*)>0 then '试题' else '' end) from t_question where qtypeid=#{qtypeid})

Loading…
Cancel
Save