diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000000000000000000000000000000000000..939b864560b496ba70ebf67e7b1d9e3066d90f91 --- /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 9dc782bb2dc9405aeea9f5a13ec0b6dd7d49baad..d5cd61439e42be16778fe0d90f206a2b02d987e8 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 208aed53fef202853a657977ec7b3746729b8a78..335102e0c5fd37196780457ddb38888f4004e0f5 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 0000000000000000000000000000000000000000..cd5f3712e1666313cd691ec914c6f599b8f81da3 --- /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 2c3f77af56c10912fab2cf604e6cbfef25098623..0000000000000000000000000000000000000000 --- 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 0000000000000000000000000000000000000000..e3f708cefc2f878c6a27cadb3ee7c2597d48fc97 --- /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 0000000000000000000000000000000000000000..5c08ebdfbc2044f226023a6d597087033ed693bf --- /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 0000000000000000000000000000000000000000..c1eb458eb266b28ac497b2b2a28e39de85365ed6 --- /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 0000000000000000000000000000000000000000..d1d88c4bccbc8c125e7c97525a521e9793bfde18 --- /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 0000000000000000000000000000000000000000..eaa99da0fa1c4144076b9afe3d6e5c477b86bfda --- /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 0000000000000000000000000000000000000000..0f789cfd7411bd9c266068fe4398c5c9a456f992 --- /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 0000000000000000000000000000000000000000..16951c7a01779a703a1c889fc441e77f80b34d3b --- /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 0000000000000000000000000000000000000000..6fd666496225c8e872cff7c46dfb29180efd1ad5 --- /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 bbb404c9337f8c407a33470c62682978543073ed..0000000000000000000000000000000000000000 --- 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 0000000000000000000000000000000000000000..141591af43b4aea5f166184d5e14dd38e5bbf58f --- /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 0000000000000000000000000000000000000000..0747197957028409f01c8e5096ebf95217b147f6 --- /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 0000000000000000000000000000000000000000..f4557a861be90e6351c94d1c04287f78b518a384 --- /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 0000000000000000000000000000000000000000..64832220f5a8078062e5f72002e7d1171b653cbf --- /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 d123c7c896642ac6a7bcf5b8604c3560e8133a4b..0000000000000000000000000000000000000000 --- 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