Commit fed9302911e07d23118ddb7a485c41071ad766e7

Authored by qinkelan@diligrp.com
1 parent b9fca177

链接类型不能为空

etrade-admin/src/main/java/com/diligrp/etrade/admin/domain/req/BannerCo.java
... ... @@ -44,6 +44,7 @@ public class BannerCo implements Serializable {
44 44 * 链接类型
45 45 * {@link com.diligrp.etrade.admin.type.BannerLinkType}
46 46 */
  47 + @NotNull(message = "链接类型不能为空")
47 48 private Integer linkType;
48 49  
49 50 /**
... ...
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
... ... @@ -28,7 +28,8 @@
28 28 banner_id = #{bannerId,jdbcType=BIGINT},
29 29 content = #{content,jdbcType=VARCHAR},
30 30 pic_url = #{picUrl,jdbcType=VARCHAR},
31   - where id = #{id,jdbcType=BIGINT}
  31 + where
  32 + id = #{id,jdbcType=BIGINT}
32 33 </update>
33 34  
34 35 <!-- 根据市场查询 -->
... ...