Commit 3443a714db8a29fd11a6dd682b72bd0ce82c1886
1 parent
5fb3f442
轮播图链接加链接类型
Showing
6 changed files
with
158 additions
and
3 deletions
etrade-admin/src/main/java/com/diligrp/etrade/admin/domain/req/BannerCo.java
... | ... | @@ -41,12 +41,28 @@ public class BannerCo implements Serializable { |
41 | 41 | * 链接 |
42 | 42 | */ |
43 | 43 | private String link; |
44 | + /** | |
45 | + * 链接类型 | |
46 | + * {@link com.diligrp.etrade.admin.type.BannerLinkType} | |
47 | + */ | |
48 | + private Integer linkType; | |
49 | + | |
50 | + /** | |
51 | + * 链接内容 | |
52 | + */ | |
53 | + private String content; | |
54 | + | |
55 | + /** | |
56 | + * 链接内容-图片链接 | |
57 | + */ | |
58 | + private String likPicUrl; | |
44 | 59 | |
45 | 60 | /** |
46 | 61 | * 备注 |
47 | 62 | */ |
48 | 63 | private String remark; |
49 | 64 | |
65 | + | |
50 | 66 | private static final long serialVersionUID = 1L; |
51 | 67 | |
52 | 68 | public Long getId() { |
... | ... | @@ -105,4 +121,27 @@ public class BannerCo implements Serializable { |
105 | 121 | this.remark = remark; |
106 | 122 | } |
107 | 123 | |
124 | + public Integer getLinkType() { | |
125 | + return linkType; | |
126 | + } | |
127 | + | |
128 | + public void setLinkType(Integer linkType) { | |
129 | + this.linkType = linkType; | |
130 | + } | |
131 | + | |
132 | + public String getContent() { | |
133 | + return content; | |
134 | + } | |
135 | + | |
136 | + public void setContent(String content) { | |
137 | + this.content = content; | |
138 | + } | |
139 | + | |
140 | + public String getLikPicUrl() { | |
141 | + return likPicUrl; | |
142 | + } | |
143 | + | |
144 | + public void setLikPicUrl(String likPicUrl) { | |
145 | + this.likPicUrl = likPicUrl; | |
146 | + } | |
108 | 147 | } |
109 | 148 | \ No newline at end of file | ... | ... |
etrade-admin/src/main/java/com/diligrp/etrade/admin/domain/resp/BannerVo.java
... | ... | @@ -77,6 +77,22 @@ public class BannerVo implements Serializable { |
77 | 77 | private String link; |
78 | 78 | |
79 | 79 | /** |
80 | + * 链接类型 | |
81 | + * {@link com.diligrp.etrade.admin.type.BannerLinkType} | |
82 | + */ | |
83 | + private Integer linkType; | |
84 | + | |
85 | + /** | |
86 | + * 链接内容 | |
87 | + */ | |
88 | + private String content; | |
89 | + | |
90 | + /** | |
91 | + * 链接内容-图片链接 | |
92 | + */ | |
93 | + private String likPicUrl; | |
94 | + | |
95 | + /** | |
80 | 96 | * 备注 |
81 | 97 | */ |
82 | 98 | private String remark; |
... | ... | @@ -243,4 +259,28 @@ public class BannerVo implements Serializable { |
243 | 259 | public void setBannerTypeName(String bannerTypeName) { |
244 | 260 | this.bannerTypeName = bannerTypeName; |
245 | 261 | } |
262 | + | |
263 | + public Integer getLinkType() { | |
264 | + return linkType; | |
265 | + } | |
266 | + | |
267 | + public void setLinkType(Integer linkType) { | |
268 | + this.linkType = linkType; | |
269 | + } | |
270 | + | |
271 | + public String getContent() { | |
272 | + return content; | |
273 | + } | |
274 | + | |
275 | + public void setContent(String content) { | |
276 | + this.content = content; | |
277 | + } | |
278 | + | |
279 | + public String getLikPicUrl() { | |
280 | + return likPicUrl; | |
281 | + } | |
282 | + | |
283 | + public void setLikPicUrl(String likPicUrl) { | |
284 | + this.likPicUrl = likPicUrl; | |
285 | + } | |
246 | 286 | } |
247 | 287 | \ No newline at end of file | ... | ... |
etrade-admin/src/main/java/com/diligrp/etrade/admin/model/Banner.java
... | ... | @@ -47,6 +47,11 @@ public class Banner extends BaseDo implements Serializable { |
47 | 47 | * 图片链接 |
48 | 48 | */ |
49 | 49 | private String picUrl; |
50 | + /** | |
51 | + * 链接类型 | |
52 | + * {@link com.diligrp.etrade.admin.type.BannerLinkType} | |
53 | + */ | |
54 | + private Integer linkType; | |
50 | 55 | |
51 | 56 | /** |
52 | 57 | * 链接 |
... | ... | @@ -178,4 +183,12 @@ public class Banner extends BaseDo implements Serializable { |
178 | 183 | public void setDeleted(Integer deleted) { |
179 | 184 | this.deleted = deleted; |
180 | 185 | } |
186 | + | |
187 | + public Integer getLinkType() { | |
188 | + return linkType; | |
189 | + } | |
190 | + | |
191 | + public void setLinkType(Integer linkType) { | |
192 | + this.linkType = linkType; | |
193 | + } | |
181 | 194 | } |
182 | 195 | \ No newline at end of file | ... | ... |
etrade-admin/src/main/java/com/diligrp/etrade/admin/service/impl/BannerServiceImpl.java
1 | 1 | package com.diligrp.etrade.admin.service.impl; |
2 | 2 | |
3 | +import com.diligrp.etrade.admin.dao.BannerContentMapper; | |
3 | 4 | import com.diligrp.etrade.admin.dao.BannerMapper; |
4 | 5 | import com.diligrp.etrade.admin.domain.req.BannerCo; |
5 | 6 | import com.diligrp.etrade.admin.domain.req.BannerQuery; |
... | ... | @@ -24,6 +25,7 @@ import org.slf4j.LoggerFactory; |
24 | 25 | import org.springframework.beans.BeanUtils; |
25 | 26 | import org.springframework.beans.factory.annotation.Autowired; |
26 | 27 | import org.springframework.stereotype.Service; |
28 | +import org.springframework.transaction.annotation.Transactional; | |
27 | 29 | import org.springframework.util.Assert; |
28 | 30 | import org.springframework.util.CollectionUtils; |
29 | 31 | |
... | ... | @@ -44,6 +46,8 @@ public class BannerServiceImpl implements BannerService { |
44 | 46 | @Autowired |
45 | 47 | private BannerMapper bannerMapper; |
46 | 48 | @Autowired |
49 | + private BannerContentMapper bannerContentMapper; | |
50 | + @Autowired | |
47 | 51 | private BannerTypeService bannerTypeService; |
48 | 52 | |
49 | 53 | @Override |
... | ... | @@ -91,11 +95,13 @@ public class BannerServiceImpl implements BannerService { |
91 | 95 | LOG.warn("未查询到该记录, 参数id={}", id); |
92 | 96 | return Message.failure("该记录不存在!"); |
93 | 97 | } |
98 | + //@TODO 查询组装内容数据 | |
94 | 99 | BannerVo bannerVo = new BannerVo(); |
95 | 100 | BeanUtils.copyProperties(banner, bannerVo); |
96 | 101 | return Message.success(bannerVo); |
97 | 102 | } |
98 | 103 | |
104 | + @Transactional(rollbackFor = Exception.class) | |
99 | 105 | @Override |
100 | 106 | public Message<Integer> insert(BannerCo bannerCo) { |
101 | 107 | Banner banner = new Banner(); |
... | ... | @@ -108,6 +114,7 @@ public class BannerServiceImpl implements BannerService { |
108 | 114 | banner.setDeleted(BannerDeleted.NO.getCode()); |
109 | 115 | int count = bannerMapper.insert(banner); |
110 | 116 | Assert.isTrue(count > 0, "新增失败,请稍后重试!"); |
117 | + //@TODO 组装新增 内容数据 | |
111 | 118 | return Message.success(); |
112 | 119 | } |
113 | 120 | |
... | ... | @@ -124,6 +131,7 @@ public class BannerServiceImpl implements BannerService { |
124 | 131 | return Message.success(); |
125 | 132 | } |
126 | 133 | |
134 | + @Transactional(rollbackFor = Exception.class) | |
127 | 135 | @Override |
128 | 136 | public Message<Integer> update(BannerCo bannerCo) { |
129 | 137 | Banner banner = bannerMapper.selectByPrimaryKey(bannerCo.getId()); |
... | ... | @@ -136,6 +144,7 @@ public class BannerServiceImpl implements BannerService { |
136 | 144 | banner.setModifier(userTicket.getRealName()); |
137 | 145 | int count = bannerMapper.updateByPrimaryKey(banner); |
138 | 146 | Assert.isTrue(count > 0, "修改失败,请稍后重试!"); |
147 | + //@TODO 组装删除/新增 -- 内容数据 | |
139 | 148 | return Message.success(); |
140 | 149 | } |
141 | 150 | ... | ... |
etrade-admin/src/main/java/com/diligrp/etrade/admin/type/BannerLinkType.java
0 → 100644
1 | +package com.diligrp.etrade.admin.type; | |
2 | + | |
3 | +import com.diligrp.etrade.core.type.EnumArrayValuableEnums; | |
4 | + | |
5 | +import java.util.Map; | |
6 | +import java.util.stream.Collectors; | |
7 | +import java.util.stream.Stream; | |
8 | + | |
9 | +public enum BannerLinkType implements EnumArrayValuableEnums { | |
10 | + CONTACT(1,"电话"), | |
11 | + LINK(2,"链接"), | |
12 | + CONTENT(3,"内容"); | |
13 | + private Integer code; | |
14 | + private String value; | |
15 | + | |
16 | + BannerLinkType(Integer code, String value) { | |
17 | + this.code = code; | |
18 | + this.value = value; | |
19 | + } | |
20 | + | |
21 | + private final static Map<Integer, String> DATA = Stream.of(BannerLinkType.values()) | |
22 | + .collect(Collectors.toMap(BannerLinkType::getCode, BannerLinkType::getValue)); | |
23 | + | |
24 | + | |
25 | + /** | |
26 | + * 自定义序列化 | |
27 | + * | |
28 | + * @return {@link Map}<{@link String}, {@link String}> | |
29 | + */ | |
30 | + @Override | |
31 | + public Map<String, String> keyValue() { | |
32 | + return DATA.entrySet().stream() | |
33 | + .collect(Collectors.toMap(vo -> vo.getKey().toString(), Map.Entry::getValue)); | |
34 | + } | |
35 | + | |
36 | + public Integer getCode() { | |
37 | + return code; | |
38 | + } | |
39 | + | |
40 | + public String getValue() { | |
41 | + return value; | |
42 | + } | |
43 | +} | ... | ... |
etrade-admin/src/main/resources/com/diligrp/etrade/dao/mapper/BannerMapper.xml
... | ... | @@ -13,6 +13,7 @@ |
13 | 13 | <result column="banner_type_id" jdbcType="BIGINT" property="bannerTypeId" /> |
14 | 14 | <result column="title" jdbcType="VARCHAR" property="title" /> |
15 | 15 | <result column="pic_url" jdbcType="VARCHAR" property="picUrl" /> |
16 | + <result column="link_type" jdbcType="INTEGER" property="linkType" /> | |
16 | 17 | <result column="link" jdbcType="VARCHAR" property="link" /> |
17 | 18 | <result column="remark" jdbcType="VARCHAR" property="remark" /> |
18 | 19 | <result column="state" jdbcType="TINYINT" property="state" /> |
... | ... | @@ -22,7 +23,7 @@ |
22 | 23 | </resultMap> |
23 | 24 | <sql id="Base_Column_List"> |
24 | 25 | id, created_time, modified_time, creater_id, creater, modifier_id, modifier, sort, |
25 | - banner_type_id, title, pic_url, link, remark, `state`, market_id, deleted, version | |
26 | + banner_type_id, title, pic_url, link_type, link, remark, `state`, market_id, deleted, version | |
26 | 27 | </sql> |
27 | 28 | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
28 | 29 | select |
... | ... | @@ -38,12 +39,12 @@ |
38 | 39 | insert into banner (creater_id, |
39 | 40 | creater, modifier_id, modifier, |
40 | 41 | sort, banner_type_id, title, |
41 | - pic_url, link, remark, | |
42 | + pic_url, link_type, link, remark, | |
42 | 43 | `state`, market_id, deleted) |
43 | 44 | values (#{createrId,jdbcType=BIGINT}, |
44 | 45 | #{creater,jdbcType=VARCHAR}, #{modifierId,jdbcType=BIGINT}, #{modifier,jdbcType=VARCHAR}, |
45 | 46 | #{sort,jdbcType=INTEGER}, #{bannerTypeId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR}, |
46 | - #{picUrl,jdbcType=VARCHAR}, #{link,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, | |
47 | + #{picUrl,jdbcType=VARCHAR}, #{link_type,jdbcType=INTEGER}, #{link,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, | |
47 | 48 | #{state,jdbcType=TINYINT}, #{marketId,jdbcType=BIGINT}, #{deleted,jdbcType=TINYINT}) |
48 | 49 | </insert> |
49 | 50 | <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.diligrp.etrade.admin.model.Banner" useGeneratedKeys="true"> |
... | ... | @@ -79,6 +80,9 @@ |
79 | 80 | <if test="picUrl != null"> |
80 | 81 | pic_url, |
81 | 82 | </if> |
83 | + <if test="linkType != null"> | |
84 | + link_type, | |
85 | + </if> | |
82 | 86 | <if test="link != null"> |
83 | 87 | link, |
84 | 88 | </if> |
... | ... | @@ -129,6 +133,9 @@ |
129 | 133 | <if test="picUrl != null"> |
130 | 134 | #{picUrl,jdbcType=VARCHAR}, |
131 | 135 | </if> |
136 | + <if test="linkType != null"> | |
137 | + #{linkType,jdbcType=INTEGER}, | |
138 | + </if> | |
132 | 139 | <if test="link != null"> |
133 | 140 | #{link,jdbcType=VARCHAR}, |
134 | 141 | </if> |
... | ... | @@ -182,6 +189,9 @@ |
182 | 189 | <if test="picUrl != null"> |
183 | 190 | pic_url = #{picUrl,jdbcType=VARCHAR}, |
184 | 191 | </if> |
192 | + <if test="linkType != null"> | |
193 | + link_type = #{linkType,jdbcType=INTEGER}, | |
194 | + </if> | |
185 | 195 | <if test="link != null"> |
186 | 196 | link = #{link,jdbcType=VARCHAR}, |
187 | 197 | </if> |
... | ... | @@ -212,6 +222,7 @@ |
212 | 222 | banner_type_id = #{bannerTypeId,jdbcType=BIGINT}, |
213 | 223 | title = #{title,jdbcType=VARCHAR}, |
214 | 224 | pic_url = #{picUrl,jdbcType=VARCHAR}, |
225 | + link_type = #{linkType,jdbcType=INTEGER}, | |
215 | 226 | link = #{link,jdbcType=VARCHAR}, |
216 | 227 | remark = #{remark,jdbcType=VARCHAR}, |
217 | 228 | `state` = #{state,jdbcType=TINYINT}, | ... | ... |