From 978e75735ffca68ee63a42b9a761ca0bc267212c Mon Sep 17 00:00:00 2001 From: ronger Date: Thu, 10 Dec 2020 16:24:11 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E8=B4=A7=E5=B8=81=E8=A7=84?= =?UTF-8?q?=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rymcu/forest/config/WebMvcConfigurer.java | 2 +- .../com/rymcu/forest/entity/CurrencyRule.java | 57 +++++++++++++++++++ .../forest/mapper/CurrencyRuleMapper.java | 10 ++++ .../forest/service/CurrencyRuleService.java | 10 ++++ .../service/impl/CurrencyRuleServiceImpl.java | 20 +++++++ .../web/api/rule/CurrencyRuleController.java | 30 ++++++++++ src/main/java/mapper/CurrencyRuleMapper.xml | 4 ++ 7 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/rymcu/forest/entity/CurrencyRule.java create mode 100644 src/main/java/com/rymcu/forest/mapper/CurrencyRuleMapper.java create mode 100644 src/main/java/com/rymcu/forest/service/CurrencyRuleService.java create mode 100644 src/main/java/com/rymcu/forest/service/impl/CurrencyRuleServiceImpl.java create mode 100644 src/main/java/com/rymcu/forest/web/api/rule/CurrencyRuleController.java create mode 100644 src/main/java/mapper/CurrencyRuleMapper.xml diff --git a/src/main/java/com/rymcu/forest/config/WebMvcConfigurer.java b/src/main/java/com/rymcu/forest/config/WebMvcConfigurer.java index f671a9a..d4a46c4 100644 --- a/src/main/java/com/rymcu/forest/config/WebMvcConfigurer.java +++ b/src/main/java/com/rymcu/forest/config/WebMvcConfigurer.java @@ -71,7 +71,7 @@ public class WebMvcConfigurer extends WebMvcConfigurationSupport { public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(restAuthTokenInterceptor()).addPathPatterns("/api/**") .excludePathPatterns("/api/v1/console/**", "/api/v1/article/articles/**", "/api/v1/article/detail/**" - , "/api/v1/topic/**", "/api/v1/user/**", "/api/v1/article/*/comments"); + , "/api/v1/topic/**", "/api/v1/user/**", "/api/v1/article/*/comments", "/api/v1/rule/currency/**"); } diff --git a/src/main/java/com/rymcu/forest/entity/CurrencyRule.java b/src/main/java/com/rymcu/forest/entity/CurrencyRule.java new file mode 100644 index 0000000..d0cae4d --- /dev/null +++ b/src/main/java/com/rymcu/forest/entity/CurrencyRule.java @@ -0,0 +1,57 @@ +package com.rymcu.forest.entity; + +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @author ronger + */ +@Table(name="vertical_currency_rule") +@Data +public class CurrencyRule implements Serializable, Cloneable { + /** + * 主键 + */ + @Id + @GeneratedValue(generator = "JDBC") + @Column(name = "id") + private Integer idCurrencyRule; + /** + * 规则名称 + */ + private String ruleName; + /** + * 规则标志(与枚举变量对应) + */ + private String ruleSign; + /** + * 规则描述 + */ + private String ruleDescription; + /** + * 金额 + */ + private BigDecimal money; + /** + * 奖励(0)/消耗(1)状态 + */ + private String awardStatus; + /** + * 上限金额 + */ + private BigDecimal maximumMoney; + /** + * 重复(0: 不重复,单位:天) + */ + private Integer repeatDays; + /** + * 状态 + */ + private String status; +} diff --git a/src/main/java/com/rymcu/forest/mapper/CurrencyRuleMapper.java b/src/main/java/com/rymcu/forest/mapper/CurrencyRuleMapper.java new file mode 100644 index 0000000..8e26f4e --- /dev/null +++ b/src/main/java/com/rymcu/forest/mapper/CurrencyRuleMapper.java @@ -0,0 +1,10 @@ +package com.rymcu.forest.mapper; + +import com.rymcu.forest.core.mapper.Mapper; +import com.rymcu.forest.entity.CurrencyRule; + +/** + * @author ronger + */ +public interface CurrencyRuleMapper extends Mapper { +} diff --git a/src/main/java/com/rymcu/forest/service/CurrencyRuleService.java b/src/main/java/com/rymcu/forest/service/CurrencyRuleService.java new file mode 100644 index 0000000..45bdf3b --- /dev/null +++ b/src/main/java/com/rymcu/forest/service/CurrencyRuleService.java @@ -0,0 +1,10 @@ +package com.rymcu.forest.service; + +import com.rymcu.forest.core.service.Service; +import com.rymcu.forest.entity.CurrencyRule; + +/** + * @author ronger + */ +public interface CurrencyRuleService extends Service { +} diff --git a/src/main/java/com/rymcu/forest/service/impl/CurrencyRuleServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/CurrencyRuleServiceImpl.java new file mode 100644 index 0000000..ff472ec --- /dev/null +++ b/src/main/java/com/rymcu/forest/service/impl/CurrencyRuleServiceImpl.java @@ -0,0 +1,20 @@ +package com.rymcu.forest.service.impl; + +import com.rymcu.forest.core.service.AbstractService; +import com.rymcu.forest.entity.CurrencyRule; +import com.rymcu.forest.mapper.CurrencyRuleMapper; +import com.rymcu.forest.service.CurrencyRuleService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +/** + * @author ronger + */ +@Service +public class CurrencyRuleServiceImpl extends AbstractService implements CurrencyRuleService { + + @Resource + private CurrencyRuleMapper currencyRuleMapper; + +} diff --git a/src/main/java/com/rymcu/forest/web/api/rule/CurrencyRuleController.java b/src/main/java/com/rymcu/forest/web/api/rule/CurrencyRuleController.java new file mode 100644 index 0000000..1ecd932 --- /dev/null +++ b/src/main/java/com/rymcu/forest/web/api/rule/CurrencyRuleController.java @@ -0,0 +1,30 @@ +package com.rymcu.forest.web.api.rule; + +import com.rymcu.forest.core.result.GlobalResult; +import com.rymcu.forest.core.result.GlobalResultGenerator; +import com.rymcu.forest.entity.CurrencyRule; +import com.rymcu.forest.service.CurrencyRuleService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @author ronger + */ +@RestController +@RequestMapping("/api/v1/rule/currency") +public class CurrencyRuleController { + + @Resource + private CurrencyRuleService currencyRuleService; + + @GetMapping("/list") + public GlobalResult list() { + List list = currencyRuleService.findAll(); + return GlobalResultGenerator.genSuccessResult(list); + } + +} diff --git a/src/main/java/mapper/CurrencyRuleMapper.xml b/src/main/java/mapper/CurrencyRuleMapper.xml new file mode 100644 index 0000000..7657e49 --- /dev/null +++ b/src/main/java/mapper/CurrencyRuleMapper.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file