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,12 +41,28 @@ public class BannerCo implements Serializable { | ||
41 | * 链接 | 41 | * 链接 |
42 | */ | 42 | */ |
43 | private String link; | 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 | private String remark; | 63 | private String remark; |
49 | 64 | ||
65 | + | ||
50 | private static final long serialVersionUID = 1L; | 66 | private static final long serialVersionUID = 1L; |
51 | 67 | ||
52 | public Long getId() { | 68 | public Long getId() { |
@@ -105,4 +121,27 @@ public class BannerCo implements Serializable { | @@ -105,4 +121,27 @@ public class BannerCo implements Serializable { | ||
105 | this.remark = remark; | 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 | \ No newline at end of file | 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,6 +77,22 @@ public class BannerVo implements Serializable { | ||
77 | private String link; | 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 | private String remark; | 98 | private String remark; |
@@ -243,4 +259,28 @@ public class BannerVo implements Serializable { | @@ -243,4 +259,28 @@ public class BannerVo implements Serializable { | ||
243 | public void setBannerTypeName(String bannerTypeName) { | 259 | public void setBannerTypeName(String bannerTypeName) { |
244 | this.bannerTypeName = bannerTypeName; | 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 | \ No newline at end of file | 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,6 +47,11 @@ public class Banner extends BaseDo implements Serializable { | ||
47 | * 图片链接 | 47 | * 图片链接 |
48 | */ | 48 | */ |
49 | private String picUrl; | 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,4 +183,12 @@ public class Banner extends BaseDo implements Serializable { | ||
178 | public void setDeleted(Integer deleted) { | 183 | public void setDeleted(Integer deleted) { |
179 | this.deleted = deleted; | 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 | \ No newline at end of file | 195 | \ No newline at end of file |
etrade-admin/src/main/java/com/diligrp/etrade/admin/service/impl/BannerServiceImpl.java
1 | package com.diligrp.etrade.admin.service.impl; | 1 | package com.diligrp.etrade.admin.service.impl; |
2 | 2 | ||
3 | +import com.diligrp.etrade.admin.dao.BannerContentMapper; | ||
3 | import com.diligrp.etrade.admin.dao.BannerMapper; | 4 | import com.diligrp.etrade.admin.dao.BannerMapper; |
4 | import com.diligrp.etrade.admin.domain.req.BannerCo; | 5 | import com.diligrp.etrade.admin.domain.req.BannerCo; |
5 | import com.diligrp.etrade.admin.domain.req.BannerQuery; | 6 | import com.diligrp.etrade.admin.domain.req.BannerQuery; |
@@ -24,6 +25,7 @@ import org.slf4j.LoggerFactory; | @@ -24,6 +25,7 @@ import org.slf4j.LoggerFactory; | ||
24 | import org.springframework.beans.BeanUtils; | 25 | import org.springframework.beans.BeanUtils; |
25 | import org.springframework.beans.factory.annotation.Autowired; | 26 | import org.springframework.beans.factory.annotation.Autowired; |
26 | import org.springframework.stereotype.Service; | 27 | import org.springframework.stereotype.Service; |
28 | +import org.springframework.transaction.annotation.Transactional; | ||
27 | import org.springframework.util.Assert; | 29 | import org.springframework.util.Assert; |
28 | import org.springframework.util.CollectionUtils; | 30 | import org.springframework.util.CollectionUtils; |
29 | 31 | ||
@@ -44,6 +46,8 @@ public class BannerServiceImpl implements BannerService { | @@ -44,6 +46,8 @@ public class BannerServiceImpl implements BannerService { | ||
44 | @Autowired | 46 | @Autowired |
45 | private BannerMapper bannerMapper; | 47 | private BannerMapper bannerMapper; |
46 | @Autowired | 48 | @Autowired |
49 | + private BannerContentMapper bannerContentMapper; | ||
50 | + @Autowired | ||
47 | private BannerTypeService bannerTypeService; | 51 | private BannerTypeService bannerTypeService; |
48 | 52 | ||
49 | @Override | 53 | @Override |
@@ -91,11 +95,13 @@ public class BannerServiceImpl implements BannerService { | @@ -91,11 +95,13 @@ public class BannerServiceImpl implements BannerService { | ||
91 | LOG.warn("未查询到该记录, 参数id={}", id); | 95 | LOG.warn("未查询到该记录, 参数id={}", id); |
92 | return Message.failure("该记录不存在!"); | 96 | return Message.failure("该记录不存在!"); |
93 | } | 97 | } |
98 | + //@TODO 查询组装内容数据 | ||
94 | BannerVo bannerVo = new BannerVo(); | 99 | BannerVo bannerVo = new BannerVo(); |
95 | BeanUtils.copyProperties(banner, bannerVo); | 100 | BeanUtils.copyProperties(banner, bannerVo); |
96 | return Message.success(bannerVo); | 101 | return Message.success(bannerVo); |
97 | } | 102 | } |
98 | 103 | ||
104 | + @Transactional(rollbackFor = Exception.class) | ||
99 | @Override | 105 | @Override |
100 | public Message<Integer> insert(BannerCo bannerCo) { | 106 | public Message<Integer> insert(BannerCo bannerCo) { |
101 | Banner banner = new Banner(); | 107 | Banner banner = new Banner(); |
@@ -108,6 +114,7 @@ public class BannerServiceImpl implements BannerService { | @@ -108,6 +114,7 @@ public class BannerServiceImpl implements BannerService { | ||
108 | banner.setDeleted(BannerDeleted.NO.getCode()); | 114 | banner.setDeleted(BannerDeleted.NO.getCode()); |
109 | int count = bannerMapper.insert(banner); | 115 | int count = bannerMapper.insert(banner); |
110 | Assert.isTrue(count > 0, "新增失败,请稍后重试!"); | 116 | Assert.isTrue(count > 0, "新增失败,请稍后重试!"); |
117 | + //@TODO 组装新增 内容数据 | ||
111 | return Message.success(); | 118 | return Message.success(); |
112 | } | 119 | } |
113 | 120 | ||
@@ -124,6 +131,7 @@ public class BannerServiceImpl implements BannerService { | @@ -124,6 +131,7 @@ public class BannerServiceImpl implements BannerService { | ||
124 | return Message.success(); | 131 | return Message.success(); |
125 | } | 132 | } |
126 | 133 | ||
134 | + @Transactional(rollbackFor = Exception.class) | ||
127 | @Override | 135 | @Override |
128 | public Message<Integer> update(BannerCo bannerCo) { | 136 | public Message<Integer> update(BannerCo bannerCo) { |
129 | Banner banner = bannerMapper.selectByPrimaryKey(bannerCo.getId()); | 137 | Banner banner = bannerMapper.selectByPrimaryKey(bannerCo.getId()); |
@@ -136,6 +144,7 @@ public class BannerServiceImpl implements BannerService { | @@ -136,6 +144,7 @@ public class BannerServiceImpl implements BannerService { | ||
136 | banner.setModifier(userTicket.getRealName()); | 144 | banner.setModifier(userTicket.getRealName()); |
137 | int count = bannerMapper.updateByPrimaryKey(banner); | 145 | int count = bannerMapper.updateByPrimaryKey(banner); |
138 | Assert.isTrue(count > 0, "修改失败,请稍后重试!"); | 146 | Assert.isTrue(count > 0, "修改失败,请稍后重试!"); |
147 | + //@TODO 组装删除/新增 -- 内容数据 | ||
139 | return Message.success(); | 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,6 +13,7 @@ | ||
13 | <result column="banner_type_id" jdbcType="BIGINT" property="bannerTypeId" /> | 13 | <result column="banner_type_id" jdbcType="BIGINT" property="bannerTypeId" /> |
14 | <result column="title" jdbcType="VARCHAR" property="title" /> | 14 | <result column="title" jdbcType="VARCHAR" property="title" /> |
15 | <result column="pic_url" jdbcType="VARCHAR" property="picUrl" /> | 15 | <result column="pic_url" jdbcType="VARCHAR" property="picUrl" /> |
16 | + <result column="link_type" jdbcType="INTEGER" property="linkType" /> | ||
16 | <result column="link" jdbcType="VARCHAR" property="link" /> | 17 | <result column="link" jdbcType="VARCHAR" property="link" /> |
17 | <result column="remark" jdbcType="VARCHAR" property="remark" /> | 18 | <result column="remark" jdbcType="VARCHAR" property="remark" /> |
18 | <result column="state" jdbcType="TINYINT" property="state" /> | 19 | <result column="state" jdbcType="TINYINT" property="state" /> |
@@ -22,7 +23,7 @@ | @@ -22,7 +23,7 @@ | ||
22 | </resultMap> | 23 | </resultMap> |
23 | <sql id="Base_Column_List"> | 24 | <sql id="Base_Column_List"> |
24 | id, created_time, modified_time, creater_id, creater, modifier_id, modifier, sort, | 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 | </sql> | 27 | </sql> |
27 | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 28 | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
28 | select | 29 | select |
@@ -38,12 +39,12 @@ | @@ -38,12 +39,12 @@ | ||
38 | insert into banner (creater_id, | 39 | insert into banner (creater_id, |
39 | creater, modifier_id, modifier, | 40 | creater, modifier_id, modifier, |
40 | sort, banner_type_id, title, | 41 | sort, banner_type_id, title, |
41 | - pic_url, link, remark, | 42 | + pic_url, link_type, link, remark, |
42 | `state`, market_id, deleted) | 43 | `state`, market_id, deleted) |
43 | values (#{createrId,jdbcType=BIGINT}, | 44 | values (#{createrId,jdbcType=BIGINT}, |
44 | #{creater,jdbcType=VARCHAR}, #{modifierId,jdbcType=BIGINT}, #{modifier,jdbcType=VARCHAR}, | 45 | #{creater,jdbcType=VARCHAR}, #{modifierId,jdbcType=BIGINT}, #{modifier,jdbcType=VARCHAR}, |
45 | #{sort,jdbcType=INTEGER}, #{bannerTypeId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR}, | 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 | #{state,jdbcType=TINYINT}, #{marketId,jdbcType=BIGINT}, #{deleted,jdbcType=TINYINT}) | 48 | #{state,jdbcType=TINYINT}, #{marketId,jdbcType=BIGINT}, #{deleted,jdbcType=TINYINT}) |
48 | </insert> | 49 | </insert> |
49 | <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.diligrp.etrade.admin.model.Banner" useGeneratedKeys="true"> | 50 | <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.diligrp.etrade.admin.model.Banner" useGeneratedKeys="true"> |
@@ -79,6 +80,9 @@ | @@ -79,6 +80,9 @@ | ||
79 | <if test="picUrl != null"> | 80 | <if test="picUrl != null"> |
80 | pic_url, | 81 | pic_url, |
81 | </if> | 82 | </if> |
83 | + <if test="linkType != null"> | ||
84 | + link_type, | ||
85 | + </if> | ||
82 | <if test="link != null"> | 86 | <if test="link != null"> |
83 | link, | 87 | link, |
84 | </if> | 88 | </if> |
@@ -129,6 +133,9 @@ | @@ -129,6 +133,9 @@ | ||
129 | <if test="picUrl != null"> | 133 | <if test="picUrl != null"> |
130 | #{picUrl,jdbcType=VARCHAR}, | 134 | #{picUrl,jdbcType=VARCHAR}, |
131 | </if> | 135 | </if> |
136 | + <if test="linkType != null"> | ||
137 | + #{linkType,jdbcType=INTEGER}, | ||
138 | + </if> | ||
132 | <if test="link != null"> | 139 | <if test="link != null"> |
133 | #{link,jdbcType=VARCHAR}, | 140 | #{link,jdbcType=VARCHAR}, |
134 | </if> | 141 | </if> |
@@ -182,6 +189,9 @@ | @@ -182,6 +189,9 @@ | ||
182 | <if test="picUrl != null"> | 189 | <if test="picUrl != null"> |
183 | pic_url = #{picUrl,jdbcType=VARCHAR}, | 190 | pic_url = #{picUrl,jdbcType=VARCHAR}, |
184 | </if> | 191 | </if> |
192 | + <if test="linkType != null"> | ||
193 | + link_type = #{linkType,jdbcType=INTEGER}, | ||
194 | + </if> | ||
185 | <if test="link != null"> | 195 | <if test="link != null"> |
186 | link = #{link,jdbcType=VARCHAR}, | 196 | link = #{link,jdbcType=VARCHAR}, |
187 | </if> | 197 | </if> |
@@ -212,6 +222,7 @@ | @@ -212,6 +222,7 @@ | ||
212 | banner_type_id = #{bannerTypeId,jdbcType=BIGINT}, | 222 | banner_type_id = #{bannerTypeId,jdbcType=BIGINT}, |
213 | title = #{title,jdbcType=VARCHAR}, | 223 | title = #{title,jdbcType=VARCHAR}, |
214 | pic_url = #{picUrl,jdbcType=VARCHAR}, | 224 | pic_url = #{picUrl,jdbcType=VARCHAR}, |
225 | + link_type = #{linkType,jdbcType=INTEGER}, | ||
215 | link = #{link,jdbcType=VARCHAR}, | 226 | link = #{link,jdbcType=VARCHAR}, |
216 | remark = #{remark,jdbcType=VARCHAR}, | 227 | remark = #{remark,jdbcType=VARCHAR}, |
217 | `state` = #{state,jdbcType=TINYINT}, | 228 | `state` = #{state,jdbcType=TINYINT}, |