From a75995b628506212c62ee9727925729c4c79dcdf Mon Sep 17 00:00:00 2001 From: yongfeng <2283865573@qq.com> Date: Wed, 13 Nov 2024 23:08:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E5=B1=82=20=E6=8C=81?= =?UTF-8?q?=E4=B9=85=E5=8C=96=E6=90=AD=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/dataSources.xml | 17 ++++++++ .idea/misc.xml | 2 +- .../src/main/resources/application-dev.yml | 10 ++--- .../resources/mybatis/mapper/award_mapper.xml | 23 +++++++++++ .../mybatis/mapper/frame_case_mapper.xml | 25 ----------- .../mybatis/mapper/strategy_award_mapper.xml | 27 ++++++++++++ .../mybatis/mapper/strategy_mapper.xml | 20 +++++++++ .../mybatis/mapper/strategy_rule_mapper.xml | 24 +++++++++++ .../test/infrastructure/AwardDaoTest.java | 34 +++++++++++++++ .../infrastructure/dao/IAwardDao.java | 11 +++++ .../infrastructure/dao/IStrategyAwardDao.java | 10 +++++ .../infrastructure/dao/IStrategyDao.java | 10 +++++ .../infrastructure/dao/IStrategyRuleDao.java | 10 +++++ .../infrastructure/dao/package-info.java | 4 -- .../bugstack/infrastructure/dao/po/Award.java | 31 ++++++++++++++ .../infrastructure/dao/po/Strategy.java | 31 ++++++++++++++ .../infrastructure/dao/po/StrategyAward.java | 41 +++++++++++++++++++ .../infrastructure/dao/po/StrategyRule.java | 34 +++++++++++++++ .../infrastructure/dao/po/package-info.java | 4 -- 19 files changed, 329 insertions(+), 39 deletions(-) create mode 100644 .idea/dataSources.xml create mode 100644 xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/award_mapper.xml delete mode 100644 xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/frame_case_mapper.xml create mode 100644 xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_award_mapper.xml create mode 100644 xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_mapper.xml create mode 100644 xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_rule_mapper.xml create mode 100644 xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/AwardDaoTest.java create mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/IAwardDao.java create mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/IStrategyAwardDao.java create mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/IStrategyDao.java create mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/IStrategyRuleDao.java delete mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/package-info.java create mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/Award.java create mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/Strategy.java create mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/StrategyAward.java create mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/StrategyRule.java delete mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/package-info.java diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..939b864 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,17 @@ + + + + + mysql.8 + true + com.mysql.cj.jdbc.Driver + jdbc:mysql://localhost:13306 + + + + + + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 9dc782b..d5cd614 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,5 +8,5 @@ - + \ No newline at end of file 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 208aed5..335102e 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: 123456 - url: jdbc:mysql://127.0.0.1:3306/xfg_frame_archetype?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC&useSSL=true + url: jdbc:mysql://127.0.0.1:13306/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 @@ -29,10 +29,10 @@ spring: connection-timeout: 30000 #数据库连接超时时间,默认30秒,即30000 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配置 +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/award_mapper.xml b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/award_mapper.xml new file mode 100644 index 0000000..cd5f371 --- /dev/null +++ b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/award_mapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + diff --git a/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/frame_case_mapper.xml b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/frame_case_mapper.xml deleted file mode 100644 index 2c3f77a..0000000 --- a/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/frame_case_mapper.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - INSERT INTO table(a,b,c) VALUES(#{a}, #{b}, #{c}) - - - - UPDATE table SET a = #{a} WHERE b = #{b} - - - - - 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 0000000..e3f708c --- /dev/null +++ b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_award_mapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + 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 0000000..5c08ebd --- /dev/null +++ b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_mapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + 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 0000000..c1eb458 --- /dev/null +++ b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_rule_mapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/AwardDaoTest.java b/xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/AwardDaoTest.java new file mode 100644 index 0000000..d1d88c4 --- /dev/null +++ b/xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/AwardDaoTest.java @@ -0,0 +1,34 @@ +package cn.bugstack.test.infrastructure; + +import cn.bugstack.infrastructure.dao.IAwardDao; +import cn.bugstack.infrastructure.dao.po.Award; + +import lombok.extern.slf4j.Slf4j; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @ClassName: AwardDaoTest + * @Description: + * @Author: zhaoyongfeng + * @Date: 2024/11/13 21:12 + */ +@SpringBootTest +@Slf4j +@RunWith(SpringRunner.class) +public class AwardDaoTest { + + @Resource + private IAwardDao awardDao; + + @Test + public void Test_queryAwardList(){ + List awards = awardDao.queryAwardList(); + log.info("测试结果:{}",awards); + } +} diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/IAwardDao.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/IAwardDao.java new file mode 100644 index 0000000..eaa99da --- /dev/null +++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/IAwardDao.java @@ -0,0 +1,11 @@ +package cn.bugstack.infrastructure.dao; + +import cn.bugstack.infrastructure.dao.po.Award; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface IAwardDao { + List queryAwardList(); +} diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/IStrategyAwardDao.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/IStrategyAwardDao.java new file mode 100644 index 0000000..0f789cf --- /dev/null +++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/IStrategyAwardDao.java @@ -0,0 +1,10 @@ +package cn.bugstack.infrastructure.dao; + +import cn.bugstack.infrastructure.dao.po.Award; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +@Mapper +public interface IStrategyAwardDao { + List queryStrategyAwardList(); +} diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/IStrategyDao.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/IStrategyDao.java new file mode 100644 index 0000000..16951c7 --- /dev/null +++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/IStrategyDao.java @@ -0,0 +1,10 @@ +package cn.bugstack.infrastructure.dao; + +import cn.bugstack.infrastructure.dao.po.Award; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +@Mapper +public interface IStrategyDao { + List queryStrategyList(); +} diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/IStrategyRuleDao.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/IStrategyRuleDao.java new file mode 100644 index 0000000..6fd6664 --- /dev/null +++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/IStrategyRuleDao.java @@ -0,0 +1,10 @@ +package cn.bugstack.infrastructure.dao; + +import cn.bugstack.infrastructure.dao.po.Award; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +@Mapper +public interface IStrategyRuleDao { + List queryStrategyRuleList(); +} diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/package-info.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/package-info.java deleted file mode 100644 index bbb404c..0000000 --- a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * DAO 接口;IXxxDao - */ -package cn.bugstack.infrastructure.dao; \ No newline at end of file diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/Award.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/Award.java new file mode 100644 index 0000000..141591a --- /dev/null +++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/Award.java @@ -0,0 +1,31 @@ +package cn.bugstack.infrastructure.dao.po; + +import lombok.Data; + +import java.util.Date; + +/** + * @ClassName: Award + * @Description: + * @Author: zhaoyongfeng + * @Date: 2024/11/13 20:24 + */ +@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/dao/po/Strategy.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/Strategy.java new file mode 100644 index 0000000..0747197 --- /dev/null +++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/Strategy.java @@ -0,0 +1,31 @@ +package cn.bugstack.infrastructure.dao.po; + +import lombok.Data; + +import java.util.Date; + +/** + * @ClassName: Strategy + * @Description: + * @Author: zhaoyongfeng + * @Date: 2024/11/13 20:26 + */ +@Data +public class Strategy { + + /* ID*/ + private Long id; + + /* 抽奖策略描述*/ + private Long strategyId; + + /* 抽奖策略ID*/ + private String strategyDesc; + + /* 创建时间*/ + private Date createTime; + + /* 更新时间*/ + private Date updateTime; + +} diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/StrategyAward.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/StrategyAward.java new file mode 100644 index 0000000..f4557a8 --- /dev/null +++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/StrategyAward.java @@ -0,0 +1,41 @@ +package cn.bugstack.infrastructure.dao.po; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @ClassName: StrategyAward + * @Description: + * @Author: zhaoyongfeng + * @Date: 2024/11/13 20:46 + */ +@Data +public class StrategyAward { + /** 自增ID */ + private Long id; + /** 抽奖策略ID */ + private Long strategyId; + /** 抽奖奖品ID - 内部流转使用 */ + private Integer awardId; + /** 抽奖奖品标题 */ + private String awardTitle; + /** 抽奖奖品副标题 */ + private String awardSubtitle; + /** 奖品库存总量 */ + private Integer awardCount; + /** 奖品库存剩余 */ + private Integer awardCountSurplus; + /** 奖品中奖概率 */ + private BigDecimal awardRate; + /** 规则模型,rule配置的模型同步到此表,便于使用 */ + private String ruleModels; + /** 排序 */ + private Integer sort; + /** 创建时间 */ + private Date createTime; + /** 修改时间 */ + private Date updateTime; + +} diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/StrategyRule.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/StrategyRule.java new file mode 100644 index 0000000..6483222 --- /dev/null +++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/StrategyRule.java @@ -0,0 +1,34 @@ +package cn.bugstack.infrastructure.dao.po; + +import lombok.Data; + +import java.util.Date; + +/** + * @ClassName: StrategyRule + * @Description: + * @Author: zhaoyongfeng + * @Date: 2024/11/13 20:47 + */ +@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; + +} diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/package-info.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/package-info.java deleted file mode 100644 index d123c7c..0000000 --- a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * 持久化对象;XxxPO 最后的 PO 是大写,UserPO - */ -package cn.bugstack.infrastructure.dao.po; \ No newline at end of file -- GitLab