Blame view

src/main/resources/mapper/UniversitySubmitFileMapper.xml 6.63 KB
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.UniversitySubmitFileMapper">

123dbb81   徐泉   研学代码提交
5
6
7
8
9
10
11
12
13
14
15
16
  <resultMap id="LineMap" type="com.sincere.student.dto.submit.SubmitLine">
    <result column="id"  property="id" />
    <result column="title"  property="title" />
    <collection property="universityList" ofType="com.sincere.student.dto.submit.SubmitUniv">
      <result column="universityId"  property="universityId" />
      <result column="name"  property="universityName" />
      <collection property="majorList" ofType="com.sincere.student.dto.submit.SubmitMajor">
        <result column="major"  property="major" />
        <result column="grade"  property="grade" />
        <result column="enroll_number"  property="enrollNumber" />
        <result column="rank"  property="rank" />
      </collection>
b9411514   陈杰   first
17
    </collection>
123dbb81   徐泉   研学代码提交
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
  </resultMap>

  <select id="getAppListCount" parameterType="com.sincere.student.dto.PointSearchDto" resultType="java.lang.Integer">
    select count(DISTINCT(sf.id))
    from university_submit_file sf join university_point p on sf.id = p.submit_id
    join university_info info on p.university_id = info.id
    join university_major m on p.major_id = m.id
    <where>
      <if test="submitId != 0">
        and sf.id = #{submitId}
      </if>
      <if test="universityName != null">
        and info.name like #{universityName}
      </if>
      <if test="province != null">
        and info.province = #{province}
      </if>
      <if test="city != null">
        and info.city = #{city}
      </if>
      <if test="majorName != null">
        and m.major like #{majorName}
      </if>
      <if test="point != 0 ">
        <![CDATA[ and p.grade > #{point}-5 and p.grade < #{point} +5  ]]>
      </if>
      <if test="rank != 0 ">
b9411514   陈杰   first
45
        <![CDATA[ and p.rank > #{rank}-100 and p.rank < #{rank} +100  ]]>
123dbb81   徐泉   研学代码提交
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
      </if>
    </where>
  </select>

  <select id="getAppList" parameterType="com.sincere.student.dto.PointSearchDto" resultMap="LineMap">
    select sf.id , sf.title ,info.id as universityId , info.name , m.major , p.enroll_number , p.rank , p.grade
    from university_submit_file sf join university_point p on sf.id = p.submit_id
    join university_info info on p.university_id = info.id
    join university_major m on p.major_id = m.id
    <where>
        <if test="submitId != 0">
          and sf.id = #{submitId}
        </if>
        <if test="universityName != null">
          and info.name like #{universityName}
        </if>
        <if test="province != null">
          and info.province = #{province}
        </if>
        <if test="city != null">
          and info.city = #{city}
        </if>
        <if test="majorName != null">
          and m.major like #{majorName}
        </if>
      <if test="point != 0 ">
        <![CDATA[ and p.grade >= #{point}-5 and p.grade <= #{point} +5  ]]>
      </if>
b9411514   陈杰   first
74
      <if test="rank != 0 ">
123dbb81   徐泉   研学代码提交
75
76
77
78
79
80
81
82
        <![CDATA[ and p.rank >= #{rank}-100 and p.rank <= #{rank} +100  ]]>
      </if>
    </where>
    order by sf.id
  </select>

  <resultMap id="BaseResultMap" type="com.sincere.student.model.SubmitFile">
    <id column="id" jdbcType="INTEGER" property="id" />
b9411514   陈杰   first
83
    <result column="title" jdbcType="VARCHAR" property="title" />
123dbb81   徐泉   研学代码提交
84
85
86
87
88
89
90
91
    <result column="year" jdbcType="VARCHAR" property="year" />
    <result column="sort" jdbcType="INTEGER" property="sort" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>

  <select id="getListCount" parameterType="com.sincere.student.dto.MessageSearchDto" resultType="java.lang.Integer">
    select count(0) from university_submit_file
    <where>
b9411514   陈杰   first
92
      <if test="search != null">
123dbb81   徐泉   研学代码提交
93
94
95
96
97
98
99
100
101
        title like #{search}
      </if>
    </where>
  </select>

  <select id="getList" parameterType="com.sincere.student.dto.MessageSearchDto" resultMap="BaseResultMap">
    select * from university_submit_file
    <where>
      <if test="search != null">
b9411514   陈杰   first
102
        title like #{search}
2f3069be   陈杰   bug 修复
103
      </if>
123dbb81   徐泉   研学代码提交
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
    </where>
    order by sort
  </select>

  <sql id="Base_Column_List">
    id, title, year, sort, create_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from university_submit_file
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from university_submit_file
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.sincere.student.model.SubmitFile" useGeneratedKeys="true" keyProperty="id">
    insert into university_submit_file (title, year,
      sort, create_time)
    values (#{title,jdbcType=VARCHAR}, #{year,jdbcType=VARCHAR},
      #{sort,jdbcType=INTEGER}, GETDATE())
  </insert>
  <insert id="insertSelective" parameterType="com.sincere.student.model.SubmitFile">
    insert into university_submit_file
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="title != null">
        title,
      </if>
      <if test="year != null">
        year,
      </if>
      <if test="sort != null">
        sort,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="title != null">
        #{title,jdbcType=VARCHAR},
      </if>
      <if test="year != null">
        #{year,jdbcType=VARCHAR},
      </if>
      <if test="sort != null">
        #{sort,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.SubmitFile">
    update university_submit_file
    <set>
      <if test="title != null">
        title = #{title,jdbcType=VARCHAR},
      </if>
      <if test="year != null">
        year = #{year,jdbcType=VARCHAR},
      </if>
      <if test="sort != null">
        sort = #{sort,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
b9411514   陈杰   first
177
        create_time = #{createTime,jdbcType=TIMESTAMP},
b9411514   陈杰   first
178
      </if>
123dbb81   徐泉   研学代码提交
179
180
181
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
b9411514   陈杰   first
182
  <update id="updateByPrimaryKey" parameterType="com.sincere.student.model.SubmitFile">