Browse Source

查询指定专业领域类别及以下类别资源

lamphua 2 months ago
parent
commit
12aa3318c9

+ 11
- 0
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcResourceController.java View File

@@ -44,6 +44,17 @@ public class CmcResourceController extends BaseController
44 44
         return getDataTable(list);
45 45
     }
46 46
 
47
+    /**
48
+     * 查询学习资料列表
49
+     */
50
+    @GetMapping("/getListBelow")
51
+    public TableDataInfo listByFieldId(CmcResource cmcResource)
52
+    {
53
+        startPage();
54
+        List<CmcResource> list = cmcResourceService.selectCmcResourceListBelow(cmcResource);
55
+        return getDataTable(list);
56
+    }
57
+
47 58
     /**
48 59
      * 导出学习资料列表
49 60
      */

+ 8
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/mapper/CmcResourceMapper.java View File

@@ -19,6 +19,14 @@ public interface CmcResourceMapper
19 19
      */
20 20
     public CmcResource selectCmcResourceByResourceId(Integer resourceId);
21 21
 
22
+    /**
23
+     * 查询学习资料
24
+     *
25
+     * @param cmcResource 学习资料
26
+     * @return 学习资料
27
+     */
28
+    public List<CmcResource> selectCmcResourceListBelow(CmcResource cmcResource);
29
+
22 30
     /**
23 31
      * 查询学习资料列表
24 32
      * 

+ 8
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/service/ICmcResourceService.java View File

@@ -19,6 +19,14 @@ public interface ICmcResourceService
19 19
      */
20 20
     public CmcResource selectCmcResourceByResourceId(Integer resourceId);
21 21
 
22
+    /**
23
+     * 查询学习资料
24
+     *
25
+     * @param cmcResource 学习资料
26
+     * @return 学习资料
27
+     */
28
+    public List<CmcResource> selectCmcResourceListBelow(CmcResource cmcResource);
29
+
22 30
     /**
23 31
      * 查询学习资料列表
24 32
      * 

+ 12
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/service/impl/CmcResourceServiceImpl.java View File

@@ -31,6 +31,18 @@ public class CmcResourceServiceImpl implements ICmcResourceService
31 31
         return cmcResourceMapper.selectCmcResourceByResourceId(resourceId);
32 32
     }
33 33
 
34
+    /**
35
+     * 查询学习资料
36
+     *
37
+     * @param cmcResource 学习资料
38
+     * @return 学习资料
39
+     */
40
+    @Override
41
+    public List<CmcResource> selectCmcResourceListBelow(CmcResource cmcResource)
42
+    {
43
+        return cmcResourceMapper.selectCmcResourceListBelow(cmcResource);
44
+    }
45
+
34 46
     /**
35 47
      * 查询学习资料列表
36 48
      * 

+ 27
- 1
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcResourceMapper.xml View File

@@ -54,7 +54,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
54 54
             <if test="hours != null "> and r.hours = #{hours}</if>
55 55
         </where>
56 56
     </select>
57
-    
57
+
58
+    <select id="selectCmcResourceListBelow" parameterType="CmcResource" resultMap="CmcResourceResult">
59
+        SELECT r.resource_id, r.uploader, r.upload_dept, r.title, r.source_path, r.type, r.field_id, r.upload_time, r.hours
60
+        FROM cmc_resource AS r
61
+        LEFT JOIN sys_user AS u ON u.user_id = r.uploader
62
+        LEFT JOIN sys_dept AS d ON d.dept_id = r.upload_dept
63
+        RIGHT JOIN (
64
+        SELECT rf2.field_id FROM
65
+        ( SELECT rf1.field_id AS sub_field_id, rf1.parent_id AS sub_parent_id, rf0.field_id, rf0.parent_id
66
+        FROM cmc_resource_field AS rf0
67
+        LEFT JOIN cmc_resource_field AS rf1 ON rf1.parent_id = rf0.field_id
68
+        WHERE rf0.field_id = #{fieldId} OR rf1.field_id = #{fieldId} ) AS rf3
69
+        RIGHT JOIN cmc_resource_field AS rf2 ON rf2.parent_id = rf3.sub_field_id
70
+        WHERE rf3.sub_field_id = #{fieldId} OR rf2.field_id = #{fieldId} OR rf3.field_id = #{fieldId}
71
+        ) as tree on tree.field_id = r.field_id
72
+        <where>
73
+            r.resource_id is not null
74
+            <if test="uploader != null "> and r.uploader = #{uploader}</if>
75
+            <if test="uploadDept != null "> and r.upload_dept = #{uploadDept}</if>
76
+            <if test="title != null  and title != ''"> and r.title like concat('%', #{title}, '%')</if>
77
+            <if test="sourcePath != null  and sourcePath != ''"> and r.source_path = #{sourcePath}</if>
78
+            <if test="type != null  and type != ''"> and r.type = #{type}</if>
79
+            <if test="uploadTime != null "> and r.upload_time = #{uploadTime}</if>
80
+            <if test="hours != null "> and r.hours = #{hours}</if>
81
+        </where>
82
+    </select>
83
+
58 84
     <select id="selectCmcResourceByResourceId" parameterType="Integer" resultMap="CmcResourceResult">
59 85
         <include refid="selectCmcResourceVo"/>
60 86
         where resource_id = #{resourceId}

Loading…
Cancel
Save