diff --git a/pom.xml b/pom.xml
index bb8f0b072990e0e1d04c57547c9dbe1e57f58739..25781bfa1f9469848bd1dac597bd1cdd0d4395dd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,10 +25,8 @@
- xiaofuge
- 184172133@qq.com
- fuzhengwei
- https://github.com/fuzhengwei
+ 郭雨
+ 964587616@qq.com
diff --git a/xfg-frame-archetype-lite-app/src/main/java/cn/bugstack/Application.java b/xfg-frame-archetype-lite-app/src/main/java/cn/bugstack/Application.java
index 178667efde613076d32fab56b844fd0d846e7c29..cd00689454b247193a07c5191c299fb723e53b74 100644
--- a/xfg-frame-archetype-lite-app/src/main/java/cn/bugstack/Application.java
+++ b/xfg-frame-archetype-lite-app/src/main/java/cn/bugstack/Application.java
@@ -1,11 +1,15 @@
package cn.bugstack;
+import org.apache.ibatis.annotations.Mapper;
+import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@Configurable
+@EnableScheduling
public class Application {
public static void main(String[] args){
diff --git a/xfg-frame-archetype-lite-app/src/main/resources/application-dev.yml b/xfg-frame-archetype-lite-app/src/main/resources/application-dev.yml
index 0f3c50eedd2b0d5222df6921ad4fb5e1c81e21bd..bc097bb085531bbdd0f527c9adccd60012eba06a 100644
--- a/xfg-frame-archetype-lite-app/src/main/resources/application-dev.yml
+++ b/xfg-frame-archetype-lite-app/src/main/resources/application-dev.yml
@@ -17,7 +17,7 @@ spring:
datasource:
username: root
password: root
- url: jdbc:mysql://192.168.119.130/big_market?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC&useSSL=true
+ url: jdbc:mysql://117.7.2:3306/big_market?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC&useSSL=true
driver-class-name: com.mysql.cj.jdbc.Driver
hikari:
pool-name: Retail_HikariCP
@@ -30,9 +30,9 @@ spring:
connection-test-query: SELECT 1
type: com.zaxxer.hikari.HikariDataSource
-#mybatis:
-# mapper-locations: classpath:/mybatis/mapper/*.xml
-# config-location: classpath:/mybatis/config/mybatis-config.xml
+mybatis:
+ mapper-locations: classpath:/mybatis/mapper/*.xml
+ config-location: classpath:/mybatis/config/mybatis-config.xml
# 日志
logging:
diff --git a/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_award_mapper.xml b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_award_mapper.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4f9aea5a64d7ea59ed88b7e3e59ba4cf23430bf0
--- /dev/null
+++ b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_award_mapper.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ update strategy_award
+ set award_count_surplus = award_count_surplus - 1
+ where strategy_id = #{strategyId} and award_id = #{awardId} and award_count_surplus > 0
+
+
+
+
+
diff --git a/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_mapper.xml b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_mapper.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e31d3e3e63ace75d259ab1625e90e68c7d237140
--- /dev/null
+++ b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_mapper.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_rule_mapper.xml b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_rule_mapper.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6c060bbc1ade2a1449800603048f91d64ac91b57
--- /dev/null
+++ b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_rule_mapper.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/AwardDaoTest.java b/xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/AwardDaoTest.java
similarity index 79%
rename from xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/AwardDaoTest.java
rename to xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/AwardDaoTest.java
index 57c9915d00e8a7373fc82114fe49eae3111b40fc..5f77ecb587718ccfa65b4d5ecc07cf16761708f6 100644
--- a/xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/AwardDaoTest.java
+++ b/xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/AwardDaoTest.java
@@ -1,4 +1,4 @@
-package cn.bugstack.test;
+package cn.bugstack.test.infrastructure;
import cn.bugstack.infrastructure.persistent.dao.IAwardDao;
import cn.bugstack.infrastructure.persistent.po.Award;
@@ -6,6 +6,8 @@ import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IAwardDao.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IAwardDao.java
new file mode 100644
index 0000000000000000000000000000000000000000..501ce67c749bd2540876059bf05f9f26e3616bc0
--- /dev/null
+++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IAwardDao.java
@@ -0,0 +1,18 @@
+package cn.bugstack.infrastructure.persistent.dao;
+
+import cn.bugstack.infrastructure.persistent.po.Award;
+import org.apache.ibatis.annotations.Mapper;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author Hugohimself
+ * @description 奖品表DAO
+ */
+@Mapper
+public interface IAwardDao {
+
+ List queryAwardList();
+
+}
diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyAwardDao.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyAwardDao.java
new file mode 100644
index 0000000000000000000000000000000000000000..aee0dc8bb9e6c3d746ee68c9aa99b05c2ffb0531
--- /dev/null
+++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyAwardDao.java
@@ -0,0 +1,25 @@
+package cn.bugstack.infrastructure.persistent.dao;
+
+import cn.bugstack.infrastructure.persistent.po.StrategyAward;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * @author Hugohimself
+ * @description 抽奖策略奖品明细配置 - 概率、规则 DAO
+ */
+@Mapper
+public interface IStrategyAwardDao {
+
+ List queryStrategyAwardList();
+
+ List queryStrategyAwardListByStrategyId(Long strategyId);
+
+ String queryStrategyAwardRuleModels(StrategyAward strategyAward);
+
+ void updateStrategyAwardStock(StrategyAward strategyAward);
+
+ StrategyAward queryStrategyAward(StrategyAward strategyAwardReq);
+
+}
diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyDao.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyDao.java
new file mode 100644
index 0000000000000000000000000000000000000000..c57cd3e934b19c17d3182c04c4f20c56e49689c6
--- /dev/null
+++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyDao.java
@@ -0,0 +1,20 @@
+package cn.bugstack.infrastructure.persistent.dao;
+
+import cn.bugstack.infrastructure.persistent.po.Strategy;
+import cn.bugstack.infrastructure.persistent.po.StrategyAward;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * @author Hugohimself
+ * @description 抽奖策略 DAO
+ */
+@Mapper
+public interface IStrategyDao {
+
+ List queryStrategyList();
+
+ Strategy queryStrategyByStrategyId(Long strategyId);
+
+}
diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyRuleDao.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyRuleDao.java
new file mode 100644
index 0000000000000000000000000000000000000000..5238fa70a42593fd79f1200ff9337d785d464bdb
--- /dev/null
+++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyRuleDao.java
@@ -0,0 +1,22 @@
+package cn.bugstack.infrastructure.persistent.dao;
+
+import cn.bugstack.infrastructure.persistent.po.StrategyRule;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Hugohimself
+ * @description 策略规则 DAO
+ */
+@Mapper
+public interface IStrategyRuleDao {
+
+ List queryStrategyRuleList();
+
+ StrategyRule queryStrategyRule(StrategyRule strategyRuleReq);
+
+ String queryStrategyRuleValue(StrategyRule strategyRule);
+
+}
diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/Award.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/Award.java
new file mode 100644
index 0000000000000000000000000000000000000000..46371504313cc4b855ad8e078191e4928d39da0d
--- /dev/null
+++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/Award.java
@@ -0,0 +1,29 @@
+package cn.bugstack.infrastructure.persistent.po;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author Hugohimself
+ * @description 奖品表
+ */
+@Data
+public class Award {
+
+ /** 自增ID */
+ private Long id;
+ /** 抽奖奖品ID - 内部流转使用 */
+ private Integer awardId;
+ /** 奖品对接标识 - 每一个都是一个对应的发奖策略 */
+ private String awardKey;
+ /** 奖品配置信息 */
+ private String awardConfig;
+ /** 奖品内容描述 */
+ private String awardDesc;
+ /** 创建时间 */
+ private Date createTime;
+ /** 更新时间 */
+ private Date updateTime;
+
+}
diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/StrategyRule.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/StrategyRule.java
new file mode 100644
index 0000000000000000000000000000000000000000..bf279df3bc3321717a0a7b6321d5735633abb3b2
--- /dev/null
+++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/StrategyRule.java
@@ -0,0 +1,33 @@
+package cn.bugstack.infrastructure.persistent.po;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author Hugohimself
+ * @description 策略规则
+ */
+@Data
+public class StrategyRule {
+
+ /** 自增ID */
+ private Long id;
+ /** 抽奖策略ID */
+ private Long strategyId;
+ /** 抽奖奖品ID【规则类型为策略,则不需要奖品ID】 */
+ private Integer awardId;
+ /** 抽象规则类型;1-策略规则、2-奖品规则 */
+ private Integer ruleType;
+ /** 抽奖规则类型【rule_random - 随机值计算、rule_lock - 抽奖几次后解锁、rule_luck_award - 幸运奖(兜底奖品)】 */
+ private String ruleModel;
+ /** 抽奖规则比值 */
+ private String ruleValue;
+ /** 抽奖规则描述 */
+ private String ruleDesc;
+ /** 创建时间 */
+ private Date createTime;
+ /** 更新时间 */
+ private Date updateTime;
+
+}