Browse Source

知识点搜索试题

tags/正式3.14.1
王宁 3 months ago
parent
commit
c3cbd4cf98

+ 18
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/controller/question/QuestionController.java View File

6
 import com.xhkjedu.sstudy.model.question.TQuestion;
6
 import com.xhkjedu.sstudy.model.question.TQuestion;
7
 import com.xhkjedu.sstudy.model.question.TQuestionCollect;
7
 import com.xhkjedu.sstudy.model.question.TQuestionCollect;
8
 import com.xhkjedu.sstudy.model.subjectbook.TDirector;
8
 import com.xhkjedu.sstudy.model.subjectbook.TDirector;
9
+import com.xhkjedu.sstudy.model.subjectbook.TPoint;
9
 import com.xhkjedu.sstudy.service.question.QuestionService;
10
 import com.xhkjedu.sstudy.service.question.QuestionService;
10
 import com.xhkjedu.sstudy.service.subjectbook.DirectorService;
11
 import com.xhkjedu.sstudy.service.subjectbook.DirectorService;
12
+import com.xhkjedu.sstudy.service.subjectbook.PointService;
11
 import com.xhkjedu.sstudy.vo.question.QuestionCollectVo;
13
 import com.xhkjedu.sstudy.vo.question.QuestionCollectVo;
12
 import com.xhkjedu.sstudy.vo.question.QuestionVo;
14
 import com.xhkjedu.sstudy.vo.question.QuestionVo;
13
 import com.xhkjedu.sstudy.vo.system.CollectVo;
15
 import com.xhkjedu.sstudy.vo.system.CollectVo;
38
     private QuestionService tQuestionService;
40
     private QuestionService tQuestionService;
39
     @Resource
41
     @Resource
40
     private DirectorService directorService;
42
     private DirectorService directorService;
43
+    @Resource
44
+    private PointService pointService;
41
 
45
 
42
     @PostMapping("/update_state")
46
     @PostMapping("/update_state")
43
     @Action("试题管理-修改状态")
47
     @Action("试题管理-修改状态")
112
         Integer page = tQuestion.getPage();
116
         Integer page = tQuestion.getPage();
113
         Integer pageSize = tQuestion.getPageSize();
117
         Integer pageSize = tQuestion.getPageSize();
114
         N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1});
118
         N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1});
119
+        //获取所选知识点信息
120
+        if(N_Utils.isNotEmpty(tQuestion.getPointid()) && !"0".equals(tQuestion.getPointid())){
121
+            TPoint point = pointService.getPointInfoById(tQuestion.getPointid());
122
+
123
+            if(point.getSonnum() == 0){
124
+                //没有子知识点,属于叶子节点
125
+                tQuestion.setPointLeaf(1);
126
+            }else{
127
+                //说明有子知识点,直接获取
128
+                tQuestion.setPointLeaf(0);
129
+                tQuestion.setPointall(point.getPointall());
130
+            }
131
+        }
132
+
115
         PageHelper.startPage(page, pageSize);
133
         PageHelper.startPage(page, pageSize);
116
         tQuestion.setLsbid(null);
134
         tQuestion.setLsbid(null);
117
         List<Map<String, Object>> list = tQuestionService.listForSelect(tQuestion);
135
         List<Map<String, Object>> list = tQuestionService.listForSelect(tQuestion);

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

24
 
24
 
25
     //查找使用知识点的模块
25
     //查找使用知识点的模块
26
     String findUseModule(String pointid);
26
     String findUseModule(String pointid);
27
+
28
+    //根据知识点ID获取知识点信息
29
+    TPoint getPointInfoById(@Param("pointid")String pointid);
27
 }
30
 }

+ 6
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/model/question/TQuestion.java View File

135
 
135
 
136
     @Transient
136
     @Transient
137
     private String directorall;//所有层章节拼接
137
     private String directorall;//所有层章节拼接
138
+
139
+    @Transient
140
+    private Integer pointLeaf;//知识点是否是叶子节点0不是1是
141
+
142
+    @Transient
143
+    private String pointall;//所有层知识点拼接
138
 }
144
 }

+ 6
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/model/subjectbook/TPoint.java View File

31
     //知识点所属层级
31
     //知识点所属层级
32
     private Integer pointlevel;
32
     private Integer pointlevel;
33
 
33
 
34
+    //所有层级知识点;拼接
35
+    private String pointall;
36
+
34
     //创建人
37
     //创建人
35
     private Integer createid;
38
     private Integer createid;
36
 
39
 
50
     private String createformat;
53
     private String createformat;
51
 
54
 
52
     private List<TPoint> children = new ArrayList<>();
55
     private List<TPoint> children = new ArrayList<>();
56
+
57
+    @Transient
58
+    private Integer sonnum;//子知识点数量
53
 }
59
 }

+ 5
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/service/subjectbook/PointService.java View File

105
         }
105
         }
106
         return useModule;
106
         return useModule;
107
     }
107
     }
108
+
109
+    //获取知识点详情
110
+    public TPoint getPointInfoById(String pointid) {
111
+        return pointMapper.getPointInfoById(pointid);
112
+    }
108
 }
113
 }
109
 
114
 

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

208
         </if>
208
         </if>
209
         left join t_question_director qd on q.questionid=qd.questionid
209
         left join t_question_director qd on q.questionid=qd.questionid
210
         left join t_director d on qd.directorid=d.directorid
210
         left join t_director d on qd.directorid=d.directorid
211
+        <if test="question.pointid!=null and question.pointid!='0'.toString() and question.pointid!='' and question.pointLeaf==0">
212
+            left join t_point p on qp.pointid = p.pointid
213
+        </if>
211
         where d.disabled=0 and q.qstate=1
214
         where d.disabled=0 and q.qstate=1
212
         <if test="question.lsbid!=null and question.lsbid!='0'.toString() and question.lsbid!=''">
215
         <if test="question.lsbid!=null and question.lsbid!='0'.toString() and question.lsbid!=''">
213
             and qd.lsbid=#{question.lsbid}
216
             and qd.lsbid=#{question.lsbid}
221
         <if test="question.subjectid!=null and question.subjectid!='0'.toString() and question.subjectid!=''">
224
         <if test="question.subjectid!=null and question.subjectid!='0'.toString() and question.subjectid!=''">
222
             and q.subjectid=#{question.subjectid}
225
             and q.subjectid=#{question.subjectid}
223
         </if>
226
         </if>
224
-        <if test="question.pointid!=null and question.pointid!='0'.toString() and question.pointid!=''">
227
+        <if test="question.pointid!=null and question.pointid!='0'.toString() and question.pointid!='' and question.pointLeaf==1">
225
             and qp.pointid=#{question.pointid}
228
             and qp.pointid=#{question.pointid}
226
         </if>
229
         </if>
230
+        <if test="question.pointid!=null and question.pointid!='0'.toString() and question.pointid!='' and question.pointLeaf==0">
231
+            and p.pointall like concat('%',#{question.pointall},'%')
232
+        </if>
227
         <if test="question.hashear!=null and question.hashear == 1">
233
         <if test="question.hashear!=null and question.hashear == 1">
228
             and q.hashear=1
234
             and q.hashear=1
229
         </if>
235
         </if>

+ 7
- 0
sstudy/src/main/resources/mapper/subjectbook/PointMapper.xml View File

35
         )
35
         )
36
     </select>
36
     </select>
37
 
37
 
38
+    <!--根据知识点ID获取知识点信息-->
39
+    <select id="getPointInfoById" resultType="com.xhkjedu.sstudy.model.subjectbook.TPoint">
40
+        select pointid,pointname,pointall,
41
+         (select count(*) from t_point p where p.pointpid=#{pointid}) sonnum
42
+        from t_point where pointid=#{pointid}
43
+    </select>
44
+
38
 </mapper>
45
 </mapper>

Loading…
Cancel
Save