Blame view

src/main/resources/mapper/SysYxSchoolConsultMapper.xml 8.37 KB
e5f98c16   徐泉   招生咨询会
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?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.SysYxSchoolConsultMapper">
  <resultMap id="BaseResultMap" type="com.sincere.student.model.yx.SysYxSchoolConsult">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="school_id" jdbcType="INTEGER" property="schoolId" />
    <result column="title_desc" jdbcType="VARCHAR" property="titleDesc" />
    <result column="video_url" jdbcType="VARCHAR" property="videoUrl" />
    <result column="context" jdbcType="VARCHAR" property="context" />
    <result column="img_url" jdbcType="VARCHAR" property="imgUrl" />
    <result column="sort" jdbcType="INTEGER" property="sort" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="read_number" jdbcType="INTEGER" property="readNumber" />
    <result column="background" jdbcType="VARCHAR" property="background" />
    <result column="model_list" jdbcType="VARCHAR" property="modelList" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
21d1bd0f   徐泉   招生咨询会
17
18
19
    <result column="province" jdbcType="VARCHAR" property="province" />
    <result column="city" jdbcType="VARCHAR" property="city" />
    <result column="area" jdbcType="VARCHAR" property="area" />
e5f98c16   徐泉   招生咨询会
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
  </resultMap>
  <sql id="Base_Column_List">
    id, school_id, title_desc, video_url, context, img_url, sort, status, read_number,
    background, model_list,create_time
  </sql>
  <sql id="Blob_Column_List">
    model_list
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from sys_yx_school_consult
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from sys_yx_school_consult
    where id = #{id,jdbcType=INTEGER}
  </delete>

  <select id="selectList" parameterType="com.sincere.student.dto.yx.AddYxSchoolConsultVo" resultMap="BaseResultMap">
    select
    id, school_id, title_desc, video_url, context, img_url, sort, status, read_number,background,create_time
    from sys_yx_school_consult
    <where>
      <if test="schoolId != null">
        and school_id = #{schoolId}
      </if>
      <if test="titleDesc != null and titleDesc !=''">
        and title_desc = #{titleDesc}
      </if>
    </where>
  </select>

21d1bd0f   徐泉   招生咨询会
53
  <select id="getListCount" parameterType="com.sincere.student.dto.yx.AddYxSchoolConsultVo" resultType="java.lang.Integer">
e5f98c16   徐泉   招生咨询会
54
55
56
57
58
59
60
    select
      count(1)
    from sys_yx_school_consult
    <where>
      <if test="schoolId != null">
        and school_id = #{schoolId}
      </if>
21d1bd0f   徐泉   招生咨询会
61
      <if test="titleDesc != null and titleDesc !=''">
e5f98c16   徐泉   招生咨询会
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
        and title_desc like #{titleDesc}
      </if>
    </where>
  </select>

  <insert id="insertSelective" parameterType="com.sincere.student.model.yx.SysYxSchoolConsult">
    insert into sys_yx_school_consult
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="schoolId != null">
        school_id,
      </if>
      <if test="titleDesc != null">
        title_desc,
      </if>
      <if test="videoUrl != null">
        video_url,
      </if>
      <if test="context != null">
        context,
      </if>
      <if test="imgUrl != null">
        img_url,
      </if>
      <if test="sort != null">
        sort,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="readNumber != null">
        read_number,
      </if>
      <if test="background != null">
        background,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="modelList != null">
        model_list,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="schoolId != null">
        #{schoolId,jdbcType=INTEGER},
      </if>
      <if test="titleDesc != null">
        #{titleDesc,jdbcType=VARCHAR},
      </if>
      <if test="videoUrl != null">
        #{videoUrl,jdbcType=VARCHAR},
      </if>
      <if test="context != null">
        #{context,jdbcType=VARCHAR},
      </if>
      <if test="imgUrl != null">
        #{imgUrl,jdbcType=VARCHAR},
      </if>
      <if test="sort != null">
        #{sort,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
      <if test="readNumber != null">
        #{readNumber,jdbcType=INTEGER},
      </if>
      <if test="background != null">
        #{background,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modelList != null">
        #{modelList,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.yx.SysYxSchoolConsult">
    update sys_yx_school_consult
    <set>
      <if test="schoolId != null">
        school_id = #{schoolId,jdbcType=INTEGER},
      </if>
      <if test="titleDesc != null">
        title_desc = #{titleDesc,jdbcType=VARCHAR},
      </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>
      <if test="sort != null">
        sort = #{sort,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=INTEGER},
      </if>
      <if test="readNumber != null">
        read_number = #{readNumber,jdbcType=INTEGER},
      </if>
      <if test="background != null">
        background = #{background,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modelList != null">
        model_list = #{modelList,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>

  <select id="countSort" resultMap="BaseResultMap">
    select * from university_consult where
    <choose>
      <when test="flag ==1">
        sort >= #{sort}
      </when>
      <when test="flag ==2">
        sort >= #{sort} and id != #{id}
      </when>
    </choose>
    order by sort asc
  </select>

  <update id="updateSort" parameterType="com.sincere.student.model.yx.SysYxSchoolConsult">
    update university_consult set sort = #{sort} where id=#{id}
  </update>
21d1bd0f   徐泉   招生咨询会
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250


  <select id="countConsultList" parameterType="com.sincere.student.dto.yx.QueryCountYxSchoolConsult" resultMap="BaseResultMap">
    select
      ssc.*,ss.province,ss.city,ss.area
    from sys_yx_school_consult ssc
    left join sys_yx_school ss ON ssc.school_id = ss.id
    <where>
      <if test="province != null and province !=''">
        and ss.provnice = #{provnice}
      </if>
      <if test="city != null and city !=''">
        and ss.city = #{city}
      </if>
      <if test="area != null and area !=''">
        and ss.area = #{area}
      </if>
      <if test="startTime != null and startTime.trim() !=''">
        <![CDATA[ and ssc.create_time >= #{startTime} ]]>
      </if>
      <if test="endTime != null and endTime.trim() !=''">
        <![CDATA[ and ssc.create_time < #{endTime} ]]>
      </if>
    </where>
  </select>

<!--  <select id="getCountConsult" parameterType="com.sincere.student.dto.yx.QueryCountYxSchoolConsult" resultType="java.lang.Integer">-->
<!--    select-->
<!--    ssc.*,ss.province,ss.city,ss.area-->
<!--    from sys_yx_school_consult ssc-->
<!--    left join sys_yx_school ss ON ssc.school_id = ss.id-->
<!--    <where>-->
<!--      <if test="province != null and province !=''">-->
<!--        and ss.provnice = #{provnice}-->
<!--      </if>-->
<!--      <if test="city != null and city !=''">-->
<!--        and ss.city = #{city}-->
<!--      </if>-->
<!--      <if test="area != null and area !=''">-->
<!--        and ss.area = #{area}-->
<!--      </if>-->
<!--      <if test="startTime != null and startTime.trim() !=''">-->
<!--        <![CDATA[ and ssc.create_time >= #{startTime} ]]>-->
<!--      </if>-->
<!--      <if test="endTime != null and endTime.trim() !=''">-->
<!--        <![CDATA[ and ssc.create_time < #{endTime} ]]>-->
<!--      </if>-->
<!--    </where>-->
<!--  </select>-->
e5f98c16   徐泉   招生咨询会
251
</mapper>