|
@@ -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>
|