Parcourir la source

学习资料关联培训记录id

lamphua il y a 1 mois
Parent
révision
797992a4bf

+ 25
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/domain/CmcResource.java Voir le fichier

@@ -22,6 +22,12 @@ public class CmcResource extends BaseEntity
22 22
     /** 资料id */
23 23
     private Integer resourceId;
24 24
 
25
+    /** 培训名称 */
26
+    private Integer trainId;
27
+    private CmcTrain train;
28
+    @Excel(name = "培训名称")
29
+    private String name;
30
+
25 31
     /** 上传人 */
26 32
     private Long uploader;
27 33
     @Excel(name = "上传人")
@@ -181,6 +187,25 @@ public class CmcResource extends BaseEntity
181 187
     {
182 188
         return resourceField;
183 189
     }
190
+    public void setTrainId(Integer trainId)
191
+    {
192
+        this.trainId = trainId;
193
+    }
194
+
195
+    public Integer getTrainId()
196
+    {
197
+        return trainId;
198
+    }
199
+    public void setTrain(CmcTrain train)
200
+    {
201
+        this.train = train;
202
+        this.name = train == null ? "" : train.getName();
203
+    }
204
+
205
+    public CmcTrain getTrain()
206
+    {
207
+        return train;
208
+    }
184 209
 
185 210
     @Override
186 211
     public String toString() {

+ 13
- 1
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcResourceMapper.xml Voir le fichier

@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
6 6
     
7 7
     <resultMap type="CmcResource" id="CmcResourceResult">
8 8
         <result property="resourceId"    column="resource_id"    />
9
+        <result property="trainId"    column="train_id"    />
9 10
         <result property="uploader"    column="uploader"    />
10 11
         <result property="uploadDept"    column="upload_dept"    />
11 12
         <result property="title"    column="title"    />
@@ -17,6 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
17 18
         <association property="uploadUser"    javaType="SysUser"         resultMap="UploadUserResult" />
18 19
         <association property="dept"    javaType="SysDept"         resultMap="SysDeptResult" />
19 20
         <association property="resourceField"    javaType="CmcResourceField"         resultMap="CmcResourceFieldResult" />
21
+        <association property="train"    javaType="CmcTrain"         resultMap="CmcTrainResult" />
20 22
     </resultMap>
21 23
 
22 24
     <resultMap type="SysUser" id="UploadUserResult">
@@ -34,16 +36,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
34 36
         <result property="field"    column="field"    />
35 37
     </resultMap>
36 38
 
39
+    <resultMap type="CmcTrain" id="CmcTrainResult">
40
+        <result property="trainId"    column="train_id"    />
41
+        <result property="name"    column="name"    />
42
+    </resultMap>
43
+
37 44
     <sql id="selectCmcResourceVo">
38
-        select r.resource_id, r.uploader, r.upload_dept, r.title, r.source_path, r.type, r.field_id, rf.field, r.upload_time, r.hours from cmc_resource as r
45
+        select r.resource_id, r.train_id, r.uploader, r.upload_dept, r.title, r.source_path, r.type, r.field_id, rf.field, r.upload_time, r.hours, t.name from cmc_resource as r
39 46
         left join sys_user as u on u.user_id = r.uploader
40 47
         left join sys_dept as d on d.dept_id = r.upload_dept
41 48
         left join cmc_resource_field as rf on rf.field_id = r.field_id
49
+        left join cmc_train as t on t.train_id = r.train_id
42 50
     </sql>
43 51
 
44 52
     <select id="selectCmcResourceList" parameterType="CmcResource" resultMap="CmcResourceResult">
45 53
         <include refid="selectCmcResourceVo"/>
46 54
         <where>  
55
+            <if test="trainId != null "> and r.train_id = #{trainId}</if>
47 56
             <if test="uploader != null "> and r.uploader = #{uploader}</if>
48 57
             <if test="uploadDept != null "> and r.upload_dept = #{uploadDept}</if>
49 58
             <if test="title != null  and title != ''"> and r.title like concat('%', #{title}, '%')</if>
@@ -97,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
97 106
             <if test="fieldId != null">field_id,</if>
98 107
             <if test="uploadTime != null">upload_time,</if>
99 108
             <if test="hours != null">hours,</if>
109
+            <if test="trainId != null">train_id,</if>
100 110
          </trim>
101 111
         <trim prefix="values (" suffix=")" suffixOverrides=",">
102 112
             <if test="uploader != null">#{uploader},</if>
@@ -107,6 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
107 117
             <if test="fieldId != null">#{fieldId},</if>
108 118
             <if test="uploadTime != null">#{uploadTime},</if>
109 119
             <if test="hours != null">#{hours},</if>
120
+            <if test="trainId != null">#{trainId},</if>
110 121
          </trim>
111 122
     </insert>
112 123
 
@@ -121,6 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
121 132
             <if test="fieldId != null">field_id = #{fieldId},</if>
122 133
             <if test="uploadTime != null">upload_time = #{uploadTime},</if>
123 134
             <if test="hours != null">hours = #{hours},</if>
135
+            <if test="trainId != null">train_id = #{trainId},</if>
124 136
         </trim>
125 137
         where resource_id = #{resourceId}
126 138
     </update>

Loading…
Annuler
Enregistrer