Blame view

src/main/resources/mapper/UniversitySubmitFileMapper.xml 7.3 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"/>
            <result column="major" property="major"/>
            <result column="grade" property="grade"/>
            <result column="enroll_number" property="enrollNumber"/>
            <result column="rank" property="rank"/>
        </collection>
    </resultMap>
b9411514   陈杰   first
17

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
    <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
        <where>
            <if test="submitId != 0">
                and sf.id = #{submitId}
            </if>
            <if test="majorName != null and majorName != '' ">
                and p.major like #{majorName}
            </if>
            <if test="universityName != null and universityName != '' ">
                and p.university like #{universityName}
            </if>
            <if test="province != null and province != '' ">
                and p.province = #{province}
            </if>
            <if test="city != null and city != '' ">
                and p.city = #{city}
            </if>
            <if test="point != 0 ">
                <![CDATA[ and p.grade > #{point}-5 and p.grade < #{point} +5  ]]>
            </if>
            <if test="rank != 0 ">
                <![CDATA[ and p.rank > #{rank}-100 and p.rank < #{rank} +100  ]]>
            </if>
        </where>
    </select>
b9411514   陈杰   first
45

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
    <select id="getAppList" parameterType="com.sincere.student.dto.PointSearchDto" resultMap="LineMap">
        select sf.id , sf.title , p.university as name , p.major , p.enroll_number , p.rank , p.grade
        from university_submit_file sf join university_point p on sf.id = p.submit_id
        <where>
            <if test="submitId != 0">
                and sf.id = #{submitId}
            </if>
            <if test="majorName != null and majorName != '' ">
                and p.major like #{majorName}
            </if>
            <if test="universityName != null and universityName != '' ">
                and p.university like #{universityName}
            </if>
            <if test="province != null and province != '' ">
                and p.province = #{province}
            </if>
            <if test="city != null and city != '' ">
                and p.city = #{city}
            </if>
            <if test="point != 0 ">
                <![CDATA[ and p.grade >= #{point}-5 and p.grade <= #{point} +5  ]]>
            </if>
            <if test="rank != 0 ">
                <![CDATA[ and p.rank >= #{rank}-100 and p.rank <= #{rank} +100  ]]>
            </if>
        </where>
        order by sf.id
    </select>
b9411514   陈杰   first
74

123dbb81   徐泉   研学代码提交
75
76
77
78
79
80
81
82
    <resultMap id="BaseResultMap" type="com.sincere.student.model.SubmitFile">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="title" jdbcType="VARCHAR" property="title"/>
        <result column="file_url" jdbcType="VARCHAR" property="fileUrl"/>
        <result column="year" jdbcType="VARCHAR" property="year"/>
        <result column="sort" jdbcType="INTEGER" property="sort"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
    </resultMap>
b9411514   陈杰   first
83

123dbb81   徐泉   研学代码提交
84
85
86
87
88
89
90
91
    <select id="getListCount" parameterType="com.sincere.student.dto.MessageSearchDto" resultType="java.lang.Integer">
        select count(0) from university_submit_file
        <where>
            <if test="search != null and search != '' ">
                title like #{search}
            </if>
        </where>
    </select>
b9411514   陈杰   first
92

123dbb81   徐泉   研学代码提交
93
94
95
96
97
98
99
100
101
    <select id="getList" parameterType="com.sincere.student.dto.MessageSearchDto" resultMap="BaseResultMap">
        select * from university_submit_file
        <where>
            <if test="search != null and search != '' ">
                title like #{search}
            </if>
        </where>
        order by sort
    </select>
b9411514   陈杰   first
102

2f3069be   陈杰   bug 修复
103

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
    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        select *
        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,file_url)
        values (#{title,jdbcType=VARCHAR}, #{year,jdbcType=VARCHAR},
        #{sort,jdbcType=INTEGER}, GETDATE(),#{fileUrl})
    </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 and title != ''">
                title = #{title,jdbcType=VARCHAR},
            </if>
            <if test="year != null and year != ''">
                year = #{year,jdbcType=VARCHAR},
            </if>
            <if test="sort != 0">
                sort = #{sort,jdbcType=INTEGER},
            </if>
            <if test="fileUrl != null and fileUrl != ''">
                file_url = #{fileUrl,jdbcType=VARCHAR},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.sincere.student.model.SubmitFile">
        update university_submit_file
        set title = #{title,jdbcType=VARCHAR},
b9411514   陈杰   first
177
        year = #{year,jdbcType=VARCHAR},
b9411514   陈杰   first
178
        sort = #{sort,jdbcType=INTEGER},
123dbb81   徐泉   研学代码提交
179
180
181
        create_time = #{createTime,jdbcType=TIMESTAMP}
        where id = #{id,jdbcType=INTEGER}
    </update>
b9411514   陈杰   first
182
</mapper>