Commit 3a1e5c1b5fdcbb25c7a13ac8124e70bd60551f3e
1 parent
ef656cf7
pay : 会员电子钱包表结构
Showing
7 changed files
with
253 additions
and
0 deletions
sql/mysql/optional/pay_temp.sql
0 → 100644
| 1 | +-- ---------------------------- | ||
| 2 | +-- 支付-会员钱包表 | ||
| 3 | +-- ---------------------------- | ||
| 4 | +DROP TABLE IF EXISTS `pay_member_wallet`; | ||
| 5 | +CREATE TABLE `pay_member_wallet` | ||
| 6 | +( | ||
| 7 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', | ||
| 8 | + `user_id` bigint NOT NULL COMMENT '用户 id', | ||
| 9 | + `balance` int NOT NULL DEFAULT 0 COMMENT '余额, 单位分', | ||
| 10 | + `total_spending` int NOT NULL DEFAULT 0 COMMENT '累计支出, 单位分', | ||
| 11 | + `total_top_up` int NOT NULL DEFAULT 0 COMMENT '累计充值, 单位分', | ||
| 12 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 13 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 14 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 15 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 16 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 17 | + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 18 | + PRIMARY KEY (`id`) USING BTREE | ||
| 19 | +) ENGINE=InnoDB COMMENT='会员钱包表'; | ||
| 20 | + | ||
| 21 | +-- ---------------------------- | ||
| 22 | +-- 支付-会员钱包明细表 | ||
| 23 | +-- ---------------------------- | ||
| 24 | +DROP TABLE IF EXISTS `pay_member_wallet_transaction`; | ||
| 25 | +CREATE TABLE `pay_member_wallet_transaction` | ||
| 26 | +( | ||
| 27 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', | ||
| 28 | + `wallet_id` bigint NOT NULL COMMENT '会员钱包 id', | ||
| 29 | + `user_id` bigint NOT NULL COMMENT '用户 id', | ||
| 30 | + `trade_no` varchar(64) COMMENT '交易单号', | ||
| 31 | + `category` tinyint NOT NULL COMMENT '交易大类', | ||
| 32 | + `operate_type` tinyint NOT NULL COMMENT '操作分类', | ||
| 33 | + `operate_desc` varchar(64) NOT NULL COMMENT '操作说明', | ||
| 34 | + `amount` int NOT NULL COMMENT '交易金额, 单位分', | ||
| 35 | + `balance` int NOT NULL COMMENT '余额, 单位分', | ||
| 36 | + `mark` varchar(512) COMMENT '备注', | ||
| 37 | + `transaction_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '交易时间', | ||
| 38 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 39 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 40 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 41 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 42 | + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 43 | + PRIMARY KEY (`id`) USING BTREE | ||
| 44 | +) ENGINE=InnoDB COMMENT='会员钱包明细表'; | ||
| 0 | \ No newline at end of file | 45 | \ No newline at end of file |
yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletOperateTypeEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.enums.member; | ||
| 2 | + | ||
| 3 | +import lombok.AllArgsConstructor; | ||
| 4 | +import lombok.Getter; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 钱包操作类型枚举 | ||
| 8 | + * | ||
| 9 | + * @author jason | ||
| 10 | + */ | ||
| 11 | +@AllArgsConstructor | ||
| 12 | +@Getter | ||
| 13 | +public enum WalletOperateTypeEnum { | ||
| 14 | + TOP_UP_INC(1, "充值增加"), | ||
| 15 | + ORDER_DEC(2, "订单消费扣除"); | ||
| 16 | + // TODO 其它类型 | ||
| 17 | + | ||
| 18 | + private final Integer type; | ||
| 19 | + | ||
| 20 | + private final String desc; | ||
| 21 | +} |
yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletTransactionGategoryEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.enums.member; | ||
| 2 | + | ||
| 3 | +import lombok.AllArgsConstructor; | ||
| 4 | +import lombok.Getter; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 钱包交易大类枚举 | ||
| 8 | + * | ||
| 9 | + * @author jason | ||
| 10 | + */ | ||
| 11 | +@AllArgsConstructor | ||
| 12 | +@Getter | ||
| 13 | +public enum WalletTransactionGategoryEnum { | ||
| 14 | + TOP_UP(1, "充值"), | ||
| 15 | + SPENDING(2, "支出"); | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * 分类 | ||
| 19 | + */ | ||
| 20 | + private final Integer category; | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 说明 | ||
| 24 | + */ | ||
| 25 | + private final String desc; | ||
| 26 | +} |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/member/MemberWalletDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.dal.dataobject.member; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 7 | +import lombok.Data; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 支付-会员钱包 DO | ||
| 11 | + * | ||
| 12 | + * @author jason | ||
| 13 | + */ | ||
| 14 | +@TableName(value ="pay_member_wallet") | ||
| 15 | +@KeySequence("pay_member_wallet_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 16 | +@Data | ||
| 17 | +public class MemberWalletDO extends BaseDO { | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 编号 | ||
| 21 | + */ | ||
| 22 | + @TableId | ||
| 23 | + private Long id; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 用户 id | ||
| 27 | + * | ||
| 28 | + * 关联 MemberUserDO 的 id 编号 | ||
| 29 | + */ | ||
| 30 | + private Long userId; | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 余额, 单位分 | ||
| 34 | + */ | ||
| 35 | + private Integer balance; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 累计支出, 单位分 | ||
| 39 | + */ | ||
| 40 | + private Integer totalSpending; | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 累计充值, 单位分 | ||
| 44 | + */ | ||
| 45 | + private Integer totalTopUp; | ||
| 46 | +} | ||
| 0 | \ No newline at end of file | 47 | \ No newline at end of file |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/member/MemberWalletTransactionDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.dal.dataobject.member; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | +import cn.iocoder.yudao.module.pay.enums.member.WalletOperateTypeEnum; | ||
| 5 | +import cn.iocoder.yudao.module.pay.enums.member.WalletTransactionGategoryEnum; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 7 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 8 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 9 | +import lombok.Data; | ||
| 10 | + | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 支付-会员钱包明细 DO | ||
| 15 | + * | ||
| 16 | + * @author jason | ||
| 17 | + */ | ||
| 18 | +@TableName(value ="pay_member_wallet_transaction") | ||
| 19 | +@KeySequence("pay_member_wallet_transaction_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 20 | +@Data | ||
| 21 | +public class MemberWalletTransactionDO extends BaseDO { | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 编号 | ||
| 25 | + */ | ||
| 26 | + @TableId | ||
| 27 | + private Long id; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 会员钱包 id | ||
| 31 | + * | ||
| 32 | + * 关联 {@link MemberWalletDO#getId()} | ||
| 33 | + */ | ||
| 34 | + private Long walletId; | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 用户 id | ||
| 38 | + * | ||
| 39 | + * 关联 MemberUserDO 的 id 编号 | ||
| 40 | + */ | ||
| 41 | + private Long userId; | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 交易单号 @芋艿 这里是关联交易单号, 还是订单号 , 退款单号! ?? | ||
| 45 | + */ | ||
| 46 | + private String tradeNo; | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 交易分类 | ||
| 50 | + * | ||
| 51 | + * 枚举 {@link WalletTransactionGategoryEnum#getCategory()} | ||
| 52 | + */ | ||
| 53 | + private Integer category; | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * 操作分类 | ||
| 57 | + * | ||
| 58 | + * 枚举 {@link WalletOperateTypeEnum#getType()} | ||
| 59 | + */ | ||
| 60 | + private Integer operateType; | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 操作详情 | ||
| 64 | + */ | ||
| 65 | + private String operateDesc; | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * 交易金额, 单位分 | ||
| 69 | + */ | ||
| 70 | + private Integer amount; | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 余额, 单位分 | ||
| 74 | + */ | ||
| 75 | + private Integer balance; | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * 备注 | ||
| 79 | + */ | ||
| 80 | + private String mark; | ||
| 81 | + | ||
| 82 | + /** | ||
| 83 | + * 交易时间 | ||
| 84 | + */ | ||
| 85 | + private LocalDateTime transactionTime; | ||
| 86 | +} | ||
| 0 | \ No newline at end of file | 87 | \ No newline at end of file |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/member/MemberWalletMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.dal.mysql.member; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 5 | +import cn.iocoder.yudao.module.pay.dal.dataobject.member.MemberWalletDO; | ||
| 6 | +import org.apache.ibatis.annotations.Mapper; | ||
| 7 | + | ||
| 8 | +@Mapper | ||
| 9 | +public interface MemberWalletMapper extends BaseMapperX<MemberWalletDO> { | ||
| 10 | + | ||
| 11 | +} | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/member/MemberWalletTransactionMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.dal.mysql.member; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 5 | +import cn.iocoder.yudao.module.pay.dal.dataobject.member.MemberWalletTransactionDO; | ||
| 6 | +import org.apache.ibatis.annotations.Mapper; | ||
| 7 | + | ||
| 8 | +@Mapper | ||
| 9 | +public interface MemberWalletTransactionMapper extends BaseMapperX<MemberWalletTransactionDO> { | ||
| 10 | + | ||
| 11 | +} | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + |