Commit d46a5bd4c73a7fb6ebe1bddd6f1568ead41d5b25
1 parent
3fb60e80
获取链接类型枚举 --接口
Showing
2 changed files
with
24 additions
and
0 deletions
etrade-admin/src/main/java/com/diligrp/etrade/admin/controller/BannerController.java
@@ -7,6 +7,7 @@ import com.diligrp.etrade.admin.model.BannerType; | @@ -7,6 +7,7 @@ import com.diligrp.etrade.admin.model.BannerType; | ||
7 | import com.diligrp.etrade.admin.service.BannerService; | 7 | import com.diligrp.etrade.admin.service.BannerService; |
8 | import com.diligrp.etrade.admin.service.BannerTypeService; | 8 | import com.diligrp.etrade.admin.service.BannerTypeService; |
9 | import com.diligrp.etrade.admin.type.BannerDeleted; | 9 | import com.diligrp.etrade.admin.type.BannerDeleted; |
10 | +import com.diligrp.etrade.admin.type.BannerLinkType; | ||
10 | import com.diligrp.etrade.core.authority.SessionContext; | 11 | import com.diligrp.etrade.core.authority.SessionContext; |
11 | import com.diligrp.etrade.core.authority.UserTicket; | 12 | import com.diligrp.etrade.core.authority.UserTicket; |
12 | import com.diligrp.etrade.core.domain.Message; | 13 | import com.diligrp.etrade.core.domain.Message; |
@@ -18,6 +19,9 @@ import org.springframework.validation.annotation.Validated; | @@ -18,6 +19,9 @@ import org.springframework.validation.annotation.Validated; | ||
18 | import org.springframework.web.bind.annotation.*; | 19 | import org.springframework.web.bind.annotation.*; |
19 | 20 | ||
20 | import java.util.List; | 21 | import java.util.List; |
22 | +import java.util.Map; | ||
23 | +import java.util.stream.Collectors; | ||
24 | +import java.util.stream.Stream; | ||
21 | 25 | ||
22 | /** | 26 | /** |
23 | * 内容管理 - 首页轮播图管理 | 27 | * 内容管理 - 首页轮播图管理 |
@@ -123,4 +127,17 @@ public class BannerController { | @@ -123,4 +127,17 @@ public class BannerController { | ||
123 | return bannerTypeService.listAll(); | 127 | return bannerTypeService.listAll(); |
124 | } | 128 | } |
125 | 129 | ||
130 | + /** | ||
131 | + * @description: 获取链接类型枚举 | ||
132 | + * @date: 2024/9/14 14:27 | ||
133 | + * @param: [] | ||
134 | + * @return: com.diligrp.etrade.core.domain.Message<java.util.Map<java.lang.Integer,java.lang.String>> | ||
135 | + **/ | ||
136 | + @GetMapping(value = "/listBannerLinkType") | ||
137 | + public Message<Map<Integer, String>> listBannerLinkType() { | ||
138 | + Map<Integer, String> data = Stream.of(BannerLinkType.values()) | ||
139 | + .collect(Collectors.toMap(BannerLinkType::getCode, BannerLinkType::getValue)); | ||
140 | + return Message.success(data); | ||
141 | + } | ||
142 | + | ||
126 | } | 143 | } |
127 | \ No newline at end of file | 144 | \ No newline at end of file |
etrade-admin/src/main/java/com/diligrp/etrade/admin/domain/resp/BannerVo.java
1 | package com.diligrp.etrade.admin.domain.resp; | 1 | package com.diligrp.etrade.admin.domain.resp; |
2 | 2 | ||
3 | +import com.diligrp.etrade.admin.type.BannerLinkType; | ||
4 | +import com.diligrp.etrade.core.annotation.EnumStrategy; | ||
5 | +import com.diligrp.etrade.core.jackson.serializer.EnumStrategySerializer; | ||
6 | +import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
7 | + | ||
3 | import java.io.Serializable; | 8 | import java.io.Serializable; |
4 | import java.time.LocalDateTime; | 9 | import java.time.LocalDateTime; |
5 | 10 | ||
@@ -80,6 +85,8 @@ public class BannerVo implements Serializable { | @@ -80,6 +85,8 @@ public class BannerVo implements Serializable { | ||
80 | * 链接类型 | 85 | * 链接类型 |
81 | * {@link com.diligrp.etrade.admin.type.BannerLinkType} | 86 | * {@link com.diligrp.etrade.admin.type.BannerLinkType} |
82 | */ | 87 | */ |
88 | + @EnumStrategy(using = BannerLinkType.class) | ||
89 | + @JsonSerialize(using = EnumStrategySerializer.class) | ||
83 | private Integer linkType; | 90 | private Integer linkType; |
84 | 91 | ||
85 | /** | 92 | /** |