Blame view

src/main/resources/mapper/AdvertMapper.xml 1.95 KB
b9411514   陈杰   first
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?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.AdvertMapper">

    <resultMap id="AdvertMap" type="com.sincere.student.model.Advert">
        <id column="id" property="id"/>
        <result column="type" property="type"/>
        <result column="img_url" property="imgUrl"/>
        <result column="url_link" property="urlLink"/>
        <result column="sort" property="sort"/>
        <result column="status" property="status"/>
        <result column="create_time" property="createTime"/>
        <result column="title" property="title"/>
    </resultMap>

    <select id="getList" parameterType="java.lang.Integer" resultMap="AdvertMap">
        select * from university_advert where type = #{type} order by sort
    </select>

    <select id="getDetail" parameterType="java.lang.Integer" resultMap="AdvertMap">
        select * from university_advert where id=#{id}
    </select>

123dbb81   徐泉   研学代码提交
24
    <insert id="create" parameterType="com.sincere.student.model.Advert" >
b9411514   陈杰   first
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
        insert into university_advert (type,img_url,url_link,sort,status,create_time,title)
        values (#{type},#{imgUrl},#{urlLink},#{sort},#{status},GETDATE(),#{title})
    </insert>

    <delete id="delete" parameterType="java.lang.Integer">
        delete university_advert where id = #{id}
    </delete>

    <update id="update" parameterType="com.sincere.student.model.Advert">
        update university_advert
        <trim prefix="set" suffixOverrides=",">
            <if test="imgUrl!=null">
                img_url=#{imgUrl},
            </if>
            <if test="sort!=null">
                sort=#{sort},
            </if>
            <if test="urlLink!=null">
                url_link=#{urlLink},
            </if>
            <if test="title!=null">
                title=#{title},
            </if>
        </trim>
        where id = #{id}
    </update>
</mapper>