Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
KnowledgePlanet
road-map
xfg-frame-archetype-lite
提交
41b321f5
xfg-frame-archetype-lite
项目概览
KnowledgePlanet
/
road-map
/
xfg-frame-archetype-lite
通知
1157
Star
58
Fork
71
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
xfg-frame-archetype-lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
41b321f5
编写于
3月 18, 2024
作者:
9
90-nk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
遇到了无法解决的报错,麻烦小傅哥帮忙看一下
上级
8f7e1057
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
273 addition
and
9 deletion
+273
-9
pom.xml
pom.xml
+2
-4
xfg-frame-archetype-lite-app/src/main/java/cn/bugstack/Application.java
...etype-lite-app/src/main/java/cn/bugstack/Application.java
+4
-0
xfg-frame-archetype-lite-app/src/main/resources/application-dev.yml
...archetype-lite-app/src/main/resources/application-dev.yml
+4
-4
xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_award_mapper.xml
...c/main/resources/mybatis/mapper/strategy_award_mapper.xml
+50
-0
xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_mapper.xml
...app/src/main/resources/mybatis/mapper/strategy_mapper.xml
+26
-0
xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_rule_mapper.xml
...rc/main/resources/mybatis/mapper/strategy_rule_mapper.xml
+37
-0
xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/AwardDaoTest.java
...st/java/cn/bugstack/test/infrastructure/AwardDaoTest.java
+3
-1
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IAwardDao.java
.../cn/bugstack/infrastructure/persistent/dao/IAwardDao.java
+18
-0
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyAwardDao.java
...tack/infrastructure/persistent/dao/IStrategyAwardDao.java
+25
-0
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyDao.java
.../bugstack/infrastructure/persistent/dao/IStrategyDao.java
+20
-0
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyRuleDao.java
...stack/infrastructure/persistent/dao/IStrategyRuleDao.java
+22
-0
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/Award.java
.../java/cn/bugstack/infrastructure/persistent/po/Award.java
+29
-0
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/StrategyRule.java
...n/bugstack/infrastructure/persistent/po/StrategyRule.java
+33
-0
未找到文件。
pom.xml
浏览文件 @
41b321f5
...
...
@@ -25,10 +25,8 @@
<developers>
<developer>
<name>
xiaofuge
</name>
<email>
184172133@qq.com
</email>
<organization>
fuzhengwei
</organization>
<organizationUrl>
https://github.com/fuzhengwei
</organizationUrl>
<name>
郭雨
</name>
<email>
964587616@qq.com
</email>
</developer>
</developers>
...
...
xfg-frame-archetype-lite-app/src/main/java/cn/bugstack/Application.java
浏览文件 @
41b321f5
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
){
...
...
xfg-frame-archetype-lite-app/src/main/resources/application-dev.yml
浏览文件 @
41b321f5
...
...
@@ -17,7 +17,7 @@ spring:
datasource
:
username
:
root
password
:
root
url
:
jdbc:mysql://1
92.168.119.130
/big_market?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC&useSSL=true
url
:
jdbc:mysql://1
17.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
:
...
...
xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_award_mapper.xml
0 → 100644
浏览文件 @
41b321f5
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.bugstack.infrastructure.persistent.dao.IStrategyAwardDao"
>
<resultMap
id=
"dataMap"
type=
"cn.bugstack.infrastructure.persistent.po.StrategyAward"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"strategy_id"
property=
"strategyId"
/>
<result
column=
"award_id"
property=
"awardId"
/>
<result
column=
"award_title"
property=
"awardTitle"
/>
<result
column=
"award_subtitle"
property=
"awardSubtitle"
/>
<result
column=
"award_count"
property=
"awardCount"
/>
<result
column=
"award_count_surplus"
property=
"awardCountSurplus"
/>
<result
column=
"award_rate"
property=
"awardRate"
/>
<result
column=
"rule_models"
property=
"ruleModels"
/>
<result
column=
"sort"
property=
"sort"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
</resultMap>
<select
id=
"queryStrategyAwardList"
resultMap=
"dataMap"
>
select strategy_id
from strategy_award
limit 10
</select>
<select
id=
"queryStrategyAwardListByStrategyId"
parameterType=
"java.lang.Long"
resultMap=
"dataMap"
>
select strategy_id, award_id, award_title, award_subtitle, award_count, award_count_surplus, award_rate, sort
from strategy_award
where strategy_id = #{strategyId}
order by sort asc
</select>
<select
id=
"queryStrategyAwardRuleModels"
parameterType=
"cn.bugstack.infrastructure.persistent.po.StrategyAward"
resultType=
"java.lang.String"
>
select rule_models from strategy_award
where strategy_id = #{strategyId} and award_id = #{awardId}
</select>
<update
id=
"updateStrategyAwardStock"
parameterType=
"cn.bugstack.infrastructure.persistent.po.StrategyAward"
>
update strategy_award
set award_count_surplus = award_count_surplus - 1
where strategy_id = #{strategyId} and award_id = #{awardId} and award_count_surplus > 0
</update>
<select
id=
"queryStrategyAward"
parameterType=
"cn.bugstack.infrastructure.persistent.po.StrategyAward"
resultMap=
"dataMap"
>
select strategy_id, award_id, award_title, award_subtitle, award_count, award_count_surplus, award_rate, rule_models, sort
from strategy_award
where strategy_id = #{strategyId} and award_id = #{awardId}
</select>
</mapper>
xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_mapper.xml
0 → 100644
浏览文件 @
41b321f5
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.bugstack.infrastructure.persistent.dao.IStrategyDao"
>
<resultMap
id=
"dataMap"
type=
"cn.bugstack.infrastructure.persistent.po.Strategy"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"strategy_id"
property=
"strategyId"
/>
<result
column=
"strategy_desc"
property=
"strategyDesc"
/>
<result
column=
"rule_models"
property=
"ruleModels"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
</resultMap>
<select
id=
"queryStrategyList"
resultMap=
"dataMap"
>
select strategy_id
from strategy
limit 10
</select>
<select
id=
"queryStrategyByStrategyId"
parameterType=
"java.lang.Long"
resultMap=
"dataMap"
>
select strategy_id, strategy_desc, rule_models
from strategy
where strategy_id = #{strategyId}
</select>
</mapper>
xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_rule_mapper.xml
0 → 100644
浏览文件 @
41b321f5
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.bugstack.infrastructure.persistent.dao.IStrategyRuleDao"
>
<resultMap
id=
"dataMap"
type=
"cn.bugstack.infrastructure.persistent.po.StrategyRule"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"strategy_id"
property=
"strategyId"
/>
<result
column=
"award_id"
property=
"awardId"
/>
<result
column=
"rule_type"
property=
"ruleType"
/>
<result
column=
"rule_model"
property=
"ruleModel"
/>
<result
column=
"rule_value"
property=
"ruleValue"
/>
<result
column=
"rule_desc"
property=
"ruleDesc"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
</resultMap>
<select
id=
"queryStrategyRuleList"
resultMap=
"dataMap"
>
select strategy_id
from strategy_rule
limit 10
</select>
<select
id=
"queryStrategyRule"
parameterType=
"cn.bugstack.infrastructure.persistent.po.StrategyRule"
resultMap=
"dataMap"
>
select strategy_id, award_id, rule_type, rule_model, rule_value, rule_desc
from strategy_rule
where strategy_id = #{strategyId} and rule_model = #{ruleModel}
</select>
<select
id=
"queryStrategyRuleValue"
parameterType=
"cn.bugstack.infrastructure.persistent.po.StrategyRule"
resultType=
"java.lang.String"
>
select rule_value from strategy_rule
where strategy_id = #{strategyId} and rule_model = #{ruleModel}
<if
test=
"awardId != null"
>
and award_id = #{awardId}
</if>
</select>
</mapper>
xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/AwardDaoTest.java
→
xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/
infrastructure/
AwardDaoTest.java
浏览文件 @
41b321f5
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
;
...
...
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IAwardDao.java
0 → 100644
浏览文件 @
41b321f5
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
<
Award
>
queryAwardList
();
}
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyAwardDao.java
0 → 100644
浏览文件 @
41b321f5
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
<
StrategyAward
>
queryStrategyAwardList
();
List
<
StrategyAward
>
queryStrategyAwardListByStrategyId
(
Long
strategyId
);
String
queryStrategyAwardRuleModels
(
StrategyAward
strategyAward
);
void
updateStrategyAwardStock
(
StrategyAward
strategyAward
);
StrategyAward
queryStrategyAward
(
StrategyAward
strategyAwardReq
);
}
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyDao.java
0 → 100644
浏览文件 @
41b321f5
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
<
Strategy
>
queryStrategyList
();
Strategy
queryStrategyByStrategyId
(
Long
strategyId
);
}
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyRuleDao.java
0 → 100644
浏览文件 @
41b321f5
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
<
StrategyRule
>
queryStrategyRuleList
();
StrategyRule
queryStrategyRule
(
StrategyRule
strategyRuleReq
);
String
queryStrategyRuleValue
(
StrategyRule
strategyRule
);
}
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/Award.java
0 → 100644
浏览文件 @
41b321f5
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
;
}
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/StrategyRule.java
0 → 100644
浏览文件 @
41b321f5
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
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录