| b9411514  陈杰
 
first | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 | <?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.ArticleMapper">
    <resultMap id="ArticleMap" type="com.sincere.student.model.Article">
        <id column="id" property="id"/>
        <result column="title" property="title"/>
        <result column="column_type" property="columnType"/>
        <result column="university_id" property="universityId"/>
        <result column="sort" property="sort"/>
        <result column="context" property="context"/>
        <result column="author" property="author"/>
        <result column="image_url" property="imageUrl"/>
        <result column="video_url" property="videoUrl"/>
        <result column="article_link" property="articleLink"/>
        <result column="good_number" property="goodNumber"/>
        <result column="look_number" property="lookNumber"/>
        <result column="create_time" property="createTime"/>
        <result column="type" property="type"/>
 | 
| 123dbb81  徐泉
 
研学代码提交 | 20
21 |         <result column="status" property="status" />
    </resultMap>
 | 
| b9411514  陈杰
 
first | 22
23
24
25
26
27 | 
    <select id="getListCount" parameterType="com.sincere.student.dto.ArticleSearchDto" resultType="java.lang.Integer">
        select count(0) from university_article
        <where>
            <if test="title != null and title != ''">
 | 
| 3c7f8a2c  陈杰
 
bug 修复 | 28 |                 and title like #{title}
 | 
| b9411514  陈杰
 
first | 29
30
31
32
33
34
35
36 |             </if>
            <if test="columnType != 0">
                and column_type = #{columnType}
            </if>
            <if test="articleType != 0">
                and type = #{articleType}
            </if>
            <if test="status == 1">
 | 
| be5d580a  陈杰
 
加发布 预览功能 | 37
38
39
40
41
42 |                 and status = 1
            </if>
            <if test="status != 1">
                and 1 = 1
            </if>
        </where>
 | 
| b9411514  陈杰
 
first | 43
44
45
46 |     </select>
    <select id="getList" parameterType="com.sincere.student.dto.ArticleSearchDto" resultMap="ArticleMap">
        select * from university_article
 | 
| 123dbb81  徐泉
 
研学代码提交 | 47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66 |          <where>
             <if test="title != null and title != ''">
                 and title like #{title}
             </if>
             <if test="columnType != 0">
                 and column_type = #{columnType}
             </if>
             <if test="articleType != 0">
                 and type = #{articleType}
             </if>
             <if test="status == 1">
                 and status = 1
             </if>
             <if test="status != 1">
                 and 1 = 1
             </if>
         </where>
         order by sort
    </select>
 | 
| b9411514  陈杰
 
first | 67
68 |     <select id="getAdvert" resultMap="ArticleMap">
        select top 1 * from university_article  where type = 1 ORDER BY NEWID()
 | 
| fafdccdc  陈杰
 
bug 修复 | 69 |     </select>
 | 
| 123dbb81  徐泉
 
研学代码提交 | 70
71
72
73
74
75
76
77
78
79
80
81
82
83 | 
    <select id="getRelationList" parameterType="java.lang.Integer" resultMap="ArticleMap">
        select top 3 * from university_article where university_id = #{universityId}
    </select>
    <select id="selectById" parameterType="java.lang.Integer" resultMap="ArticleMap">
        select * from university_article where id = #{id}
    </select>
    <insert id="create" parameterType="com.sincere.student.model.Article"  useGeneratedKeys="true" keyProperty="id">
        insert into university_article (title,column_type,university_id,sort,context,author,image_url,video_url,article_link,good_number,look_number,create_time,type,status)
        values (#{title},#{columnType},#{universityId},#{sort},#{context},#{author},#{imageUrl},#{videoUrl},#{articleLink},#{goodNumber},#{lookNumber},GETDATE(),#{type},#{status})
    </insert>
 | 
| fafdccdc  陈杰
 
bug 修复 | 84
85 |     <delete id="delete" parameterType="java.lang.Integer">
        delete university_article where id = #{id}
 | 
| 123dbb81  徐泉
 
研学代码提交 | 86 |     </delete>
 | 
| b9411514  陈杰
 
first | 87
88
89
90
91
92
93
94 | 
    <update id="update" parameterType="com.sincere.student.model.Article">
        update university_article
        <trim prefix="set" suffixOverrides=",">
            <if test="title!=null">
                title=#{title},
            </if>
            <if test="columnType!=0">
 | 
| 123dbb81  徐泉
 
研学代码提交 | 95
96
97
98
99 |                 column_type=#{columnType},
            </if>
            <if test="universityId!=0">
                university_id=#{universityId},
            </if>
 | 
| b9411514  陈杰
 
first | 100
101
102
103
104
105
106
107
108
109
110
111 |             <if test="sort!=0">
                sort=#{sort},
            </if>
            <if test="context!=null">
                context=#{context},
            </if>
            <if test="author!=null">
                author=#{author},
            </if>
            <if test="imageUrl!=null">
                image_url=#{imageUrl},
            </if>
 | 
| be5d580a  陈杰
 
加发布 预览功能 | 112 |             <if test="videoUrl!=null">
 | 
| b9411514  陈杰
 
first | 113
114 |                 video_url=#{videoUrl},
            </if>
 | 
| be5d580a  陈杰
 
加发布 预览功能 | 115 |             <if test="articleLink!=null">
 | 
| b9411514  陈杰
 
first | 116
117 |                 article_link=#{articleLink},
            </if>
 | 
| be5d580a  陈杰
 
加发布 预览功能 | 118 |             <if test="goodNumber!=0">
 | 
| b9411514  陈杰
 
first | 119
120
121
122
123
124
125
126
127
128
129
130 |                 good_number=#{goodNumber},
            </if>
            <if test="lookNumber!=0">
                look_number=#{lookNumber},
            </if>
            <if test="status!=-1">
                status=#{status},
            </if>
        </trim>
         where id = #{id}
    </update>
</mapper>
 | 
| be5d580a  陈杰
 
加发布 预览功能 |  | 
 | 
| b9411514  陈杰
 
first |  | 
 | 
| be5d580a  陈杰
 
加发布 预览功能 |  | 
 | 
| b9411514  陈杰
 
first |  | 
 | 
| be5d580a  陈杰
 
加发布 预览功能 |  | 
 | 
| b9411514  陈杰
 
first |  | 
 | 
| 123dbb81  徐泉
 
研学代码提交 |  | 
 | 
| b9411514  陈杰
 
first |  | 
 |