b9411514
陈杰
first
|
1
2
3
4
|
<?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.UniversityConsultMapper">
|
123dbb81
徐泉
研学代码提交
|
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<resultMap id="ListMap" type="com.sincere.student.model.Consult">
<result column="id" property="id" />
<result column="universityId" property="universityId" />
<result column="name" property="name" />
<result column="code" property="code" />
<result column="sort" property="sort" />
<result column="img_url" property="imgUrl" />
<result column="status" property="status" />
</resultMap>
<select id="getListCount" parameterType="com.sincere.student.dto.ConsultSearchDto" resultType="java.lang.Integer">
select count(DISTINCT c.id) from university_consult c
join university_info info on c.university_id = info.id
join university_relate_major r on info.id = r.university_id
|
b9411514
陈杰
first
|
19
|
join university_major m on m.id = r.major_id
|
123dbb81
徐泉
研学代码提交
|
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
|
<where>
<if test="columnType > 0">
and c.column_type = #{columnType}
</if>
<if test="columnType == 0">
and c.column_type = (select top 1 id from university_column_type where type = 2 order by sort)
</if>
<if test="columnType == -1">
and 1=1
</if>
<if test="province != null and province != '' ">
and info.province = #{province}
</if>
<if test="city != null and city != '' ">
and info.city = #{city}
</if>
<if test="universityName != null and universityName != ''">
and info.name like #{universityName}
</if>
<if test="majorName != null and majorName != ''">
and m.major like #{majorName}
</if>
<if test="status == 1">
and c.status = 1
</if>
<if test="status != 1">
and 1 = 1
</if>
</where>
</select>
<select id="getList" parameterType="com.sincere.student.dto.ConsultSearchDto" resultMap="ListMap">
select DISTINCT c.id , info.id as universityId , c.img_url ,c.sort , info.name , info.code ,c.status from university_consult c
join university_info info on c.university_id = info.id
join university_relate_major r on info.id = r.university_id
|
b9411514
陈杰
first
|
55
|
join university_major m on m.id = r.major_id
|
123dbb81
徐泉
研学代码提交
|
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
|
<where>
<if test="columnType > 0">
and c.column_type = #{columnType}
</if>
<if test="columnType == 0">
and c.column_type = (select top 1 id from university_column_type where type = 2 order by sort)
</if>
<if test="columnType == -1">
and 1=1
</if>
<if test="province != null and province != '' ">
and info.province = #{province}
</if>
<if test="city != null and city != '' ">
and info.city = #{city}
</if>
<if test="universityName != null and universityName != ''">
and info.name like #{universityName}
</if>
<if test="majorName != null and majorName != ''">
and m.major like #{majorName}
</if>
<if test="status == 1">
and c.status = 1
</if>
<if test="status != 1">
and 1 = 1
</if>
</where>
order by c.sort
</select>
<select id="getColumnListCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
select count(DISTINCT c.id) from university_consult c
join university_info info on c.university_id = info.id
where c.column_type = #{columnType} and c.status = 1
</select>
|
b9411514
陈杰
first
|
94
|
<select id="getColumnList" parameterType="java.lang.Integer" resultMap="ListMap">
|
123dbb81
徐泉
研学代码提交
|
95
96
97
98
99
|
select DISTINCT c.id , info.id as universityId , c.img_url ,c.sort , info.name , info.code from university_consult c
join university_info info on c.university_id = info.id
where c.column_type = #{columnType} and c.status = 1
order by c.sort
</select>
|
fafdccdc
陈杰
bug 修复
|
100
|
|
123dbb81
徐泉
研学代码提交
|
101
102
103
104
105
|
<resultMap id="DetailMap" type="com.sincere.student.model.Consult">
<result column="id" property="id" />
<result column="universityId" property="universityId" />
<result column="name" property="name" />
<result column="code" property="code" />
|
b9411514
陈杰
first
|
106
|
<result column="sort" property="sort" />
|
123dbb81
徐泉
研学代码提交
|
107
108
109
110
111
112
113
114
|
<result column="img_url" property="imgUrl" />
<result column="column_type" property="columnType" />
<result column="video_url" property="videoUrl" />
<result column="context" property="context" />
<result column="phone" property="phone" />
</resultMap>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="DetailMap">
select * from university_consult c
|
b9411514
陈杰
first
|
115
|
join university_info info on c.university_id = info.id
|
123dbb81
徐泉
研学代码提交
|
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
where c.id =#{id}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from university_consult
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.sincere.student.model.UniversityConsult" useGeneratedKeys="true" keyProperty="id">
insert into university_consult (university_id, column_type,
video_url, context, img_url,
create_time, sort,status)
values (#{universityId,jdbcType=INTEGER}, #{columnType,jdbcType=INTEGER},
#{videoUrl,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR},
GETDATE(), #{sort,jdbcType=INTEGER},#{status})
</insert>
|
b9411514
陈杰
first
|
131
|
|
123dbb81
徐泉
研学代码提交
|
132
133
134
135
136
|
<update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.UniversityConsult">
update university_consult
<set>
<if test="universityId != null">
university_id = #{universityId,jdbcType=INTEGER},
|
cdb1817b
陈杰
bug 修复
|
137
|
</if>
|
123dbb81
徐泉
研学代码提交
|
138
139
140
141
142
143
144
145
146
147
148
149
|
<if test="columnType != null">
column_type = #{columnType,jdbcType=INTEGER},
</if>
<if test="videoUrl != null">
video_url = #{videoUrl,jdbcType=VARCHAR},
</if>
<if test="context != null">
context = #{context,jdbcType=VARCHAR},
</if>
<if test="imgUrl != null">
img_url = #{imgUrl,jdbcType=VARCHAR},
</if>
|
b9411514
陈杰
first
|
150
|
<if test="createTime != null">
|
123dbb81
徐泉
研学代码提交
|
151
152
153
154
155
156
157
158
159
160
|
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
|
b9411514
陈杰
first
|
|
|