Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
KnowledgePlanet
road-map
xfg-frame-archetype-lite
提交
8aa8d5e3
xfg-frame-archetype-lite
项目概览
KnowledgePlanet
/
road-map
/
xfg-frame-archetype-lite
通知
1731
Star
86
Fork
101
代码
文件
提交
分支
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看板
提交
8aa8d5e3
编写于
3月 14, 2025
作者:
R
Rcq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: orm基础层 持久化数据
上级
91d74573
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
504 addition
and
116 deletion
+504
-116
docs/dev-ops/mysql/sql/xfg-frame-archetype.sql
docs/dev-ops/mysql/sql/xfg-frame-archetype.sql
+172
-104
xfg-frame-archetype-lite-app/pom.xml
xfg-frame-archetype-lite-app/pom.xml
+6
-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/application.yml
...ame-archetype-lite-app/src/main/resources/application.yml
+4
-0
xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/award_mapper.xml
...te-app/src/main/resources/mybatis/mapper/award_mapper.xml
+22
-0
xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_award_mapper.xml
...c/main/resources/mybatis/mapper/strategy_award_mapper.xml
+26
-0
xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_mapper.xml
...app/src/main/resources/mybatis/mapper/strategy_mapper.xml
+21
-0
xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_rule_mapper.xml
...rc/main/resources/mybatis/mapper/strategy_rule_mapper.xml
+24
-0
xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/AwardDaoTest.java
...st/java/cn/bugstack/test/infrastructure/AwardDaoTest.java
+33
-0
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/package-info.java
...ain/java/cn/bugstack/infrastructure/dao/package-info.java
+0
-4
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/package-info.java
.../java/cn/bugstack/infrastructure/dao/po/package-info.java
+0
-4
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IAwardDao.java
.../cn/bugstack/infrastructure/persistent/dao/IAwardDao.java
+21
-0
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyAwardDao.java
...tack/infrastructure/persistent/dao/IStrategyAwardDao.java
+15
-0
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyDao.java
.../bugstack/infrastructure/persistent/dao/IStrategyDao.java
+14
-0
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyRuleDao.java
...stack/infrastructure/persistent/dao/IStrategyRuleDao.java
+17
-0
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/Award.java
.../java/cn/bugstack/infrastructure/persistent/po/Award.java
+23
-0
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/Strategy.java
...va/cn/bugstack/infrastructure/persistent/po/Strategy.java
+25
-0
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/StrategyAward.java
.../bugstack/infrastructure/persistent/po/StrategyAward.java
+44
-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
未找到文件。
docs/dev-ops/mysql/sql/xfg-frame-archetype.sql
浏览文件 @
8aa8d5e3
/*
Navicat Premium Data Transfer
#
************************************************************
#
Sequel
Ace
SQL
dump
#
版本号:
20050
#
#
https
:
//
sequel
-
ace
.
com
/
#
https
:
//
github
.
com
/
Sequel
-
Ace
/
Sequel
-
Ace
#
#
主机
:
127
.
0
.
0
.
1
(
MySQL
5
.
6
.
39
)
#
数据库
:
big_market
#
生成时间
:
2023
-
12
-
09
05
:
48
:
32
+
0000
#
************************************************************
Source Server : 127.0.0.1
Source Server Type : MySQL
Source Server Version : 50639
Source Host : localhost:3306
Source Schema : road-map
Target Server Type : MySQL
Target Server Version : 50639
File Encoding : 65001
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */
;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */
;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */
;
SET
NAMES
utf8mb4
;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */
;
/*!40101 SET @OLD_SQL_MODE='NO_AUTO_VALUE_ON_ZERO', SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */
;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */
;
Date: 15/07/2023 09:26:39
*/
CREATE
database
if
NOT
EXISTS
`big_market`
default
character
set
utf8mb4
collate
utf8mb4_0900_ai_ci
;
use
`big_market`
;
SET
NAMES
utf8mb4
;
SET
FOREIGN_KEY_CHECKS
=
0
;
CREATE
database
if
NOT
EXISTS
`xfg_frame_archetype`
default
character
set
utf8mb4
collate
utf8mb4_0900_ai_ci
;
use
`xfg_frame_archetype`
;
-- ----------------------------
-- Table structure for employee
-- ----------------------------
DROP
TABLE
IF
EXISTS
`employee`
;
CREATE
TABLE
`employee`
(
`id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
,
`employee_number`
varchar
(
16
)
NOT
NULL
DEFAULT
''
COMMENT
'雇员ID'
,
`employee_name`
varchar
(
32
)
NOT
NULL
DEFAULT
''
COMMENT
'雇员姓名'
,
`employee_level`
varchar
(
8
)
NOT
NULL
DEFAULT
''
COMMENT
'雇员级别'
,
`employee_title`
varchar
(
16
)
NOT
NULL
DEFAULT
''
COMMENT
'雇员岗位Title'
,
`create_time`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`update_time`
datetime
NOT
NULL
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`idx_employee_number`
(
`employee_number`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
40
DEFAULT
CHARSET
=
utf8
;
-- ----------------------------
-- Records of employee
-- ----------------------------
BEGIN
;
INSERT
INTO
`employee`
VALUES
(
1
,
'10000001'
,
'sXvfDpsWnJdLsCVk64tJgw=='
,
'T-3'
,
'中级工程师'
,
'2023-07-14 15:26:26'
,
'2023-07-14 15:26:26'
);
INSERT
INTO
`employee`
VALUES
(
2
,
'10000010'
,
'sXvfDpsWnJdLsCVk64tJgw=='
,
'T2'
,
'见习工程师'
,
'2023-07-14 15:34:40'
,
'2023-07-14 15:34:40'
);
INSERT
INTO
`employee`
VALUES
(
3
,
'10000011'
,
'sXvfDpsWnJdLsCVk64tJgw=='
,
'T2'
,
'见习工程师'
,
'2023-07-14 15:34:40'
,
'2023-07-14 15:34:40'
);
INSERT
INTO
`employee`
VALUES
(
4
,
'10000012'
,
'sXvfDpsWnJdLsCVk64tJgw=='
,
'T2'
,
'见习工程师'
,
'2023-07-14 15:34:40'
,
'2023-07-14 15:34:40'
);
INSERT
INTO
`employee`
VALUES
(
5
,
'10000013'
,
'sXvfDpsWnJdLsCVk64tJgw=='
,
'T2'
,
'见习工程师'
,
'2023-07-14 15:34:40'
,
'2023-07-14 15:34:40'
);
INSERT
INTO
`employee`
VALUES
(
6
,
'10000014'
,
'sXvfDpsWnJdLsCVk64tJgw=='
,
'T2'
,
'见习工程师'
,
'2023-07-14 15:34:40'
,
'2023-07-14 15:34:40'
);
INSERT
INTO
`employee`
VALUES
(
9
,
'10000002'
,
'sXvfDpsWnJdLsCVk64tJgw=='
,
'T2'
,
'见习工程师'
,
'2023-07-15 07:42:52'
,
'2023-07-15 07:42:52'
);
INSERT
INTO
`employee`
VALUES
(
22
,
'10000015'
,
'hMCgLG6WV3CsNBQ1UD6PEQ=='
,
'T2'
,
'见习工程师'
,
'2023-07-15 08:02:31'
,
'2023-07-15 08:02:31'
);
INSERT
INTO
`employee`
VALUES
(
23
,
'10000016'
,
'hMCgLG6WV3CsNBQ1UD6PEQ=='
,
'T2'
,
'见习工程师'
,
'2023-07-15 08:02:31'
,
'2023-07-15 08:02:31'
);
INSERT
INTO
`employee`
VALUES
(
24
,
'10000017'
,
'hMCgLG6WV3CsNBQ1UD6PEQ=='
,
'T2'
,
'见习工程师'
,
'2023-07-15 08:02:31'
,
'2023-07-15 08:02:31'
);
INSERT
INTO
`employee`
VALUES
(
39
,
'10000022'
,
'GyG+V0r6mBCNsdusuKl03g=='
,
'T1'
,
'实习工程师'
,
'2023-07-15 09:17:49'
,
'2023-07-15 09:17:49'
);
COMMIT
;
-- ----------------------------
-- Table structure for employee_salary
-- ----------------------------
DROP
TABLE
IF
EXISTS
`employee_salary`
;
CREATE
TABLE
`employee_salary`
(
`id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
,
`employee_number`
varchar
(
16
)
NOT
NULL
DEFAULT
''
COMMENT
'雇员编号'
,
`salary_total_amount`
decimal
(
8
,
2
)
NOT
NULL
COMMENT
'薪资总额'
,
`salary_merit_amount`
decimal
(
8
,
2
)
NOT
NULL
COMMENT
'绩效工资'
,
`salary_base_amount`
decimal
(
8
,
2
)
NOT
NULL
COMMENT
'基础工资'
,
`create_time`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`update_time`
datetime
DEFAULT
NULL
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
),
KEY
`idx_employee_number`
(
`employee_number`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
9
DEFAULT
CHARSET
=
utf8
;
-- ----------------------------
-- Records of employee_salary
-- ----------------------------
BEGIN
;
INSERT
INTO
`employee_salary`
VALUES
(
1
,
'10000001'
,
5100
.
00
,
1020
.
00
,
4080
.
00
,
'2023-07-14 16:09:06'
,
'2023-07-14 16:09:06'
);
INSERT
INTO
`employee_salary`
VALUES
(
2
,
'10000010'
,
5000
.
00
,
1000
.
00
,
4000
.
00
,
'2023-07-14 16:17:10'
,
'2023-07-14 16:17:10'
);
INSERT
INTO
`employee_salary`
VALUES
(
3
,
'10000011'
,
5000
.
00
,
1000
.
00
,
4000
.
00
,
'2023-07-14 16:17:10'
,
'2023-07-14 16:17:10'
);
INSERT
INTO
`employee_salary`
VALUES
(
4
,
'10000012'
,
5000
.
00
,
1000
.
00
,
4000
.
00
,
'2023-07-14 16:17:10'
,
'2023-07-14 16:17:10'
);
INSERT
INTO
`employee_salary`
VALUES
(
5
,
'10000013'
,
5000
.
00
,
1000
.
00
,
4000
.
00
,
'2023-07-14 16:17:10'
,
'2023-07-14 16:17:10'
);
INSERT
INTO
`employee_salary`
VALUES
(
6
,
'10000014'
,
5000
.
00
,
1000
.
00
,
4000
.
00
,
'2023-07-14 16:17:10'
,
'2023-07-14 16:17:10'
);
INSERT
INTO
`employee_salary`
VALUES
(
8
,
'10000022'
,
100
.
00
,
10
.
00
,
90
.
00
,
'2023-07-15 09:17:49'
,
'2023-07-15 09:17:49'
);
COMMIT
;
-- ----------------------------
-- Table structure for employee_salary_adjust
-- ----------------------------
DROP
TABLE
IF
EXISTS
`employee_salary_adjust`
;
CREATE
TABLE
`employee_salary_adjust`
(
`id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
,
`employee_number`
varchar
(
16
)
NOT
NULL
DEFAULT
''
COMMENT
'雇员编号'
,
`adjust_order_id`
varchar
(
32
)
NOT
NULL
DEFAULT
''
COMMENT
'调薪单号'
,
`adjust_total_amount`
decimal
(
8
,
2
)
NOT
NULL
COMMENT
'总额调薪'
,
`adjust_base_amount`
decimal
(
8
,
2
)
NOT
NULL
COMMENT
'基础调薪'
,
`adjust_merit_amount`
decimal
(
8
,
2
)
NOT
NULL
COMMENT
'绩效调薪'
,
`create_time`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`update_time`
datetime
NOT
NULL
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`idx_order_id`
(
`adjust_order_id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
3
DEFAULT
CHARSET
=
utf8
;
-- ----------------------------
-- Records of employee_salary_adjust
-- ----------------------------
BEGIN
;
INSERT
INTO
`employee_salary_adjust`
VALUES
(
1
,
'10000001'
,
'109089990198888811'
,
1000
.
00
,
800
.
00
,
200
.
00
,
'2023-07-14 16:55:53'
,
'2023-07-14 16:55:53'
);
INSERT
INTO
`employee_salary_adjust`
VALUES
(
2
,
'10000001'
,
'100908977676001'
,
100
.
00
,
20
.
00
,
80
.
00
,
'2023-07-14 21:57:39'
,
'2023-07-14 21:57:39'
);
COMMIT
;
\ No newline at end of file
#
转储表
award
#
------------------------------------------------------------
DROP
TABLE
IF
EXISTS
`award`
;
CREATE
TABLE
`award`
(
`id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增ID'
,
`award_id`
int
(
8
)
NOT
NULL
COMMENT
'抽奖奖品ID - 内部流转使用'
,
`award_key`
varchar
(
32
)
NOT
NULL
COMMENT
'奖品对接标识 - 每一个都是一个对应的发奖策略'
,
`award_config`
varchar
(
32
)
NOT
NULL
COMMENT
'奖品配置信息'
,
`award_desc`
varchar
(
128
)
NOT
NULL
COMMENT
'奖品内容描述'
,
`create_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`update_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
;
LOCK
TABLES
`award`
WRITE
;
/*!40000 ALTER TABLE `award` DISABLE KEYS */
;
INSERT
INTO
`award`
(
`id`
,
`award_id`
,
`award_key`
,
`award_config`
,
`award_desc`
,
`create_time`
,
`update_time`
)
VALUES
(
1
,
101
,
'user_credit_random'
,
'1,100'
,
'用户积分【优先透彻规则范围,如果没有则走配置】'
,
'2023-12-09 11:07:06'
,
'2023-12-09 11:21:31'
),
(
2
,
102
,
'openai_use_count'
,
'5'
,
'OpenAI 增加使用次数'
,
'2023-12-09 11:07:06'
,
'2023-12-09 11:12:59'
),
(
3
,
103
,
'openai_use_count'
,
'10'
,
'OpenAI 增加使用次数'
,
'2023-12-09 11:07:06'
,
'2023-12-09 11:12:59'
),
(
4
,
104
,
'openai_use_count'
,
'20'
,
'OpenAI 增加使用次数'
,
'2023-12-09 11:07:06'
,
'2023-12-09 11:12:58'
),
(
5
,
105
,
'openai_model'
,
'gpt-4'
,
'OpenAI 增加模型'
,
'2023-12-09 11:07:06'
,
'2023-12-09 11:12:01'
),
(
6
,
106
,
'openai_model'
,
'dall-e-2'
,
'OpenAI 增加模型'
,
'2023-12-09 11:07:06'
,
'2023-12-09 11:12:08'
),
(
7
,
107
,
'openai_model'
,
'dall-e-3'
,
'OpenAI 增加模型'
,
'2023-12-09 11:07:06'
,
'2023-12-09 11:12:10'
),
(
8
,
108
,
'openai_use_count'
,
'100'
,
'OpenAI 增加使用次数'
,
'2023-12-09 11:07:06'
,
'2023-12-09 11:12:55'
),
(
9
,
109
,
'openai_model'
,
'gpt-4,dall-e-2,dall-e-3'
,
'OpenAI 增加模型'
,
'2023-12-09 11:07:06'
,
'2023-12-09 11:12:39'
);
/*!40000 ALTER TABLE `award` ENABLE KEYS */
;
UNLOCK
TABLES
;
#
转储表
strategy
#
------------------------------------------------------------
DROP
TABLE
IF
EXISTS
`strategy`
;
CREATE
TABLE
`strategy`
(
`id`
bigint
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增ID'
,
`strategy_id`
bigint
(
8
)
NOT
NULL
COMMENT
'抽奖策略ID'
,
`strategy_desc`
varchar
(
128
)
NOT
NULL
COMMENT
'抽奖策略描述'
,
`create_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`update_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
),
KEY
`idx_strategy_id`
(
`strategy_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
;
LOCK
TABLES
`strategy`
WRITE
;
/*!40000 ALTER TABLE `strategy` DISABLE KEYS */
;
INSERT
INTO
`strategy`
(
`id`
,
`strategy_id`
,
`strategy_desc`
,
`create_time`
,
`update_time`
)
VALUES
(
1
,
100001
,
'抽奖策略'
,
'2023-12-09 09:37:19'
,
'2023-12-09 09:37:19'
);
/*!40000 ALTER TABLE `strategy` ENABLE KEYS */
;
UNLOCK
TABLES
;
#
转储表
strategy_award
#
------------------------------------------------------------
DROP
TABLE
IF
EXISTS
`strategy_award`
;
CREATE
TABLE
`strategy_award`
(
`id`
bigint
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增ID'
,
`strategy_id`
bigint
(
8
)
NOT
NULL
COMMENT
'抽奖策略ID'
,
`award_id`
int
(
8
)
NOT
NULL
COMMENT
'抽奖奖品ID - 内部流转使用'
,
`award_title`
varchar
(
128
)
NOT
NULL
COMMENT
'抽奖奖品标题'
,
`award_subtitle`
varchar
(
128
)
DEFAULT
NULL
COMMENT
'抽奖奖品副标题'
,
`award_count`
int
(
8
)
NOT
NULL
DEFAULT
'0'
COMMENT
'奖品库存总量'
,
`award_count_surplus`
int
(
8
)
NOT
NULL
DEFAULT
'0'
COMMENT
'奖品库存剩余'
,
`award_rate`
decimal
(
6
,
4
)
NOT
NULL
COMMENT
'奖品中奖概率'
,
`rule_models`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'规则模型,rule配置的模型同步到此表,便于使用'
,
`sort`
int
(
2
)
NOT
NULL
DEFAULT
'0'
COMMENT
'排序'
,
`create_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`update_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'修改时间'
,
PRIMARY
KEY
(
`id`
),
KEY
`idx_strategy_id_award_id`
(
`strategy_id`
,
`award_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
;
LOCK
TABLES
`strategy_award`
WRITE
;
/*!40000 ALTER TABLE `strategy_award` DISABLE KEYS */
;
INSERT
INTO
`strategy_award`
(
`id`
,
`strategy_id`
,
`award_id`
,
`award_title`
,
`award_subtitle`
,
`award_count`
,
`award_count_surplus`
,
`award_rate`
,
`rule_models`
,
`sort`
,
`create_time`
,
`update_time`
)
VALUES
(
1
,
100001
,
101
,
'随机积分'
,
NULL
,
80000
,
80000
,
80
.
0000
,
'rule_random,rule_luck_award'
,
1
,
'2023-12-09 09:38:31'
,
'2023-12-09 10:58:06'
),
(
2
,
100001
,
102
,
'5次使用'
,
NULL
,
10000
,
10000
,
10
.
0000
,
'rule_luck_award'
,
2
,
'2023-12-09 09:39:18'
,
'2023-12-09 10:34:23'
),
(
3
,
100001
,
103
,
'10次使用'
,
NULL
,
5000
,
5000
,
5
.
0000
,
'rule_luck_award'
,
3
,
'2023-12-09 09:42:36'
,
'2023-12-09 10:34:24'
),
(
4
,
100001
,
104
,
'20次使用'
,
NULL
,
4000
,
4000
,
4
.
0000
,
'rule_luck_award'
,
4
,
'2023-12-09 09:43:15'
,
'2023-12-09 10:34:25'
),
(
5
,
100001
,
105
,
'增加gpt-4对话模型'
,
NULL
,
600
,
600
,
0
.
6000
,
'rule_luck_award'
,
5
,
'2023-12-09 09:43:47'
,
'2023-12-09 10:34:26'
),
(
6
,
100001
,
106
,
'增加dall-e-2画图模型'
,
NULL
,
200
,
200
,
0
.
2000
,
'rule_luck_award'
,
6
,
'2023-12-09 09:44:20'
,
'2023-12-09 10:34:26'
),
(
7
,
100001
,
107
,
'增加dall-e-3画图模型'
,
'抽奖1次后解锁'
,
200
,
200
,
0
.
2000
,
'rule_lock,rule_luck_award'
,
7
,
'2023-12-09 09:45:38'
,
'2023-12-09 10:30:59'
),
(
8
,
100001
,
108
,
'增加100次使用'
,
'抽奖2次后解锁'
,
199
,
199
,
0
.
1999
,
'rule_lock,rule_luck_award'
,
8
,
'2023-12-09 09:46:02'
,
'2023-12-09 12:20:52'
),
(
9
,
100001
,
109
,
'解锁全部模型'
,
'抽奖6次后解锁'
,
1
,
1
,
0
.
0001
,
'rule_lock,rule_luck_award'
,
9
,
'2023-12-09 09:46:39'
,
'2023-12-09 12:20:50'
);
/*!40000 ALTER TABLE `strategy_award` ENABLE KEYS */
;
UNLOCK
TABLES
;
#
转储表
strategy_rule
#
------------------------------------------------------------
DROP
TABLE
IF
EXISTS
`strategy_rule`
;
CREATE
TABLE
`strategy_rule`
(
`id`
bigint
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增ID'
,
`strategy_id`
int
(
8
)
NOT
NULL
COMMENT
'抽奖策略ID'
,
`award_id`
int
(
8
)
DEFAULT
NULL
COMMENT
'抽奖奖品ID【规则类型为策略,则不需要奖品ID】'
,
`rule_type`
tinyint
(
1
)
NOT
NULL
DEFAULT
'0'
COMMENT
'抽象规则类型;1-策略规则、2-奖品规则'
,
`rule_model`
varchar
(
16
)
NOT
NULL
COMMENT
'抽奖规则类型【rule_random - 随机值计算、rule_lock - 抽奖几次后解锁、rule_luck_award - 幸运奖(兜底奖品)】'
,
`rule_value`
varchar
(
64
)
NOT
NULL
COMMENT
'抽奖规则比值'
,
`rule_desc`
varchar
(
128
)
NOT
NULL
COMMENT
'抽奖规则描述'
,
`create_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`update_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
),
KEY
`idx_strategy_id_award_id`
(
`strategy_id`
,
`award_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
;
LOCK
TABLES
`strategy_rule`
WRITE
;
/*!40000 ALTER TABLE `strategy_rule` DISABLE KEYS */
;
INSERT
INTO
`strategy_rule`
(
`id`
,
`strategy_id`
,
`award_id`
,
`rule_type`
,
`rule_model`
,
`rule_value`
,
`rule_desc`
,
`create_time`
,
`update_time`
)
VALUES
(
1
,
100001
,
101
,
2
,
'rule_random'
,
'1,1000'
,
'随机积分策略'
,
'2023-12-09 10:05:30'
,
'2023-12-09 12:55:52'
),
(
2
,
100001
,
107
,
2
,
'rule_lock'
,
'1'
,
'抽奖1次后解锁'
,
'2023-12-09 10:16:41'
,
'2023-12-09 12:55:53'
),
(
3
,
100001
,
108
,
2
,
'rule_lock'
,
'2'
,
'抽奖2次后解锁'
,
'2023-12-09 10:17:43'
,
'2023-12-09 12:55:54'
),
(
4
,
100001
,
109
,
2
,
'rule_lock'
,
'6'
,
'抽奖6次后解锁'
,
'2023-12-09 10:17:43'
,
'2023-12-09 12:55:54'
),
(
5
,
100001
,
107
,
2
,
'rule_luck_award'
,
'1,100'
,
'兜底奖品100以内随机积分'
,
'2023-12-09 10:30:12'
,
'2023-12-09 12:55:55'
),
(
6
,
100001
,
108
,
2
,
'rule_luck_award'
,
'1,100'
,
'兜底奖品100以内随机积分'
,
'2023-12-09 10:30:43'
,
'2023-12-09 12:55:56'
),
(
7
,
100001
,
101
,
2
,
'rule_luck_award'
,
'1,10'
,
'兜底奖品10以内随机积分'
,
'2023-12-09 10:30:43'
,
'2023-12-09 12:55:57'
),
(
8
,
100001
,
102
,
2
,
'rule_luck_award'
,
'1,20'
,
'兜底奖品20以内随机积分'
,
'2023-12-09 10:30:43'
,
'2023-12-09 12:55:57'
),
(
9
,
100001
,
103
,
2
,
'rule_luck_award'
,
'1,30'
,
'兜底奖品30以内随机积分'
,
'2023-12-09 10:30:43'
,
'2023-12-09 12:55:58'
),
(
10
,
100001
,
104
,
2
,
'rule_luck_award'
,
'1,40'
,
'兜底奖品40以内随机积分'
,
'2023-12-09 10:30:43'
,
'2023-12-09 12:55:59'
),
(
11
,
100001
,
105
,
2
,
'rule_luck_award'
,
'1,50'
,
'兜底奖品50以内随机积分'
,
'2023-12-09 10:30:43'
,
'2023-12-09 12:56:00'
),
(
12
,
100001
,
106
,
2
,
'rule_luck_award'
,
'1,60'
,
'兜底奖品60以内随机积分'
,
'2023-12-09 10:30:43'
,
'2023-12-09 12:56:00'
),
(
13
,
100001
,
NULL
,
1
,
'rule_weight'
,
'6000,102,103,104,105,106,107,108,109'
,
'消耗6000分,必中奖范围'
,
'2023-12-09 10:30:43'
,
'2023-12-09 12:58:21'
),
(
14
,
100001
,
NULL
,
1
,
'rule_blacklist'
,
'1'
,
'黑名单抽奖,积分兜底'
,
'2023-12-09 12:59:45'
,
'2023-12-09 13:42:23'
);
/*!40000 ALTER TABLE `strategy_rule` ENABLE KEYS */
;
UNLOCK
TABLES
;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */
;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */
;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */
;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */
;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */
;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */
;
xfg-frame-archetype-lite-app/pom.xml
浏览文件 @
8aa8d5e3
...
...
@@ -88,6 +88,12 @@
<groupId>
cn.bugstack
</groupId>
<artifactId>
xfg-frame-archetype-lite-infrastructure
</artifactId>
</dependency>
<dependency>
<groupId>
org.testng
</groupId>
<artifactId>
testng
</artifactId>
<version>
RELEASE
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
...
...
xfg-frame-archetype-lite-app/src/main/resources/application-dev.yml
浏览文件 @
8aa8d5e3
...
...
@@ -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
...
...
@@ -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/application.yml
浏览文件 @
8aa8d5e3
# 总配置 用来选择配置项
# dev:开发环境
# prod: 生产环境 线上
# test: 测试环境
spring
:
config
:
name
:
xfg-frame-archetype-lite-app
...
...
xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/award_mapper.xml
0 → 100644
浏览文件 @
8aa8d5e3
<?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.IAwardDao"
>
<resultMap
id=
"dataMap"
type=
"cn.bugstack.infrastructure.persistent.po.Award"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"award_id"
property=
"awardId"
/>
<result
column=
"award_key"
property=
"awardKey"
/>
<result
column=
"award_config"
property=
"awardConfig"
/>
<result
column=
"award_desc"
property=
"awardDesc"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
</resultMap>
<select
id=
"queryAwardList"
resultMap=
"dataMap"
>
select award_id, award_key, award_config, award_desc, create_time, update_time
from award
limit 10
</select>
</mapper>
xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_award_mapper.xml
0 → 100644
浏览文件 @
8aa8d5e3
<?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>
</mapper>
xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/
frame_case
_mapper.xml
→
xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/
strategy
_mapper.xml
浏览文件 @
8aa8d5e3
<?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.
redis.dao.Xxx
"
>
<mapper
namespace=
"cn.bugstack.infrastructure.
persistent.dao.IStrategyDao
"
>
<resultMap
id=
"
CaseMap"
type=
"cn.bugstack.infrastructure.redis.po.A
"
>
<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=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
</resultMap>
<insert
id=
"insert"
parameterType=
"cn.bugstack.infrastructure.redis.po.A"
>
INSERT INTO table(a,b,c) VALUES(#{a}, #{b}, #{c})
</insert>
<update
id=
"update"
parameterType=
"cn.bugstack.infrastructure.redis.po.A"
>
UPDATE table SET a = #{a} WHERE b = #{b}
</update>
<select
id=
"queryStrategyList"
resultMap=
"dataMap"
>
select strategy_id
from strategy
limit 10
<select
id=
"queryEmployeeByEmployNumber"
parameterType=
"java.lang.String"
resultMap=
"CaseMap"
>
SELECT a, b, c
FROM table
WHERE a = #{a}
</select>
</mapper>
xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/strategy_rule_mapper.xml
0 → 100644
浏览文件 @
8aa8d5e3
<?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 startegy_rule
limit 10
</select>
</mapper>
xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/AwardDaoTest.java
0 → 100644
浏览文件 @
8aa8d5e3
package
cn.bugstack.test.infrastructure
;
import
cn.bugstack.infrastructure.persistent.dao.IAwardDao
;
import
cn.bugstack.infrastructure.persistent.po.Award
;
import
com.alibaba.fastjson.JSON
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.junit.Test
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* 奖品持久化单元测试
*/
@Slf4j
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
AwardDaoTest
{
@Resource
private
IAwardDao
awardDao
;
@Test
public
void
test_queryAwardList
(){
List
<
Award
>
awards
=
awardDao
.
queryAwardList
();
log
.
info
(
"测试结果: {}"
,
JSON
.
toJSONString
(
awards
));
}
}
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/package-info.java
已删除
100644 → 0
浏览文件 @
91d74573
/**
* DAO 接口;IXxxDao
*/
package
cn.bugstack.infrastructure.dao
;
\ No newline at end of file
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/dao/po/package-info.java
已删除
100644 → 0
浏览文件 @
91d74573
/**
* 持久化对象;XxxPO 最后的 PO 是大写,UserPO
*/
package
cn.bugstack.infrastructure.dao.po
;
\ No newline at end of file
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IAwardDao.java
0 → 100644
浏览文件 @
8aa8d5e3
package
cn.bugstack.infrastructure.persistent.dao
;
import
cn.bugstack.infrastructure.persistent.po.Award
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
/**
* @descrption:奖品表DAO
*/
/**
* Mapper 是 MyBatis 框架中的一个注解,用于 标识一个接口为 MyBatis 的 Mapper(数据访问层),
* 它的作用是让 MyBatis 知道这个接口用于数据库操作,并自动生成相应的 SQL 映射。
*/
@Mapper
public
interface
IAwardDao
{
List
<
Award
>
queryAwardList
();
}
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyAwardDao.java
0 → 100644
浏览文件 @
8aa8d5e3
package
cn.bugstack.infrastructure.persistent.dao
;
import
cn.bugstack.infrastructure.persistent.po.StrategyAward
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
/**
* @Description: 抽奖策略奖品配置明细,包含概率 规则
*/
@Mapper
public
interface
IStrategyAwardDao
{
List
<
StrategyAward
>
queryStrategyAwardList
();
}
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyDao.java
0 → 100644
浏览文件 @
8aa8d5e3
package
cn.bugstack.infrastructure.persistent.dao
;
import
cn.bugstack.infrastructure.persistent.po.Strategy
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
/**
* @description: 抽奖策略
*/
@Mapper
public
interface
IStrategyDao
{
List
<
Strategy
>
queryStrategyList
();
}
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IStrategyRuleDao.java
0 → 100644
浏览文件 @
8aa8d5e3
package
cn.bugstack.infrastructure.persistent.dao
;
import
cn.bugstack.infrastructure.persistent.po.Strategy
;
import
cn.bugstack.infrastructure.persistent.po.StrategyRule
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
/**
* @Description: 其实是给每个奖品设置的规则
*/
@Mapper
public
interface
IStrategyRuleDao
{
List
<
StrategyRule
>
queryStrategyRuleList
();
}
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/Award.java
0 → 100644
浏览文件 @
8aa8d5e3
package
cn.bugstack.infrastructure.persistent.po
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
Award
{
/** 自增ID*/
private
Long
id
;
/** 抽奖奖品ID 内部流转使用*/
private
Long
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/Strategy.java
0 → 100644
浏览文件 @
8aa8d5e3
package
cn.bugstack.infrastructure.persistent.po
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @description: 抽奖策略
*/
@Data
public
class
Strategy
{
/** 自增ID*/
private
Long
id
;
/** 抽奖策略ID*/
private
Long
strategyId
;
/** 抽奖策略描述*/
private
String
strategyDesc
;
/** 创建时间*/
private
Date
createTime
;
/** 更新时间*/
private
Date
updateTime
;
}
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/StrategyAward.java
0 → 100644
浏览文件 @
8aa8d5e3
package
cn.bugstack.infrastructure.persistent.po
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* @Description: 抽奖策略奖品配置明细,包含概率 规则
*/
@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
;
/**'修改时间'*/
}
xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/StrategyRule.java
0 → 100644
浏览文件 @
8aa8d5e3
package
cn.bugstack.infrastructure.persistent.po
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录