提交 a32c0b25 编写于 作者: H hudingrong

整合分库分表插件

上级 123912c3
......@@ -106,6 +106,16 @@
<artifactId>redisson-spring-boot-starter</artifactId>
<version>3.23.4</version>
</dependency>
<dependency>
<groupId>org.jeasy</groupId>
<artifactId>easy-random-core</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>cn.bugstack.middleware</groupId>
<artifactId>db-router-spring-boot-starter</artifactId>
<version>1.0.2</version>
</dependency>
<!-- 工程模块 -->
<dependency>
......
24-05-07.16:28:36.475 [main ] INFO RaffleActivityOrderDaoTest - Starting RaffleActivityOrderDaoTest using Java 1.8.0_241 on Hudingrong with PID 38892 (started by 86189 in E:\resource\market_platform\xfg-frame-archetype-lite\xfg-frame-archetype-lite-app)
24-05-07.16:28:36.476 [main ] INFO RaffleActivityOrderDaoTest - The following 1 profile is active: "dev"
24-05-07.16:28:37.915 [main ] INFO RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode
24-05-07.16:28:37.924 [main ] INFO RepositoryConfigurationDelegate - Bootstrapping Spring Data Redis repositories in DEFAULT mode.
24-05-07.16:28:38.005 [main ] INFO RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 47 ms. Found 0 Redis repository interfaces.
24-05-07.16:28:42.428 [main ] INFO Version - Redisson 3.23.4
24-05-07.16:28:44.991 [redisson-netty-2-4] INFO MasterPubSubConnectionPool - 1 connections initialized for 120.78.91.227/120.78.91.227:6379
24-05-07.16:28:45.552 [redisson-netty-2-23] INFO MasterConnectionPool - 10 connections initialized for 120.78.91.227/120.78.91.227:6379
24-05-07.16:28:48.252 [main ] INFO EndpointLinksResolver - Exposing 1 endpoint(s) beneath base path '/actuator'
24-05-07.16:28:48.334 [main ] INFO RaffleActivityOrderDaoTest - Started RaffleActivityOrderDaoTest in 12.326 seconds (JVM running for 13.798)
24-05-07.16:28:48.711 [main ] INFO HikariDataSource - Retail_HikariCP - Starting...
24-05-07.16:28:50.007 [scheduling-1 ] INFO UpdateAwardStockJob - 定时任务,更新奖品消耗库存【延迟队列获取,降低对数据库的更新频次,不要产生竞争】
24-05-07.16:28:50.062 [scheduling-1 ] INFO StrategyRepository - 队列数据:null
24-05-07.16:28:51.892 [main ] INFO HikariDataSource - Retail_HikariCP - Start completed.
24-05-07.16:28:52.289 [main ] INFO HikariDataSource - Retail_HikariCP - Starting...
24-05-07.16:28:53.018 [main ] INFO HikariDataSource - Retail_HikariCP - Start completed.
24-05-07.16:36:38.086 [main ] INFO RaffleActivityOrderDaoTest - Starting RaffleActivityOrderDaoTest using Java 1.8.0_241 on Hudingrong with PID 34028 (started by 86189 in E:\resource\market_platform\xfg-frame-archetype-lite\xfg-frame-archetype-lite-app)
24-05-07.16:36:38.087 [main ] INFO RaffleActivityOrderDaoTest - The following 1 profile is active: "dev"
24-05-07.16:36:39.290 [main ] INFO RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode
24-05-07.16:36:39.295 [main ] INFO RepositoryConfigurationDelegate - Bootstrapping Spring Data Redis repositories in DEFAULT mode.
24-05-07.16:36:39.354 [main ] INFO RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 40 ms. Found 0 Redis repository interfaces.
24-05-07.16:36:43.691 [main ] INFO Version - Redisson 3.23.4
24-05-07.16:36:46.378 [redisson-netty-2-4] INFO MasterPubSubConnectionPool - 1 connections initialized for 120.78.91.227/120.78.91.227:6379
24-05-07.16:36:46.782 [redisson-netty-2-23] INFO MasterConnectionPool - 10 connections initialized for 120.78.91.227/120.78.91.227:6379
24-05-07.16:36:49.586 [main ] INFO EndpointLinksResolver - Exposing 1 endpoint(s) beneath base path '/actuator'
24-05-07.16:36:49.673 [main ] INFO RaffleActivityOrderDaoTest - Started RaffleActivityOrderDaoTest in 12.123 seconds (JVM running for 14.194)
24-05-07.16:36:50.011 [scheduling-1 ] INFO UpdateAwardStockJob - 定时任务,更新奖品消耗库存【延迟队列获取,降低对数据库的更新频次,不要产生竞争】
24-05-07.16:36:50.085 [main ] INFO HikariDataSource - Retail_HikariCP - Starting...
24-05-07.16:36:50.101 [scheduling-1 ] INFO StrategyRepository - 队列数据:null
24-05-07.16:36:53.730 [main ] INFO HikariDataSource - Retail_HikariCP - Start completed.
24-05-07.16:37:50.180 [main ] INFO RaffleActivityOrderDaoTest - Starting RaffleActivityOrderDaoTest using Java 1.8.0_241 on Hudingrong with PID 38788 (started by 86189 in E:\resource\market_platform\xfg-frame-archetype-lite\xfg-frame-archetype-lite-app)
24-05-07.16:37:50.182 [main ] INFO RaffleActivityOrderDaoTest - The following 1 profile is active: "dev"
24-05-07.16:37:51.774 [main ] INFO RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode
24-05-07.16:37:51.779 [main ] INFO RepositoryConfigurationDelegate - Bootstrapping Spring Data Redis repositories in DEFAULT mode.
24-05-07.16:37:51.828 [main ] INFO RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 29 ms. Found 0 Redis repository interfaces.
24-05-07.16:37:56.621 [main ] INFO Version - Redisson 3.23.4
24-05-07.16:37:59.245 [redisson-netty-2-6] INFO MasterPubSubConnectionPool - 1 connections initialized for 120.78.91.227/120.78.91.227:6379
24-05-07.16:37:59.597 [redisson-netty-2-23] INFO MasterConnectionPool - 10 connections initialized for 120.78.91.227/120.78.91.227:6379
24-05-07.16:38:02.317 [main ] INFO EndpointLinksResolver - Exposing 1 endpoint(s) beneath base path '/actuator'
24-05-07.16:38:02.403 [main ] INFO RaffleActivityOrderDaoTest - Started RaffleActivityOrderDaoTest in 12.817 seconds (JVM running for 14.966)
24-05-07.16:38:02.737 [main ] INFO HikariDataSource - Retail_HikariCP - Starting...
24-05-07.16:38:05.006 [scheduling-1 ] INFO UpdateAwardStockJob - 定时任务,更新奖品消耗库存【延迟队列获取,降低对数据库的更新频次,不要产生竞争】
24-05-07.16:38:05.058 [scheduling-1 ] INFO StrategyRepository - 队列数据:null
24-05-07.16:38:06.195 [main ] INFO HikariDataSource - Retail_HikariCP - Start completed.
24-05-07.16:38:06.504 [main ] INFO RaffleActivityOrderDaoTest - 测试结果:[{"state":"not_used"},{"state":"not_used"},{"state":"not_used"}]
24-05-07.16:45:04.970 [main ] INFO RaffleActivityOrderDaoTest - Starting RaffleActivityOrderDaoTest using Java 1.8.0_241 on Hudingrong with PID 18144 (started by 86189 in E:\resource\market_platform\xfg-frame-archetype-lite\xfg-frame-archetype-lite-app)
24-05-07.16:45:04.972 [main ] INFO RaffleActivityOrderDaoTest - The following 1 profile is active: "dev"
24-05-07.16:45:06.441 [main ] INFO RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode
24-05-07.16:45:06.446 [main ] INFO RepositoryConfigurationDelegate - Bootstrapping Spring Data Redis repositories in DEFAULT mode.
24-05-07.16:45:06.523 [main ] INFO RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 45 ms. Found 0 Redis repository interfaces.
24-05-07.16:45:10.946 [main ] INFO Version - Redisson 3.23.4
24-05-07.16:45:13.625 [redisson-netty-2-4] INFO MasterPubSubConnectionPool - 1 connections initialized for 120.78.91.227/120.78.91.227:6379
24-05-07.16:45:14.677 [redisson-netty-2-23] INFO MasterConnectionPool - 10 connections initialized for 120.78.91.227/120.78.91.227:6379
24-05-07.16:45:17.461 [main ] INFO EndpointLinksResolver - Exposing 1 endpoint(s) beneath base path '/actuator'
24-05-07.16:45:17.568 [main ] INFO RaffleActivityOrderDaoTest - Started RaffleActivityOrderDaoTest in 13.107 seconds (JVM running for 15.544)
24-05-07.16:45:18.029 [main ] INFO HikariDataSource - Retail_HikariCP - Starting...
24-05-07.16:45:20.009 [scheduling-1 ] INFO UpdateAwardStockJob - 定时任务,更新奖品消耗库存【延迟队列获取,降低对数据库的更新频次,不要产生竞争】
24-05-07.16:45:20.056 [scheduling-1 ] INFO StrategyRepository - 队列数据:null
24-05-07.16:45:21.130 [main ] INFO HikariDataSource - Retail_HikariCP - Start completed.
24-05-07.16:45:21.405 [main ] INFO RaffleActivityOrderDaoTest - 测试结果:[{"state":"not_used"},{"state":"not_used"},{"state":"not_used"}]
24-05-07.16:45:35.779 [main ] INFO RaffleActivityDaoTest - Starting RaffleActivityDaoTest using Java 1.8.0_241 on Hudingrong with PID 39208 (started by 86189 in E:\resource\market_platform\xfg-frame-archetype-lite\xfg-frame-archetype-lite-app)
24-05-07.16:45:35.781 [main ] INFO RaffleActivityDaoTest - The following 1 profile is active: "dev"
24-05-07.16:45:37.256 [main ] INFO RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode
24-05-07.16:45:37.260 [main ] INFO RepositoryConfigurationDelegate - Bootstrapping Spring Data Redis repositories in DEFAULT mode.
24-05-07.16:45:37.311 [main ] INFO RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 33 ms. Found 0 Redis repository interfaces.
24-05-07.16:45:42.066 [main ] INFO Version - Redisson 3.23.4
24-05-07.16:45:44.699 [redisson-netty-2-5] INFO MasterPubSubConnectionPool - 1 connections initialized for 120.78.91.227/120.78.91.227:6379
24-05-07.16:45:45.567 [redisson-netty-2-23] INFO MasterConnectionPool - 10 connections initialized for 120.78.91.227/120.78.91.227:6379
24-05-07.16:45:48.270 [main ] INFO EndpointLinksResolver - Exposing 1 endpoint(s) beneath base path '/actuator'
24-05-07.16:45:48.365 [main ] INFO RaffleActivityDaoTest - Started RaffleActivityDaoTest in 13.439 seconds (JVM running for 14.808)
24-05-07.16:45:48.642 [main ] INFO HikariDataSource - Retail_HikariCP - Starting...
24-05-07.16:45:50.016 [scheduling-1 ] INFO UpdateAwardStockJob - 定时任务,更新奖品消耗库存【延迟队列获取,降低对数据库的更新频次,不要产生竞争】
24-05-07.16:45:50.065 [scheduling-1 ] INFO StrategyRepository - 队列数据:null
24-05-07.16:45:51.714 [main ] INFO HikariDataSource - Retail_HikariCP - Start completed.
24-05-07.16:45:51.958 [main ] INFO RaffleActivityDaoTest - 测试结果:{"state":"0"}
......@@ -82,6 +82,14 @@
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.jeasy</groupId>
<artifactId>easy-random-core</artifactId>
</dependency>
<dependency>
<groupId>cn.bugstack.middleware</groupId>
<artifactId>db-router-spring-boot-starter</artifactId>
</dependency>
<!-- 工程模块;启动依赖 trigger->domain, infrastructure-->
<dependency>
......
......@@ -20,23 +20,6 @@ app:
# 跨域,开发阶段可以设置为 * 不限制
cross-origin: '*'
# 数据库配置;启动时配置数据库资源信息
spring:
datasource:
username: root
password: eIRZoTNHLXZXm4^V*
url: jdbc:mysql://120.78.91.227: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
minimum-idle: 15 #最小空闲连接数量
idle-timeout: 180000 #空闲连接存活最大时间,默认600000(10分钟)
maximum-pool-size: 25 #连接池最大连接数,默认是10
auto-commit: true #此属性控制从池返回的连接的默认自动提交行为,默认值:true
max-lifetime: 18 #此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
connection-timeout: 30000 #数据库连接超时时间,默认30秒,即30000
connection-test-query: SELECT 1
type: com.zaxxer.hikari.HikariDataSource
# redis配置
redis:
sdk:
......@@ -54,3 +37,61 @@ logging:
level:
root: info
config: classpath:logback-spring.xml
# 多数据源路由配置,库数量 * 表数量 为2的次幂,如2库4表
# mysql 5.x 配置 driver-class-name: com.mysql.jdbc.Driver mysql-connector-java 5.1.34
# mysql 8.x 配置 driver-class-name: com.mysql.cj.jdbc.Driver mysql-connector-java 8.0.22
mini-db-router:
jdbc:
datasource:
dbCount: 2
tbCount: 4
default: db00
routerKey: userId
list: db01,db02
db00:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://120.78.91.227:3306/big_market?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC&useSSL=true
username: root
password: eIRZoTNHLXZXm4^V*
type-class-name: com.zaxxer.hikari.HikariDataSource
pool:
pool-name: Retail_HikariCP
minimum-idle: 15 #最小空闲连接数量
idle-timeout: 180000 #空闲连接存活最大时间,默认600000(10分钟)
maximum-pool-size: 25 #连接池最大连接数,默认是10
auto-commit: true #此属性控制从池返回的连接的默认自动提交行为,默认值:true
max-lifetime: 1800000 #此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
connection-timeout: 30000 #数据库连接超时时间,默认30秒,即30000
connection-test-query: SELECT 1
db01:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://120.78.91.227:3306/big_market_01?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC&useSSL=true
username: root
password: eIRZoTNHLXZXm4^V*
type-class-name: com.zaxxer.hikari.HikariDataSource
pool:
pool-name: Retail_HikariCP
minimum-idle: 15 #最小空闲连接数量
idle-timeout: 180000 #空闲连接存活最大时间,默认600000(10分钟)
maximum-pool-size: 25 #连接池最大连接数,默认是10
auto-commit: true #此属性控制从池返回的连接的默认自动提交行为,默认值:true
max-lifetime: 1800000 #此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
connection-timeout: 30000 #数据库连接超时时间,默认30秒,即30000
connection-test-query: SELECT 1
db02:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://120.78.91.227:3306/big_market_02?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC&useSSL=true
username: root
password: eIRZoTNHLXZXm4^V*
type-class-name: com.zaxxer.hikari.HikariDataSource
pool:
pool-name: Retail_HikariCP
minimum-idle: 15 #最小空闲连接数量
idle-timeout: 180000 #空闲连接存活最大时间,默认600000(10分钟)
maximum-pool-size: 25 #连接池最大连接数,默认是10
auto-commit: true #此属性控制从池返回的连接的默认自动提交行为,默认值:true
max-lifetime: 1800000 #此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
connection-timeout: 30000 #数据库连接超时时间,默认30秒,即30000
connection-test-query: SELECT 1
<?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.IRaffleActivityAccountFlowDao">
<resultMap id="BaseResultMap" type="cn.bugstack.domain.strategy.model.entity.RaffleActivityAccountFlowEntity">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="user_id" column="user_id" jdbcType="VARCHAR"/>
<result property="activity_id" column="activity_id" jdbcType="BIGINT"/>
<result property="total_count" column="total_count" jdbcType="INTEGER"/>
<result property="day_count" column="day_count" jdbcType="INTEGER"/>
<result property="month_count" column="month_count" jdbcType="INTEGER"/>
<result property="flow_id" column="flow_id" jdbcType="VARCHAR"/>
<result property="flow_channel" column="flow_channel" jdbcType="VARCHAR"/>
<result property="biz_id" column="biz_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="update_time" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,user_id,activity_id,
total_count,day_count,month_count,
flow_id,flow_channel,biz_id,
create_time,update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from raffle_activity_account_flow
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from raffle_activity_account_flow
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.bugstack.domain.strategy.model.entity.RaffleActivityAccountFlowEntity" useGeneratedKeys="true">
insert into raffle_activity_account_flow
( id,user_id,activity_id
,total_count,day_count,month_count
,flow_id,flow_channel,biz_id
,create_time,update_time)
values (#{id,jdbcType=INTEGER},#{user_id,jdbcType=VARCHAR},#{activity_id,jdbcType=BIGINT}
,#{total_count,jdbcType=INTEGER},#{day_count,jdbcType=INTEGER},#{month_count,jdbcType=INTEGER}
,#{flow_id,jdbcType=VARCHAR},#{flow_channel,jdbcType=VARCHAR},#{biz_id,jdbcType=VARCHAR}
,#{create_time,jdbcType=TIMESTAMP},#{update_time,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.bugstack.domain.strategy.model.entity.RaffleActivityAccountFlowEntity" useGeneratedKeys="true">
insert into raffle_activity_account_flow
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="user_id != null">user_id,</if>
<if test="activity_id != null">activity_id,</if>
<if test="total_count != null">total_count,</if>
<if test="day_count != null">day_count,</if>
<if test="month_count != null">month_count,</if>
<if test="flow_id != null">flow_id,</if>
<if test="flow_channel != null">flow_channel,</if>
<if test="biz_id != null">biz_id,</if>
<if test="create_time != null">create_time,</if>
<if test="update_time != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id,jdbcType=INTEGER},</if>
<if test="user_id != null">#{user_id,jdbcType=VARCHAR},</if>
<if test="activity_id != null">#{activity_id,jdbcType=BIGINT},</if>
<if test="total_count != null">#{total_count,jdbcType=INTEGER},</if>
<if test="day_count != null">#{day_count,jdbcType=INTEGER},</if>
<if test="month_count != null">#{month_count,jdbcType=INTEGER},</if>
<if test="flow_id != null">#{flow_id,jdbcType=VARCHAR},</if>
<if test="flow_channel != null">#{flow_channel,jdbcType=VARCHAR},</if>
<if test="biz_id != null">#{biz_id,jdbcType=VARCHAR},</if>
<if test="create_time != null">#{create_time,jdbcType=TIMESTAMP},</if>
<if test="update_time != null">#{update_time,jdbcType=TIMESTAMP},</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.bugstack.domain.strategy.model.entity.RaffleActivityAccountFlowEntity">
update raffle_activity_account_flow
<set>
<if test="user_id != null">
user_id = #{user_id,jdbcType=VARCHAR},
</if>
<if test="activity_id != null">
activity_id = #{activity_id,jdbcType=BIGINT},
</if>
<if test="total_count != null">
total_count = #{total_count,jdbcType=INTEGER},
</if>
<if test="day_count != null">
day_count = #{day_count,jdbcType=INTEGER},
</if>
<if test="month_count != null">
month_count = #{month_count,jdbcType=INTEGER},
</if>
<if test="flow_id != null">
flow_id = #{flow_id,jdbcType=VARCHAR},
</if>
<if test="flow_channel != null">
flow_channel = #{flow_channel,jdbcType=VARCHAR},
</if>
<if test="biz_id != null">
biz_id = #{biz_id,jdbcType=VARCHAR},
</if>
<if test="create_time != null">
create_time = #{create_time,jdbcType=TIMESTAMP},
</if>
<if test="update_time != null">
update_time = #{update_time,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.bugstack.domain.strategy.model.entity.RaffleActivityAccountFlowEntity">
update raffle_activity_account_flow
set
user_id = #{user_id,jdbcType=VARCHAR},
activity_id = #{activity_id,jdbcType=BIGINT},
total_count = #{total_count,jdbcType=INTEGER},
day_count = #{day_count,jdbcType=INTEGER},
month_count = #{month_count,jdbcType=INTEGER},
flow_id = #{flow_id,jdbcType=VARCHAR},
flow_channel = #{flow_channel,jdbcType=VARCHAR},
biz_id = #{biz_id,jdbcType=VARCHAR},
create_time = #{create_time,jdbcType=TIMESTAMP},
update_time = #{update_time,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
<?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.IRaffleActivityAccountDao">
<resultMap id="BaseResultMap" type="cn.bugstack.domain.strategy.model.entity.RaffleActivityAccountEntity">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="user_id" column="user_id" jdbcType="VARCHAR"/>
<result property="activity_id" column="activity_id" jdbcType="BIGINT"/>
<result property="total_count" column="total_count" jdbcType="INTEGER"/>
<result property="total_count_surplus" column="total_count_surplus" jdbcType="INTEGER"/>
<result property="day_count" column="day_count" jdbcType="INTEGER"/>
<result property="day_count_surplus" column="day_count_surplus" jdbcType="INTEGER"/>
<result property="month_count" column="month_count" jdbcType="INTEGER"/>
<result property="month_count_surplus" column="month_count_surplus" jdbcType="INTEGER"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="update_time" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,user_id,activity_id,
total_count,total_count_surplus,day_count,
day_count_surplus,month_count,month_count_surplus,
create_time,update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from raffle_activity_account
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from raffle_activity_account
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.bugstack.domain.strategy.model.entity.RaffleActivityAccountEntity" useGeneratedKeys="true">
insert into raffle_activity_account
( id,user_id,activity_id
,total_count,total_count_surplus,day_count
,day_count_surplus,month_count,month_count_surplus
,create_time,update_time)
values (#{id,jdbcType=BIGINT},#{user_id,jdbcType=VARCHAR},#{activity_id,jdbcType=BIGINT}
,#{total_count,jdbcType=INTEGER},#{total_count_surplus,jdbcType=INTEGER},#{day_count,jdbcType=INTEGER}
,#{day_count_surplus,jdbcType=INTEGER},#{month_count,jdbcType=INTEGER},#{month_count_surplus,jdbcType=INTEGER}
,#{create_time,jdbcType=TIMESTAMP},#{update_time,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.bugstack.domain.strategy.model.entity.RaffleActivityAccountEntity" useGeneratedKeys="true">
insert into raffle_activity_account
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="user_id != null">user_id,</if>
<if test="activity_id != null">activity_id,</if>
<if test="total_count != null">total_count,</if>
<if test="total_count_surplus != null">total_count_surplus,</if>
<if test="day_count != null">day_count,</if>
<if test="day_count_surplus != null">day_count_surplus,</if>
<if test="month_count != null">month_count,</if>
<if test="month_count_surplus != null">month_count_surplus,</if>
<if test="create_time != null">create_time,</if>
<if test="update_time != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id,jdbcType=BIGINT},</if>
<if test="user_id != null">#{user_id,jdbcType=VARCHAR},</if>
<if test="activity_id != null">#{activity_id,jdbcType=BIGINT},</if>
<if test="total_count != null">#{total_count,jdbcType=INTEGER},</if>
<if test="total_count_surplus != null">#{total_count_surplus,jdbcType=INTEGER},</if>
<if test="day_count != null">#{day_count,jdbcType=INTEGER},</if>
<if test="day_count_surplus != null">#{day_count_surplus,jdbcType=INTEGER},</if>
<if test="month_count != null">#{month_count,jdbcType=INTEGER},</if>
<if test="month_count_surplus != null">#{month_count_surplus,jdbcType=INTEGER},</if>
<if test="create_time != null">#{create_time,jdbcType=TIMESTAMP},</if>
<if test="update_time != null">#{update_time,jdbcType=TIMESTAMP},</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.bugstack.domain.strategy.model.entity.RaffleActivityAccountEntity">
update raffle_activity_account
<set>
<if test="user_id != null">
user_id = #{user_id,jdbcType=VARCHAR},
</if>
<if test="activity_id != null">
activity_id = #{activity_id,jdbcType=BIGINT},
</if>
<if test="total_count != null">
total_count = #{total_count,jdbcType=INTEGER},
</if>
<if test="total_count_surplus != null">
total_count_surplus = #{total_count_surplus,jdbcType=INTEGER},
</if>
<if test="day_count != null">
day_count = #{day_count,jdbcType=INTEGER},
</if>
<if test="day_count_surplus != null">
day_count_surplus = #{day_count_surplus,jdbcType=INTEGER},
</if>
<if test="month_count != null">
month_count = #{month_count,jdbcType=INTEGER},
</if>
<if test="month_count_surplus != null">
month_count_surplus = #{month_count_surplus,jdbcType=INTEGER},
</if>
<if test="create_time != null">
create_time = #{create_time,jdbcType=TIMESTAMP},
</if>
<if test="update_time != null">
update_time = #{update_time,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="cn.bugstack.domain.strategy.model.entity.RaffleActivityAccountEntity">
update raffle_activity_account
set
user_id = #{user_id,jdbcType=VARCHAR},
activity_id = #{activity_id,jdbcType=BIGINT},
total_count = #{total_count,jdbcType=INTEGER},
total_count_surplus = #{total_count_surplus,jdbcType=INTEGER},
day_count = #{day_count,jdbcType=INTEGER},
day_count_surplus = #{day_count_surplus,jdbcType=INTEGER},
month_count = #{month_count,jdbcType=INTEGER},
month_count_surplus = #{month_count_surplus,jdbcType=INTEGER},
create_time = #{create_time,jdbcType=TIMESTAMP},
update_time = #{update_time,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
<?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.IRaffleActivityCountDao">
<resultMap id="BaseResultMap" type="cn.bugstack.domain.strategy.model.entity.RaffleActivityCountEntity">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="activity_count_id" column="activity_count_id" jdbcType="BIGINT"/>
<result property="total_count" column="total_count" jdbcType="INTEGER"/>
<result property="day_count" column="day_count" jdbcType="INTEGER"/>
<result property="month_count" column="month_count" jdbcType="INTEGER"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="update_time" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,activity_count_id,total_count,
day_count,month_count,create_time,
update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from raffle_activity_count
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from raffle_activity_count
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.bugstack.domain.strategy.model.entity.RaffleActivityCountEntity" useGeneratedKeys="true">
insert into raffle_activity_count
( id,activity_count_id,total_count
,day_count,month_count,create_time
,update_time)
values (#{id,jdbcType=BIGINT},#{activity_count_id,jdbcType=BIGINT},#{total_count,jdbcType=INTEGER}
,#{day_count,jdbcType=INTEGER},#{month_count,jdbcType=INTEGER},#{create_time,jdbcType=TIMESTAMP}
,#{update_time,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.bugstack.domain.strategy.model.entity.RaffleActivityCountEntity" useGeneratedKeys="true">
insert into raffle_activity_count
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="activity_count_id != null">activity_count_id,</if>
<if test="total_count != null">total_count,</if>
<if test="day_count != null">day_count,</if>
<if test="month_count != null">month_count,</if>
<if test="create_time != null">create_time,</if>
<if test="update_time != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id,jdbcType=BIGINT},</if>
<if test="activity_count_id != null">#{activity_count_id,jdbcType=BIGINT},</if>
<if test="total_count != null">#{total_count,jdbcType=INTEGER},</if>
<if test="day_count != null">#{day_count,jdbcType=INTEGER},</if>
<if test="month_count != null">#{month_count,jdbcType=INTEGER},</if>
<if test="create_time != null">#{create_time,jdbcType=TIMESTAMP},</if>
<if test="update_time != null">#{update_time,jdbcType=TIMESTAMP},</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.bugstack.domain.strategy.model.entity.RaffleActivityCountEntity">
update raffle_activity_count
<set>
<if test="activity_count_id != null">
activity_count_id = #{activity_count_id,jdbcType=BIGINT},
</if>
<if test="total_count != null">
total_count = #{total_count,jdbcType=INTEGER},
</if>
<if test="day_count != null">
day_count = #{day_count,jdbcType=INTEGER},
</if>
<if test="month_count != null">
month_count = #{month_count,jdbcType=INTEGER},
</if>
<if test="create_time != null">
create_time = #{create_time,jdbcType=TIMESTAMP},
</if>
<if test="update_time != null">
update_time = #{update_time,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="cn.bugstack.domain.strategy.model.entity.RaffleActivityCountEntity">
update raffle_activity_count
set
activity_count_id = #{activity_count_id,jdbcType=BIGINT},
total_count = #{total_count,jdbcType=INTEGER},
day_count = #{day_count,jdbcType=INTEGER},
month_count = #{month_count,jdbcType=INTEGER},
create_time = #{create_time,jdbcType=TIMESTAMP},
update_time = #{update_time,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
<?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.IRaffleActivityDao">
<resultMap id="BaseResultMap" type="cn.bugstack.domain.strategy.model.entity.RaffleActivityEntity">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="activity_id" column="activity_id" jdbcType="BIGINT"/>
<result property="activity_name" column="activity_name" jdbcType="VARCHAR"/>
<result property="activity_desc" column="activity_desc" jdbcType="VARCHAR"/>
<result property="begin_date_time" column="begin_date_time" jdbcType="TIMESTAMP"/>
<result property="end_date_time" column="end_date_time" jdbcType="TIMESTAMP"/>
<result property="stock_count" column="stock_count" jdbcType="INTEGER"/>
<result property="stock_count_surplus" column="stock_count_surplus" jdbcType="INTEGER"/>
<result property="activity_count_id" column="activity_count_id" jdbcType="BIGINT"/>
<result property="strategy_id" column="strategy_id" jdbcType="BIGINT"/>
<result property="state" column="state" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="update_time" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,activity_id,activity_name,
activity_desc,begin_date_time,end_date_time,
stock_count,stock_count_surplus,activity_count_id,
strategy_id,state,create_time,
update_time
</sql>
<select id="queryRaffleActivityByActivityId"
resultType="cn.bugstack.infrastructure.persistent.po.RaffleActivity">
select activity_id, activity_name, activity_desc, begin_date_time, end_date_time, stock_count, stock_count_surplus, activity_count_id, strategy_id, state
from raffle_activity
where activity_id = #{activityId}
</select>
</mapper>
<?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.IRaffleActivityOrderDao">
<resultMap id="BaseResultMap" type="cn.bugstack.domain.strategy.model.entity.RaffleActivityOrderEntity">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="user_id" column="user_id" jdbcType="VARCHAR"/>
<result property="activity_id" column="activity_id" jdbcType="BIGINT"/>
<result property="activity_name" column="activity_name" jdbcType="VARCHAR"/>
<result property="strategy_id" column="strategy_id" jdbcType="BIGINT"/>
<result property="order_id" column="order_id" jdbcType="VARCHAR"/>
<result property="order_time" column="order_time" jdbcType="TIMESTAMP"/>
<result property="state" column="state" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="update_time" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,user_id,activity_id,
activity_name,strategy_id,order_id,
order_time,state,create_time,
update_time
</sql>
<insert id="insert">
insert into raffle_activity_order(user_id, activity_id, activity_name, strategy_id, order_id, order_time, state, create_time, update_time)
values(#{userId}, #{activityId}, #{activityName}, #{strategyId}, #{orderId}, #{orderTime}, #{state}, now(), now())
</insert>
<select id="queryRaffleActivityOrderByUserId"
resultType="cn.bugstack.infrastructure.persistent.po.RaffleActivityOrder">
select user_id, activity_id, activity_name, strategy_id, order_id, order_time, state
from raffle_activity_order
where user_id = #{userId}
</select>
</mapper>
package cn.bugstack.test.infrastructure;
import cn.bugstack.infrastructure.persistent.dao.IRaffleActivityDao;
import cn.bugstack.infrastructure.persistent.po.RaffleActivity;
import com.alibaba.fastjson2.JSON;
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;
/**
* @author Fuzhengwei bugstack.cn @小傅哥
* @description 抽奖活动配置Dao测试
* @create 2024-03-09 11:30
*/
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class RaffleActivityDaoTest {
@Resource
private IRaffleActivityDao raffleActivityDao;
@Test
public void test_queryRaffleActivityByActivityId() {
RaffleActivity raffleActivity = raffleActivityDao.queryRaffleActivityByActivityId(100301L);
log.info("测试结果:{}", JSON.toJSONString(raffleActivity));
}
}
package cn.bugstack.test.infrastructure;
import cn.bugstack.infrastructure.persistent.dao.IRaffleActivityOrderDao;
import cn.bugstack.infrastructure.persistent.po.RaffleActivityOrder;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.RandomStringUtils;
import org.jeasy.random.EasyRandom;
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.Date;
import java.util.List;
/**
* @author Fuzhengwei bugstack.cn @小傅哥
* @description 抽奖活动订单测试
* @create 2024-03-09 10:51
*/
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class RaffleActivityOrderDaoTest {
@Resource
private IRaffleActivityOrderDao raffleActivityOrderDao;
private final EasyRandom easyRandom = new EasyRandom();
@Test
public void test_insert_random() {
for (int i = 0; i < 5; i++) {
RaffleActivityOrder raffleActivityOrder = new RaffleActivityOrder();
// EasyRandom 可以通过指定对象类的方式,随机生成对象值。如;easyRandom.nextObject(String.class)、easyRandom.nextObject(RaffleActivityOrder.class)
raffleActivityOrder.setUserId(easyRandom.nextObject(String.class));
raffleActivityOrder.setActivityId(100301L);
raffleActivityOrder.setActivityName("测试活动");
raffleActivityOrder.setStrategyId(100006L);
raffleActivityOrder.setOrderId(RandomStringUtils.randomNumeric(12));
raffleActivityOrder.setOrderTime(new Date());
raffleActivityOrder.setState("not_used");
// 插入数据
raffleActivityOrderDao.insert(raffleActivityOrder);
}
}
@Test
public void test_insert() {
RaffleActivityOrder raffleActivityOrder = new RaffleActivityOrder();
raffleActivityOrder.setUserId("xiaofuge");
raffleActivityOrder.setActivityId(100301L);
raffleActivityOrder.setActivityName("测试活动");
raffleActivityOrder.setStrategyId(100006L);
raffleActivityOrder.setOrderId(RandomStringUtils.randomNumeric(12));
raffleActivityOrder.setOrderTime(new Date());
raffleActivityOrder.setState("not_used");
// 插入数据
raffleActivityOrderDao.insert(raffleActivityOrder);
}
@Test
public void test_queryRaffleActivityOrderByUserId() {
String userId = "xiaofuge";
List<RaffleActivityOrder> raffleActivityOrders = raffleActivityOrderDao.queryRaffleActivityOrderByUserId(userId);
log.info("测试结果:{}", JSON.toJSONString(raffleActivityOrders));
}
}
package cn.bugstack.domain.strategy.model.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 抽奖活动账户表
* @TableName raffle_activity_account
*/
@Data
public class RaffleActivityAccountEntity implements Serializable {
/**
* 自增ID
*/
private Long id;
/**
* 用户ID
*/
private String user_id;
/**
* 活动ID
*/
private Long activity_id;
/**
* 总次数
*/
private Integer total_count;
/**
* 总次数-剩余
*/
private Integer total_count_surplus;
/**
* 日次数
*/
private Integer day_count;
/**
* 日次数-剩余
*/
private Integer day_count_surplus;
/**
* 月次数
*/
private Integer month_count;
/**
* 月次数-剩余
*/
private Integer month_count_surplus;
/**
* 创建时间
*/
private Date create_time;
/**
* 更新时间
*/
private Date update_time;
private static final long serialVersionUID = 1L;
}
package cn.bugstack.domain.strategy.model.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 抽奖活动账户流水表
* @TableName raffle_activity_account_flow
*/
@Data
public class RaffleActivityAccountFlowEntity implements Serializable {
/**
* 自增ID
*/
private Integer id;
/**
* 用户ID
*/
private String user_id;
/**
* 活动ID
*/
private Long activity_id;
/**
* 总次数
*/
private Integer total_count;
/**
* 日次数
*/
private Integer day_count;
/**
* 月次数
*/
private Integer month_count;
/**
* 流水ID - 生成的唯一ID
*/
private String flow_id;
/**
* 流水渠道(activity-活动领取、sale-购买、redeem-兑换、free-免费赠送)
*/
private String flow_channel;
/**
* 业务ID(外部透传,活动ID、订单ID)
*/
private String biz_id;
/**
* 创建时间
*/
private Date create_time;
/**
* 更新时间
*/
private Date update_time;
private static final long serialVersionUID = 1L;
}
package cn.bugstack.domain.strategy.model.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 抽奖活动次数配置表
* @TableName raffle_activity_count
*/
@Data
public class RaffleActivityCountEntity implements Serializable {
/**
* 自增ID
*/
private Long id;
/**
* 活动次数编号
*/
private Long activity_count_id;
/**
* 总次数
*/
private Integer total_count;
/**
* 日次数
*/
private Integer day_count;
/**
* 月次数
*/
private Integer month_count;
/**
* 创建时间
*/
private Date create_time;
/**
* 更新时间
*/
private Date update_time;
private static final long serialVersionUID = 1L;
}
package cn.bugstack.domain.strategy.model.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 抽奖活动表
* @TableName raffle_activity
*/
@Data
public class RaffleActivityEntity implements Serializable {
/**
* 自增ID
*/
private Long id;
/**
* 活动ID
*/
private Long activity_id;
/**
* 活动名称
*/
private String activity_name;
/**
* 活动描述
*/
private String activity_desc;
/**
* 开始时间
*/
private Date begin_date_time;
/**
* 结束时间
*/
private Date end_date_time;
/**
* 库存总量
*/
private Integer stock_count;
/**
* 剩余库存
*/
private Integer stock_count_surplus;
/**
* 活动参与次数配置
*/
private Long activity_count_id;
/**
* 抽奖策略ID
*/
private Long strategy_id;
/**
* 活动状态
*/
private String state;
/**
* 创建时间
*/
private Date create_time;
/**
* 更新时间
*/
private Date update_time;
private static final long serialVersionUID = 1L;
}
package cn.bugstack.domain.strategy.model.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 抽奖活动单
* @TableName raffle_activity_order
*/
@Data
public class RaffleActivityOrderEntity implements Serializable {
/**
* 自增ID
*/
private Long id;
/**
* 用户ID
*/
private String user_id;
/**
* 活动ID
*/
private Long activity_id;
/**
* 活动名称
*/
private String activity_name;
/**
* 抽奖策略ID
*/
private Long strategy_id;
/**
* 订单ID
*/
private String order_id;
/**
* 下单时间
*/
private Date order_time;
/**
* 订单状态(not_used、used、expire)
*/
private String state;
/**
* 创建时间
*/
private Date create_time;
/**
* 更新时间
*/
private Date update_time;
private static final long serialVersionUID = 1L;
}
......@@ -4,7 +4,6 @@ import cn.bugstack.domain.strategy.model.entity.RaffleAwardEntity;
import cn.bugstack.domain.strategy.model.entity.RaffleFactorEntity;
import cn.bugstack.domain.strategy.model.entity.StrategyAwardEntity;
import cn.bugstack.domain.strategy.repository.IStrategyRepository;
import cn.bugstack.domain.strategy.service.IRaffleStrategy;
import cn.bugstack.domain.strategy.service.armory.IStrategyDispatch;
import cn.bugstack.domain.strategy.service.rule.chain.factory.DefaultChainFactory;
import cn.bugstack.domain.strategy.service.rule.tree.factory.DefaultTreeFactory;
......
......@@ -23,6 +23,10 @@
<artifactId>redisson-spring-boot-starter</artifactId>
<version>3.23.4</version>
</dependency>
<dependency>
<groupId>cn.bugstack.middleware</groupId>
<artifactId>db-router-spring-boot-starter</artifactId>
</dependency>
<!-- 系统模块 -->
<dependency>
<groupId>cn.bugstack</groupId>
......
package cn.bugstack.infrastructure.persistent.dao;
import cn.bugstack.domain.strategy.model.entity.RaffleActivityAccountEntity;
import cn.bugstack.domain.strategy.model.entity.RaffleActivityAccountFlowEntity;
import cn.bugstack.middleware.db.router.annotation.DBRouterStrategy;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 86189
* @description 针对表【raffle_activity_account(抽奖活动账户表)】的数据库操作Mapper
* @createDate 2024-04-30 15:37:45
* @Entity generator.domain.RaffleActivityAccount
*/
@Mapper
@DBRouterStrategy(splitTable = true)
public interface IRaffleActivityAccountDao {
int deleteByPrimaryKey(Long id);
int insert(RaffleActivityAccountEntity record);
int insertSelective(RaffleActivityAccountFlowEntity record);
RaffleActivityAccountFlowEntity selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(RaffleActivityAccountFlowEntity record);
int updateByPrimaryKey(RaffleActivityAccountFlowEntity record);
}
package cn.bugstack.infrastructure.persistent.dao;
import cn.bugstack.domain.strategy.model.entity.RaffleActivityAccountFlowEntity;
import cn.bugstack.middleware.db.router.annotation.DBRouterStrategy;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 86189
* @description 针对表【raffle_activity_account_flow(抽奖活动账户流水表)】的数据库操作Mapper
* @createDate 2024-04-30 15:38:45
* @Entity generator1.domain.RaffleActivityAccountFlow
*/
@Mapper
@DBRouterStrategy(splitTable = true)
public interface IRaffleActivityAccountFlowDao {
int deleteByPrimaryKey(Long id);
int insert(RaffleActivityAccountFlowEntity record);
int insertSelective(RaffleActivityAccountFlowEntity record);
RaffleActivityAccountFlowEntity selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(RaffleActivityAccountFlowEntity record);
int updateByPrimaryKey(RaffleActivityAccountFlowEntity record);
}
package cn.bugstack.infrastructure.persistent.dao;
import cn.bugstack.domain.strategy.model.entity.RaffleActivityCountEntity;
/**
* @author 86189
* @description 针对表【raffle_activity_count(抽奖活动次数配置表)】的数据库操作Mapper
* @createDate 2024-05-07 15:48:51
* @Entity generator2.domain.RaffleActivityCount
*/
public interface IRaffleActivityCountDao {
int deleteByPrimaryKey(Long id);
int insert(RaffleActivityCountEntity record);
int insertSelective(RaffleActivityCountEntity record);
RaffleActivityCountEntity selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(RaffleActivityCountEntity record);
int updateByPrimaryKey(RaffleActivityCountEntity record);
}
package cn.bugstack.infrastructure.persistent.dao;
import cn.bugstack.domain.strategy.model.entity.RaffleActivityEntity;
import cn.bugstack.infrastructure.persistent.po.RaffleActivity;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 86189
* @description 针对表【raffle_activity(抽奖活动表)】的数据库操作Mapper
* @createDate 2024-05-07 15:49:10
* @Entity generator.domain.RaffleActivity
*/
@Mapper
public interface IRaffleActivityDao {
RaffleActivity queryRaffleActivityByActivityId(Long activityId);
}
package cn.bugstack.infrastructure.persistent.dao;
import cn.bugstack.infrastructure.persistent.po.RaffleActivityOrder;
import cn.bugstack.middleware.db.router.annotation.DBRouter;
import cn.bugstack.middleware.db.router.annotation.DBRouterStrategy;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author 86189
* @description 针对表【raffle_activity_order(抽奖活动单)】的数据库操作Mapper
* @createDate 2024-04-30 15:40:40
* @Entity generator2.domain.RaffleActivityOrder
*/
@Mapper
@DBRouterStrategy(splitTable = true)
public interface IRaffleActivityOrderDao {
@DBRouter(key = "userId")
void insert(RaffleActivityOrder raffleActivityOrder);
@DBRouter
List<RaffleActivityOrder> queryRaffleActivityOrderByUserId(String userId);
}
package cn.bugstack.infrastructure.persistent.po;
import lombok.Data;
import java.util.Date;
/**
* @description:
* @author: hdr
* @PACKAGE_NAME: cn.bugstack.infrastructure.persistent.po
* @DATE: 2024/5/7
*/
@Data
public class RaffleActivity {
/**
* 自增ID
*/
private Long id;
/**
* 活动ID
*/
private Long activityId;
/**
* 活动名称
*/
private String activityName;
/**
* 活动描述
*/
private String activityDesc;
/**
* 开始时间
*/
private Date beginDateTime;
/**
* 结束时间
*/
private Date endDateTime;
/**
* 库存总量
*/
private Integer stockCount;
/**
* 剩余库存
*/
private Integer stockCountSurplus;
/**
* 活动参与次数配置
*/
private Long activityCountId;
/**
* 抽奖策略ID
*/
private Long strategyId;
/**
* 活动状态
*/
private String state;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}
package cn.bugstack.infrastructure.persistent.po;
import lombok.Data;
import java.util.Date;
/**
* @description:
* @author: hdr
* @PACKAGE_NAME: cn.bugstack.infrastructure.persistent.po
* @DATE: 2024/5/7
*/
@Data
public class RaffleActivityOrder {
/**
* 自增ID
*/
private Long id;
/**
* 用户ID
*/
private String userId;
/**
* 活动ID
*/
private Long activityId;
/**
* 活动名称
*/
private String activityName;
/**
* 抽奖策略ID
*/
private Long strategyId;
/**
* 订单ID
*/
private String orderId;
/**
* 下单时间
*/
private Date orderTime;
/**
* 订单状态(not_used、used、expire)
*/
private String state;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}
......@@ -30,23 +30,6 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<!-- 系统其他模块 -->
<dependency>
<groupId>cn.bugstack</groupId>
<artifactId>xfg-frame-market-api</artifactId>
</dependency>
<dependency>
<artifactId>xfg-frame-archetype-lite</artifactId>
<groupId>cn.bugstack</groupId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.bugstack</groupId>
<artifactId>xfg-frame-archetype-lite-domain</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册