VideoMapper.xml
3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.sincere.student.mapper.VideoMapper">
<resultMap id="VideoMap" type="com.sincere.student.model.Video">
<id column="id" property="id"/>
<result column="university_id" property="universityId"/>
<result column="column_type" property="columnType"/>
<result column="video_url" property="videoUrl"/>
<result column="sort" property="sort"/>
<result column="create_time" property="createTime"/>
<result column="name" property="universityName"/>
<result column="code" property="universityCode"/>
<result column="status" property="status" />
</resultMap>
<select id="getById" parameterType="java.lang.Integer" resultMap="VideoMap">
select * from university_video where id = #{id}
</select>
<select id="getListCount" parameterType="com.sincere.student.dto.VideoSearchDto" resultType="java.lang.Integer">
select count(0) from university_video v join university_info info on v.university_id = info.id
<where>
<if test="columnTypeId != 0">
and v.column_type = #{columnTypeId}
</if>
<if test="universityName == 0">
and 1 = 1
</if>
<if test="universityName != null and universityName != ''">
and info.name like #{universityName}
</if>
<if test="status == 1">
and status = 1
</if>
<if test="status != 1">
and 1 = 1
</if>
</where>
</select>
<select id="getList" parameterType="com.sincere.student.dto.ArticleSearchDto" resultMap="VideoMap">
select v.*,info.name,info.code from university_video v join university_info info on v.university_id = info.id
<where>
<if test="columnTypeId != 0">
and v.column_type = #{columnTypeId}
</if>
<if test="universityName != null and universityName != ''">
and info.name like #{universityName}
</if>
<if test="status == 1">
and status = 1
</if>
<if test="status != 1">
and 1 = 1
</if>
</where>
order by sort
</select>
<insert id="create" parameterType="com.sincere.student.model.Video" >
insert into university_video (column_type,university_id,sort,video_url,create_time,status)
values (#{columnType},#{universityId},#{sort},#{videoUrl},GETDATE(),#{status})
</insert>
<delete id="delete" parameterType="java.lang.Integer">
delete university_video where id = #{id}
</delete>
<update id="update" parameterType="com.sincere.student.model.Video">
update university_video
<trim prefix="set" suffixOverrides=",">
<if test="videoUrl!=null">
video_url=#{videoUrl},
</if>
<if test="columnType!=0">
column_type=#{columnType},
</if>
<if test="universityName!=null">
university_name=#{universityName},
</if>
<if test="universityId!=0">
university_id=#{universityId},
</if>
<if test="sort!=0">
sort=#{sort},
</if>
<if test="status!=-1">
status=#{status},
</if>
</trim>
where id = #{id}
</update>
</mapper>