Commit fed9302911e07d23118ddb7a485c41071ad766e7
1 parent
b9fca177
链接类型不能为空
Showing
4 changed files
with
10 additions
and
6 deletions
etrade-admin/src/main/java/com/diligrp/etrade/admin/domain/req/BannerCo.java
etrade-admin/src/main/java/com/diligrp/etrade/admin/service/impl/BannerServiceImpl.java
... | ... | @@ -11,6 +11,7 @@ import com.diligrp.etrade.admin.service.BannerContentService; |
11 | 11 | import com.diligrp.etrade.admin.service.BannerService; |
12 | 12 | import com.diligrp.etrade.admin.service.BannerTypeService; |
13 | 13 | import com.diligrp.etrade.admin.type.BannerDeleted; |
14 | +import com.diligrp.etrade.admin.type.BannerLinkType; | |
14 | 15 | import com.diligrp.etrade.admin.type.BannerState; |
15 | 16 | import com.diligrp.etrade.admin.type.IssueState; |
16 | 17 | import com.diligrp.etrade.core.authority.SessionContext; |
... | ... | @@ -120,7 +121,7 @@ public class BannerServiceImpl implements BannerService { |
120 | 121 | banner.setDeleted(BannerDeleted.NO.getCode()); |
121 | 122 | int count = bannerMapper.insert(banner); |
122 | 123 | Assert.isTrue(count > 0, "轮播图新增失败,请稍后重试!"); |
123 | - if (bannerCo.getLinkType() != null){ | |
124 | + if (!bannerCo.getLinkType().equals(BannerLinkType.NONE.getCode())){ | |
124 | 125 | bannerContentService.add(banner.getId(), bannerCo.getContent(), bannerCo.getLinkPicUrl()); |
125 | 126 | } |
126 | 127 | return Message.success(); |
... | ... | @@ -157,7 +158,7 @@ public class BannerServiceImpl implements BannerService { |
157 | 158 | if (oldBC != null){ |
158 | 159 | bannerContentService.deleteByPrimaryKey(oldBC.getId()); |
159 | 160 | } |
160 | - if (bannerCo.getLinkType() != null){ | |
161 | + if (!bannerCo.getLinkType().equals(BannerLinkType.NONE.getCode())){ | |
161 | 162 | bannerContentService.add(banner.getId(), bannerCo.getContent(), bannerCo.getLinkPicUrl()); |
162 | 163 | } |
163 | 164 | return Message.success(); | ... | ... |
etrade-admin/src/main/java/com/diligrp/etrade/admin/type/BannerLinkType.java
... | ... | @@ -7,9 +7,10 @@ import java.util.stream.Collectors; |
7 | 7 | import java.util.stream.Stream; |
8 | 8 | |
9 | 9 | public enum BannerLinkType implements EnumArrayValuableEnums { |
10 | - CONTACT(1,"电话"), | |
11 | - LINK(2,"链接"), | |
12 | - CONTENT(3,"内容"); | |
10 | + NONE(0,"无"), | |
11 | + CONTACT(10,"电话"), | |
12 | + LINK(20,"链接"), | |
13 | + CONTENT(30,"内容"); | |
13 | 14 | private Integer code; |
14 | 15 | private String value; |
15 | 16 | ... | ... |
etrade-admin/src/main/resources/com/diligrp/etrade/dao/mapper/BannerContentMapper.xml