|
@@ -1,172 +1,36 @@
|
1
|
1
|
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
2
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
3
|
3
|
<mapper namespace="com.community.huiju.dao.TpAnnouncementMapper" >
|
4
|
|
- <resultMap id="BaseResultMap" type="com.community.huiju.model.TpAnnouncement" >
|
5
|
|
- <id column="id" property="id" jdbcType="INTEGER" />
|
6
|
|
- <result column="community_id" property="communityId" jdbcType="INTEGER" />
|
7
|
|
- <result column="announcement_title" property="announcementTitle" jdbcType="VARCHAR" />
|
8
|
|
- <result column="announcement_carousel_img" property="announcementCarouselImg" jdbcType="VARCHAR" />
|
9
|
|
- <result column="announcement_content" property="announcementContent" jdbcType="VARCHAR" />
|
10
|
|
- <result column="user_name" property="userName" jdbcType="VARCHAR" />
|
11
|
|
- <result column="sort" property="sort" jdbcType="INTEGER" />
|
12
|
|
- <result column="view_count" property="viewCount" jdbcType="INTEGER" />
|
13
|
|
- <result column="set_up_carousel" property="setUpCarousel" jdbcType="CHAR" />
|
14
|
|
- <result column="status" property="status" jdbcType="CHAR" />
|
15
|
|
- <result column="create_user" property="createUser" jdbcType="INTEGER" />
|
16
|
|
- <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
|
17
|
|
- <result column="update_user" property="updateUser" jdbcType="INTEGER" />
|
18
|
|
- <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
|
19
|
|
- </resultMap>
|
20
|
4
|
<sql id="Base_Column_List" >
|
21
|
5
|
id, community_id, announcement_title, announcement_carousel_img, announcement_content,
|
22
|
6
|
sort, view_count, set_up_carousel, status, create_user, create_date, update_user,
|
23
|
7
|
update_date
|
24
|
8
|
</sql>
|
25
|
|
- <select id="selectByPrimaryKey" resultMap="BaseResultMap">
|
26
|
|
- select
|
27
|
|
- <include refid="Base_Column_List" />
|
28
|
|
- from tp_announcement
|
29
|
|
- where id = #{id,jdbcType=INTEGER} and community_id = #{communityId,jdbcType=INTEGER}
|
30
|
|
- </select>
|
31
|
|
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
32
|
|
- delete from tp_announcement
|
33
|
|
- where id = #{id,jdbcType=INTEGER}
|
34
|
|
- </delete>
|
35
|
|
- <insert id="insert" parameterType="com.community.huiju.model.TpAnnouncement" >
|
36
|
|
- insert into tp_announcement (id, community_id, announcement_title,
|
37
|
|
- announcement_carousel_img, announcement_content,
|
38
|
|
- sort, view_count, set_up_carousel,
|
39
|
|
- status, create_user, create_date,
|
40
|
|
- update_user, update_date)
|
41
|
|
- values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{announcementTitle,jdbcType=VARCHAR},
|
42
|
|
- #{announcementCarouselImg,jdbcType=VARCHAR}, #{announcementContent,jdbcType=VARCHAR},
|
43
|
|
- #{sort,jdbcType=INTEGER}, #{viewCount,jdbcType=INTEGER}, #{setUpCarousel,jdbcType=CHAR},
|
44
|
|
- #{status,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP},
|
45
|
|
- #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP})
|
46
|
|
- </insert>
|
47
|
|
- <insert id="insertSelective" parameterType="com.community.huiju.model.TpAnnouncement" >
|
48
|
|
- insert into tp_announcement
|
49
|
|
- <trim prefix="(" suffix=")" suffixOverrides="," >
|
50
|
|
- <if test="id != null" >
|
51
|
|
- id,
|
52
|
|
- </if>
|
53
|
|
- <if test="communityId != null" >
|
54
|
|
- community_id,
|
55
|
|
- </if>
|
56
|
|
- <if test="announcementTitle != null" >
|
57
|
|
- announcement_title,
|
58
|
|
- </if>
|
59
|
|
- <if test="announcementCarouselImg != null" >
|
60
|
|
- announcement_carousel_img,
|
61
|
|
- </if>
|
62
|
|
- <if test="announcementContent != null" >
|
63
|
|
- announcement_content,
|
64
|
|
- </if>
|
65
|
|
- <if test="sort != null" >
|
66
|
|
- sort,
|
67
|
|
- </if>
|
68
|
|
- <if test="viewCount != null" >
|
69
|
|
- view_count,
|
70
|
|
- </if>
|
71
|
|
- <if test="setUpCarousel != null" >
|
72
|
|
- set_up_carousel,
|
73
|
|
- </if>
|
74
|
|
- <if test="status != null" >
|
75
|
|
- status,
|
76
|
|
- </if>
|
77
|
|
- <if test="createUser != null" >
|
78
|
|
- create_user,
|
79
|
|
- </if>
|
80
|
|
- <if test="createDate != null" >
|
81
|
|
- create_date,
|
82
|
|
- </if>
|
83
|
|
- <if test="updateUser != null" >
|
84
|
|
- update_user,
|
85
|
|
- </if>
|
86
|
|
- <if test="updateDate != null" >
|
87
|
|
- update_date,
|
88
|
|
- </if>
|
89
|
|
- </trim>
|
90
|
|
- <trim prefix="values (" suffix=")" suffixOverrides="," >
|
91
|
|
- <if test="id != null" >
|
92
|
|
- #{id,jdbcType=INTEGER},
|
93
|
|
- </if>
|
94
|
|
- <if test="communityId != null" >
|
95
|
|
- #{communityId,jdbcType=INTEGER},
|
96
|
|
- </if>
|
97
|
|
- <if test="announcementTitle != null" >
|
98
|
|
- #{announcementTitle,jdbcType=VARCHAR},
|
99
|
|
- </if>
|
100
|
|
- <if test="announcementCarouselImg != null" >
|
101
|
|
- #{announcementCarouselImg,jdbcType=VARCHAR},
|
102
|
|
- </if>
|
103
|
|
- <if test="announcementContent != null" >
|
104
|
|
- #{announcementContent,jdbcType=VARCHAR},
|
105
|
|
- </if>
|
106
|
|
- <if test="sort != null" >
|
107
|
|
- #{sort,jdbcType=INTEGER},
|
108
|
|
- </if>
|
109
|
|
- <if test="viewCount != null" >
|
110
|
|
- #{viewCount,jdbcType=INTEGER},
|
111
|
|
- </if>
|
112
|
|
- <if test="setUpCarousel != null" >
|
113
|
|
- #{setUpCarousel,jdbcType=CHAR},
|
114
|
|
- </if>
|
115
|
|
- <if test="status != null" >
|
116
|
|
- #{status,jdbcType=CHAR},
|
117
|
|
- </if>
|
118
|
|
- <if test="createUser != null" >
|
119
|
|
- #{createUser,jdbcType=INTEGER},
|
120
|
|
- </if>
|
121
|
|
- <if test="createDate != null" >
|
122
|
|
- #{createDate,jdbcType=TIMESTAMP},
|
123
|
|
- </if>
|
124
|
|
- <if test="updateUser != null" >
|
125
|
|
- #{updateUser,jdbcType=INTEGER},
|
126
|
|
- </if>
|
127
|
|
- <if test="updateDate != null" >
|
128
|
|
- #{updateDate,jdbcType=TIMESTAMP},
|
129
|
|
- </if>
|
130
|
|
- </trim>
|
131
|
|
- </insert>
|
132
|
|
- <update id="updateByPrimaryKeySelective" >
|
133
|
|
- update tp_announcement
|
134
|
|
- <set >
|
135
|
|
- <if test="viewCount != null" >
|
136
|
|
- view_count = #{viewCount,jdbcType=INTEGER},
|
137
|
|
- </if>
|
138
|
|
- </set>
|
139
|
|
- where id = #{id,jdbcType=INTEGER}
|
140
|
|
- </update>
|
141
|
|
- <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpAnnouncement" >
|
142
|
|
- update tp_announcement
|
143
|
|
- set community_id = #{communityId,jdbcType=INTEGER},
|
144
|
|
- announcement_title = #{announcementTitle,jdbcType=VARCHAR},
|
145
|
|
- announcement_carousel_img = #{announcementCarouselImg,jdbcType=VARCHAR},
|
146
|
|
- announcement_content = #{announcementContent,jdbcType=VARCHAR},
|
147
|
|
- sort = #{sort,jdbcType=INTEGER},
|
148
|
|
- view_count = #{viewCount,jdbcType=INTEGER},
|
149
|
|
- set_up_carousel = #{setUpCarousel,jdbcType=CHAR},
|
150
|
|
- status = #{status,jdbcType=CHAR},
|
151
|
|
- create_user = #{createUser,jdbcType=INTEGER},
|
152
|
|
- create_date = #{createDate,jdbcType=TIMESTAMP},
|
153
|
|
- update_user = #{updateUser,jdbcType=INTEGER},
|
154
|
|
- update_date = #{updateDate,jdbcType=TIMESTAMP}
|
155
|
|
- where id = #{id,jdbcType=INTEGER}
|
156
|
|
- </update>
|
157
|
|
-
|
158
|
|
- <select id="getAnnouncements" resultType="com.community.huiju.model.TpAnnouncement" parameterType="map">
|
|
9
|
+ <select id="getAnnouncements" resultType="com.community.huiju.model.TpAnnouncement">
|
159
|
10
|
SELECT
|
160
|
|
- <include refid="Base_Column_List" />
|
|
11
|
+ id, community_id, announcement_title, announcement_carousel_img, announcement_content,
|
|
12
|
+ sort, view_count, set_up_carousel, status, create_user, create_date, update_user,
|
|
13
|
+ update_date
|
161
|
14
|
FROM
|
162
|
|
- tp_announcement WHERE community_id = #{communityId,jdbcType=INTEGER}
|
163
|
|
-
|
|
15
|
+ tp_announcement
|
|
16
|
+ <where>
|
|
17
|
+ <if test="record.id != null and record.id != ''" >
|
|
18
|
+ AND id = #{record.id,jdbcType=INTEGER}
|
|
19
|
+ </if>
|
|
20
|
+ <if test="record.announcementTitle != null and record.announcementTitle != ''" >
|
|
21
|
+ AND announcement_title like concat('%',#{record.announcementTitle,jdbcType=VARCHAR},'%')
|
|
22
|
+ </if>
|
|
23
|
+ AND community_id = #{record.communityId,jdbcType=INTEGER}
|
|
24
|
+ </where>
|
164
|
25
|
</select>
|
165
|
|
-
|
166
|
|
- <select id="getAnnouncement" resultMap="BaseResultMap" parameterType="com.community.huiju.model.TpAnnouncement">
|
167
|
|
- select
|
168
|
|
- <include refid="Base_Column_List" />
|
169
|
|
- from tp_announcement
|
170
|
|
- where community_id = #{communityId,jdbcType=INTEGER} and status=1 order by create_date DESC limit #{sum,jdbcType=INTEGER}
|
|
26
|
+ <select id="getById" resultType="com.community.huiju.model.TpAnnouncement">
|
|
27
|
+ SELECT
|
|
28
|
+ id, community_id, announcement_title, announcement_carousel_img, announcement_content,
|
|
29
|
+ sort, view_count, set_up_carousel, status, create_user, create_date, update_user,
|
|
30
|
+ update_date
|
|
31
|
+ FROM
|
|
32
|
+ tp_announcement
|
|
33
|
+ WHERE community_id = #{record.communityId,jdbcType=INTEGER}
|
171
|
34
|
</select>
|
|
35
|
+
|
172
|
36
|
</mapper>
|