Compare commits
46 Commits
562769f9c0
...
feature/xu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
720937581f | ||
|
|
261a8b4797 | ||
| c283800915 | |||
| 483abcfd83 | |||
| 4ebe4f9ac6 | |||
| 90e28f056a | |||
| a5a10898a2 | |||
|
|
00d4e0c3e8 | ||
| 4042fd297d | |||
|
|
0ce1eae772 | ||
|
|
3497962627 | ||
|
|
15e801e426 | ||
|
|
b2e0cca804 | ||
| 22b96b6feb | |||
| fc62fa3167 | |||
| 190e0e1605 | |||
| 3fbb1383fd | |||
| 191eadbf77 | |||
|
|
7fdf546585 | ||
| b6630f3f61 | |||
| f7d4ef8e4c | |||
|
|
ef99dbe035 | ||
| e5f0d57286 | |||
| de062744b4 | |||
| 2943caf779 | |||
| 6ff940777f | |||
| 1cdbf43f29 | |||
| 89c233ca9f | |||
| 5a45668c61 | |||
| 22fc268fcb | |||
| 077fb92772 | |||
| a1c4ae3564 | |||
| 98fc7be679 | |||
| 4ae13cf1e6 | |||
| ab85648edf | |||
| cba541169d | |||
| 53e88feefe | |||
|
|
73748a6fc0 | ||
|
|
a6b1cb2ac9 | ||
|
|
ecb8f31850 | ||
|
|
4711bb8cbc | ||
|
|
40f0ecd162 | ||
|
|
27e51b6278 | ||
|
|
eeab4e5ea3 | ||
|
|
a5f992c090 | ||
|
|
a99402c6b0 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -31,6 +31,8 @@ target/*
|
|||||||
/.nb-gradle/
|
/.nb-gradle/
|
||||||
/build/
|
/build/
|
||||||
.idea
|
.idea
|
||||||
|
.cursor
|
||||||
|
.lingma
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
16
pom.xml
16
pom.xml
@@ -47,6 +47,22 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>prod</id>
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<excludes>
|
||||||
|
<exclude>*.yaml</exclude>
|
||||||
|
</excludes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<pluginManagement>
|
<pluginManagement>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
暂未适配 IBM DB2 数据库,如果你有需要,可以微信联系 wangwenbin-server 一起建设。
|
|
||||||
|
|
||||||
你需要把表结构与数据导入到 DM 数据库,我a来测试与适配代码。
|
|
||||||
113
sql/mysql/ai-manage.sql
Normal file
113
sql/mysql/ai-manage.sql
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
DROP TABLE IF EXISTS `tz_ai_sample`;
|
||||||
|
CREATE TABLE `tz_ai_sample`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`sample_file_id` bigint NOT NULL COMMENT '样本文件id',
|
||||||
|
`sample_name` varchar(64) NULL DEFAULT '' COMMENT '样本名称',
|
||||||
|
`sample_time` varchar(16) NULL DEFAULT '' COMMENT '样本时长',
|
||||||
|
`sample_mine_type` varchar(16) NULL DEFAULT '' COMMENT '样本格式',
|
||||||
|
`sample_size` varchar(16) NULL DEFAULT '' COMMENT '样本大小',
|
||||||
|
`remark` varchar(255) NULL DEFAULT '' COMMENT '样本注释',
|
||||||
|
`creator` varchar(64) NULL DEFAULT '' COMMENT '创建者',
|
||||||
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`updater` varchar(64) NULL DEFAULT '' COMMENT '更新者',
|
||||||
|
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `idx_create_time` (`create_time` ASC) USING BTREE
|
||||||
|
) ENGINE = InnoDB COMMENT = '样本库';
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `tz_ai_sample_tag_relate`;
|
||||||
|
CREATE TABLE `tz_ai_sample_tag_relate`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`sample_id` bigint NOT NULL COMMENT '样本id',
|
||||||
|
`sample_tag_id` bigint NOT NULL COMMENT '样本标签id',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB COMMENT = '样本-标签关联表';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `tz_ai_sample_tag`;
|
||||||
|
CREATE TABLE `tz_ai_sample_tag`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`tag_name` varchar(64) NULL DEFAULT '' COMMENT '标签名称',
|
||||||
|
`creator` varchar(64) NULL DEFAULT '' COMMENT '创建者',
|
||||||
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`updater` varchar(64) NULL DEFAULT '' COMMENT '更新者',
|
||||||
|
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `idx_create_time` (`create_time` ASC) USING BTREE
|
||||||
|
) ENGINE = InnoDB COMMENT = '样本标签库';
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `tz_ai_sample_tag_group`;
|
||||||
|
CREATE TABLE `tz_ai_sample_tag_group`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`group_name` varchar(64) NULL DEFAULT '' COMMENT '分组名称',
|
||||||
|
`creator` varchar(64) NULL DEFAULT '' COMMENT '创建者',
|
||||||
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`updater` varchar(64) NULL DEFAULT '' COMMENT '更新者',
|
||||||
|
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `idx_create_time` (`create_time` ASC) USING BTREE
|
||||||
|
) ENGINE = InnoDB COMMENT = '样本标签分组库';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `tz_ai_sample_tag_group_relate`;
|
||||||
|
CREATE TABLE `tz_ai_sample_tag_group_relate`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`sample_tag_id` bigint NOT NULL COMMENT '样本标签id',
|
||||||
|
`sample_tag_group_id` bigint NOT NULL COMMENT '样本标签分组id',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB COMMENT = '样本标签-分组关联表';
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `tz_ai_dialog`;
|
||||||
|
CREATE TABLE `tz_ai_dialog`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`title` varchar(128) DEFAULT '' COMMENT '对话标题',
|
||||||
|
`user_id` bigint NOT NULL COMMENT '用户id',
|
||||||
|
`dialog_status` int DEFAULT NULL COMMENT '对话状态(1active, 2archived, 3deleted)',
|
||||||
|
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
|
||||||
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
|
||||||
|
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
|
`tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB COMMENT ='ai-对话表';
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `tz_ai_dialog_message`;
|
||||||
|
CREATE TABLE `tz_ai_dialog_message`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`dialog_id` bigint NOT NULL COMMENT '对话id',
|
||||||
|
`content_text` text COMMENT '内容',
|
||||||
|
`content_type` int DEFAULT NULL COMMENT '文本类型(1text,2file)',
|
||||||
|
`message_order` int DEFAULT NULL COMMENT '对话中的顺序',
|
||||||
|
`message_status` int DEFAULT NULL COMMENT '消息状态 1正常 0删除',
|
||||||
|
`pet_id` bigint DEFAULT NULL COMMENT '宠物id',
|
||||||
|
`pet_name` varchar(255) DEFAULT NULL COMMENT '宠物名称',
|
||||||
|
`pet_avatar` varchar(255) DEFAULT NULL COMMENT '宠物头像',
|
||||||
|
`pet_type` varchar(64) DEFAULT NULL COMMENT '宠物类型',
|
||||||
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`trans_result` text COMMENT '回答结果',
|
||||||
|
`content_duration` bigint DEFAULT NULL COMMENT '文件时长',
|
||||||
|
`trans_status` int DEFAULT NULL COMMENT '翻译状态(1成功 0失败)',
|
||||||
|
`source_result` text COMMENT '原始结果',
|
||||||
|
`file_name` varchar(255) DEFAULT NULL COMMENT '文件名称',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB COMMENT ='ai-对话消息表';
|
||||||
|
|
||||||
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
-- 会员用户表 (tz_member_user)
|
|
||||||
CREATE TABLE `tz_member_user` (
|
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
|
||||||
`mobile` varchar(11) NOT NULL COMMENT '手机',
|
|
||||||
`password` varchar(128) NOT NULL COMMENT '加密后的密码',
|
|
||||||
`status` tinyint(4) NOT NULL COMMENT '帐号状态 (枚举 CommonStatusEnum)',
|
|
||||||
`register_ip` varchar(32) DEFAULT NULL COMMENT '注册 IP',
|
|
||||||
`register_terminal` tinyint(4) DEFAULT NULL COMMENT '注册终端 (枚举 TerminalEnum)',
|
|
||||||
`login_ip` varchar(32) DEFAULT NULL COMMENT '最后登录IP',
|
|
||||||
`login_date` datetime DEFAULT NULL COMMENT '最后登录时间',
|
|
||||||
`nickname` varchar(64) DEFAULT NULL COMMENT '用户昵称',
|
|
||||||
`avatar` varchar(512) DEFAULT NULL COMMENT '用户头像',
|
|
||||||
`name` varchar(64) DEFAULT NULL COMMENT '真实名字',
|
|
||||||
`sex` tinyint(4) DEFAULT NULL COMMENT '性别 (枚举 SexEnum)',
|
|
||||||
`birthday` datetime DEFAULT NULL COMMENT '出生日期',
|
|
||||||
`area_id` int(11) DEFAULT NULL COMMENT '所在地 (关联 Area.id 字段)',
|
|
||||||
`mark` varchar(512) DEFAULT NULL COMMENT '用户备注',
|
|
||||||
`point` int(11) DEFAULT NULL COMMENT '积分',
|
|
||||||
`tag_ids` varchar(512) DEFAULT NULL COMMENT '会员标签列表,以逗号分隔',
|
|
||||||
`level_id` bigint(20) DEFAULT NULL COMMENT '会员级别编号 (关联 MemberLevelDO.id 字段)',
|
|
||||||
`experience` int(11) DEFAULT NULL COMMENT '会员经验',
|
|
||||||
`group_id` bigint(20) DEFAULT NULL COMMENT '用户分组编号 (关联 MemberGroupDO.id 字段)',
|
|
||||||
`tenant_id` bigint(20) NOT NULL COMMENT '租户ID',
|
|
||||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
|
||||||
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
|
||||||
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
|
||||||
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
|
||||||
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `uk_mobile` (`mobile`),
|
|
||||||
KEY `idx_level_id` (`level_id`),
|
|
||||||
KEY `idx_group_id` (`group_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员用户表';
|
|
||||||
|
|
||||||
-- 用户收件地址表 (tz_member_address)
|
|
||||||
CREATE TABLE `tz_member_address` (
|
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
|
||||||
`user_id` bigint(20) NOT NULL COMMENT '用户编号',
|
|
||||||
`name` varchar(64) NOT NULL COMMENT '收件人名称',
|
|
||||||
`mobile` varchar(11) NOT NULL COMMENT '手机号',
|
|
||||||
`area_id` bigint(20) NOT NULL COMMENT '地区编号',
|
|
||||||
`detail_address` varchar(512) NOT NULL COMMENT '收件详细地址',
|
|
||||||
`default_status` tinyint(1) DEFAULT NULL COMMENT '是否默认 (true - 默认收件地址)',
|
|
||||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
|
||||||
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
|
||||||
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
|
||||||
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
|
||||||
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `idx_user_id` (`user_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户收件地址表';
|
|
||||||
@@ -1,56 +1,74 @@
|
|||||||
-- 基础实体表结构 (BaseDO) 不单独建表,字段会被继承到其他表中
|
-- 基础实体表结构 (BaseDO) 不单独建表,字段会被继承到其他表中
|
||||||
|
|
||||||
-- 交易订单表 (trade_order)
|
|
||||||
CREATE TABLE `tz_trade_order`
|
CREATE TABLE `tz_trade_order`
|
||||||
(
|
(
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '订单编号,主键自增',
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '订单编号,主键自增',
|
||||||
`order_num` varchar(64) NOT NULL COMMENT '订单流水号',
|
`order_num` varchar(64) NOT NULL COMMENT '订单流水号',
|
||||||
`order_type` tinyint(4) NOT NULL COMMENT '订单类型 (枚举 TradeOrderTypeEnum)',
|
`order_category_id` bigint NOT NULL COMMENT '订单类目id',
|
||||||
`order_terminal` tinyint(4) NOT NULL COMMENT '订单来源 (枚举 TerminalEnum)',
|
`order_category_name` varchar(64) NOT NULL COMMENT '订单类目名称',
|
||||||
`order_status` tinyint(4) NOT NULL COMMENT '订单状态 (枚举 TradeOrderStatusEnum)',
|
`order_type` tinyint NOT NULL COMMENT '订单类型 (枚举 TradeOrderTypeEnum)',
|
||||||
`user_id` bigint(20) NOT NULL COMMENT '用户编号',
|
`order_terminal` tinyint NOT NULL COMMENT '订单来源 (枚举 TerminalEnum)',
|
||||||
|
`order_status` tinyint NOT NULL COMMENT '订单状态 (枚举 TradeOrderStatusEnum)',
|
||||||
|
`user_id` bigint NOT NULL COMMENT '用户编号',
|
||||||
`user_ip` varchar(64) DEFAULT NULL COMMENT '用户IP',
|
`user_ip` varchar(64) DEFAULT NULL COMMENT '用户IP',
|
||||||
|
`user_name` varchar(64) DEFAULT NULL COMMENT '用户昵称',
|
||||||
|
`user_mobile` varchar(11) DEFAULT NULL COMMENT '用户手机号',
|
||||||
`user_remark` varchar(512) DEFAULT NULL COMMENT '用户备注',
|
`user_remark` varchar(512) DEFAULT NULL COMMENT '用户备注',
|
||||||
`finish_time` datetime DEFAULT NULL COMMENT '订单完成时间',
|
`finish_time` datetime DEFAULT NULL COMMENT '订单完成时间',
|
||||||
`cancel_time` datetime DEFAULT NULL COMMENT '订单取消时间',
|
`cancel_time` datetime DEFAULT NULL COMMENT '订单取消时间',
|
||||||
`cancel_type` tinyint(4) DEFAULT NULL COMMENT '取消类型 (枚举 TradeOrderCancelTypeEnum)',
|
`cancel_type` tinyint DEFAULT NULL COMMENT '取消类型 (枚举 TradeOrderCancelTypeEnum)',
|
||||||
|
`cancel_reason` varchar(128) DEFAULT NULL COMMENT '取消原因',
|
||||||
|
`merchant_id` bigint DEFAULT NULL COMMENT '商家编号',
|
||||||
|
`merchant_name` varchar(64) DEFAULT NULL COMMENT '商家名称',
|
||||||
`merchant_remark` varchar(512) DEFAULT NULL COMMENT '商家备注',
|
`merchant_remark` varchar(512) DEFAULT NULL COMMENT '商家备注',
|
||||||
`comment_status` tinyint(1) DEFAULT NULL COMMENT '是否评价 (true-已评价, false-未评价)',
|
`comment_status` tinyint(1) DEFAULT NULL COMMENT '是否评价 (true-已评价, false-未评价)',
|
||||||
`total_price` int(11) NOT NULL COMMENT '商品原价,单位:分',
|
`sub_type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '预约类型(1预约 2 加急)',
|
||||||
`discount_price` int(11) NOT NULL COMMENT '优惠金额,单位:分',
|
`sub_time` datetime NOT NULL COMMENT '预约时间',
|
||||||
`delivery_price` int(11) NOT NULL COMMENT '运费金额,单位:分',
|
`expense_price` int(11) DEFAULT NULL COMMENT '商品成本(单),单位:分',
|
||||||
`adjust_price` int(11) NOT NULL COMMENT '订单调价,单位:分',
|
`price` int(11) DEFAULT NULL COMMENT '商品原价(单),单位:分',
|
||||||
`pay_price` int(11) NOT NULL COMMENT '应付金额(总),单位:分',
|
`discount_price` int(11) DEFAULT NULL COMMENT '优惠金额(总),单位:分',
|
||||||
`pay_order_id` bigint(20) DEFAULT NULL COMMENT '支付订单编号',
|
`delivery_price` int(11) DEFAULT NULL COMMENT '运费金额(总),单位:分',
|
||||||
`pay_status` tinyint(1) NOT NULL COMMENT '是否已支付 (true-已支付, false-未支付)',
|
`adjust_price` int(11) DEFAULT NULL COMMENT '订单调价(总),单位:分',
|
||||||
|
`pay_price` int(11) DEFAULT NULL COMMENT '应付金额(总),单位:分',
|
||||||
|
`live_price` int(11) DEFAULT NULL COMMENT '实收金额(总),单位:分',
|
||||||
|
`pay_order_id` bigint DEFAULT NULL COMMENT '支付订单编号',
|
||||||
|
`pay_status` tinyint(1) DEFAULT NULL COMMENT '是否已支付 (true-已支付, false-未支付)',
|
||||||
|
`pay_type` tinyint DEFAULT NULL COMMENT '支付方式(PayTypeEnum)',
|
||||||
`pay_time` datetime DEFAULT NULL COMMENT '付款时间',
|
`pay_time` datetime DEFAULT NULL COMMENT '付款时间',
|
||||||
`pay_channel_code` varchar(64) DEFAULT NULL COMMENT '支付渠道',
|
`pay_channel_code` tinyint DEFAULT NULL COMMENT '支付渠道(PayTypeEnum)',
|
||||||
`delivery_type` tinyint(4) NOT NULL COMMENT '配送方式 (枚举 DeliveryTypeEnum)',
|
`delivery_type` tinyint DEFAULT NULL COMMENT '配送方式 (枚举 DeliveryTypeEnum)',
|
||||||
`logistics_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '发货物流公司编号',
|
`logistics_id` bigint DEFAULT '0' COMMENT '发货物流公司编号',
|
||||||
`logistics_no` varchar(64) DEFAULT '' COMMENT '发货物流单号',
|
`logistics_no` varchar(64) DEFAULT '' COMMENT '发货物流单号',
|
||||||
`delivery_time` datetime DEFAULT NULL COMMENT '发货时间',
|
`delivery_time` datetime DEFAULT NULL COMMENT '发货时间',
|
||||||
`receive_time` datetime DEFAULT NULL COMMENT '收货时间',
|
`receive_time` datetime DEFAULT NULL COMMENT '收货时间',
|
||||||
`receiver_name` varchar(64) NOT NULL COMMENT '收件人名称',
|
`receiver_name` varchar(64) DEFAULT NULL COMMENT '收件人名称',
|
||||||
`receiver_mobile` varchar(20) NOT NULL COMMENT '收件人手机',
|
`receiver_mobile` varchar(20) DEFAULT NULL COMMENT '收件人手机',
|
||||||
`receiver_area_id` int(11) NOT NULL COMMENT '收件人地区编号',
|
`receiver_area_id` int DEFAULT NULL COMMENT '收件人地区编号',
|
||||||
`receiver_detail_address` varchar(512) NOT NULL COMMENT '收件人详细地址',
|
`receiver_detail_address` varchar(512) DEFAULT NULL COMMENT '收件人详细地址',
|
||||||
`pick_up_store_id` bigint(20) DEFAULT NULL COMMENT '自提门店编号',
|
`pick_up_store_id` bigint DEFAULT NULL COMMENT '自提门店编号',
|
||||||
`pick_up_verify_code` varchar(64) DEFAULT NULL COMMENT '自提核销码',
|
`pick_up_verify_code` varchar(64) DEFAULT NULL COMMENT '自提核销码',
|
||||||
`refund_status` tinyint(4) NOT NULL COMMENT '退款状态 (枚举 TradeOrderRefundStatusEnum)',
|
`refund_status` tinyint DEFAULT NULL COMMENT '退款状态 (枚举 TradeOrderRefundStatusEnum)',
|
||||||
`refund_price` int(11) NOT NULL COMMENT '退款金额,单位:分',
|
`refund_price` int DEFAULT NULL COMMENT '退款金额,单位:分',
|
||||||
`after_sale_id` bigint(20) DEFAULT NULL COMMENT '售后单编号',
|
`refund_time` datetime DEFAULT NULL COMMENT '退款时间',
|
||||||
`after_sale_status` tinyint(4) NOT NULL COMMENT '售后状态 (枚举 TradeOrderItemAfterSaleStatusEnum)',
|
`after_sale_id` bigint DEFAULT NULL COMMENT '售后单编号',
|
||||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
`after_sale_status` tinyint DEFAULT NULL COMMENT '售后状态 (枚举 TradeOrderItemAfterSaleStatusEnum)',
|
||||||
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
`finance_id` bigint DEFAULT NULL COMMENT '财务单编号',
|
||||||
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
`finance_status` tinyint DEFAULT NULL COMMENT '财务状态 (枚举 TradeOrderItemFinanceEnum)',
|
||||||
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
`version` int NOT NULL DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||||||
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime DEFAULT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) DEFAULT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) DEFAULT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `uk_order_num` (`order_num`),
|
UNIQUE KEY `uk_order_num` (`order_num`),
|
||||||
KEY `idx_user_id` (`user_id`),
|
KEY `idx_user_id` (`user_id`),
|
||||||
KEY `idx_status` (`order_status`),
|
KEY `idx_status` (`order_status`),
|
||||||
KEY `idx_pay_status` (`pay_status`)
|
KEY `idx_pay_status` (`pay_status`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='交易订单表';
|
) ENGINE = InnoDB
|
||||||
|
AUTO_INCREMENT = 2
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_0900_ai_ci COMMENT ='交易订单表';
|
||||||
|
|
||||||
|
|
||||||
-- 交易订单项表 (trade_order_item)
|
-- 交易订单项表 (trade_order_item)
|
||||||
CREATE TABLE `tz_trade_order_item`
|
CREATE TABLE `tz_trade_order_item`
|
||||||
@@ -59,19 +77,28 @@ CREATE TABLE `tz_trade_order_item`
|
|||||||
`user_id` bigint(20) NOT NULL COMMENT '用户编号',
|
`user_id` bigint(20) NOT NULL COMMENT '用户编号',
|
||||||
`order_id` bigint(20) NOT NULL COMMENT '订单编号',
|
`order_id` bigint(20) NOT NULL COMMENT '订单编号',
|
||||||
`cart_id` bigint(20) DEFAULT NULL COMMENT '购物车项编号',
|
`cart_id` bigint(20) DEFAULT NULL COMMENT '购物车项编号',
|
||||||
`prod_id` bigint(20) NOT NULL COMMENT '商品 SPU 编号',
|
`spu_id` bigint(20) NOT NULL COMMENT '商品 SPU 编号',
|
||||||
`prod_name` varchar(256) NOT NULL COMMENT '商品 SPU 名称',
|
`spu_name` varchar(256) NOT NULL COMMENT '商品 SPU 名称',
|
||||||
|
`spu_type` tinyint(1) NOT NULL COMMENT '商品类型(1商品 2服务)',
|
||||||
`sku_id` bigint(20) NOT NULL COMMENT '商品 SKU 编号',
|
`sku_id` bigint(20) NOT NULL COMMENT '商品 SKU 编号',
|
||||||
`properties` json DEFAULT NULL COMMENT '属性数组',
|
`sku_name` bigint(20) NOT NULL COMMENT '商品 SKU 名称',
|
||||||
`pic_url` varchar(512) NOT NULL COMMENT '商品图片',
|
`pic_url` varchar(512) NOT NULL COMMENT '商品图片',
|
||||||
`count` int(11) NOT NULL COMMENT '购买数量',
|
`count` int(11) NOT NULL COMMENT '购买数量',
|
||||||
|
`unit` varchar(16) NOT NULL COMMENT '商品单位',
|
||||||
|
`expense_price` int(11) NOT NULL COMMENT '商品成本(单),单位:分',
|
||||||
`price` int(11) NOT NULL COMMENT '商品原价(单),单位:分',
|
`price` int(11) NOT NULL COMMENT '商品原价(单),单位:分',
|
||||||
`discount_price` int(11) NOT NULL COMMENT '优惠金额(总),单位:分',
|
`discount_price` int(11) NOT NULL COMMENT '优惠金额(总),单位:分',
|
||||||
`delivery_price` int(11) NOT NULL COMMENT '运费金额(总),单位:分',
|
`delivery_price` int(11) NOT NULL COMMENT '运费金额(总),单位:分',
|
||||||
`adjust_price` int(11) NOT NULL COMMENT '订单调价(总),单位:分',
|
`adjust_price` int(11) NOT NULL COMMENT '订单调价(总),单位:分',
|
||||||
`pay_price` int(11) NOT NULL COMMENT '应付金额(总),单位:分',
|
`pay_price` int(11) NOT NULL COMMENT '应付金额(总),单位:分',
|
||||||
|
`live_price` int(11) NOT NULL COMMENT '实收金额(总),单位:分',
|
||||||
|
|
||||||
|
`serve_address` datetime NOT NULL COMMENT '服务地址',
|
||||||
|
`properties` json DEFAULT NULL COMMENT '属性数组',
|
||||||
|
`serve_info` json DEFAULT NULL COMMENT '服务信息',
|
||||||
`serve_ext_info` json DEFAULT NULL COMMENT '扩展服务信息,存储额外的服务相关数据',
|
`serve_ext_info` json DEFAULT NULL COMMENT '扩展服务信息,存储额外的服务相关数据',
|
||||||
`price_ext_info` json DEFAULT NULL COMMENT '附加费信息',
|
`price_ext_info` json DEFAULT NULL COMMENT '附加费信息',
|
||||||
|
`version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
@@ -81,7 +108,9 @@ CREATE TABLE `tz_trade_order_item`
|
|||||||
KEY `idx_order_id` (`order_id`),
|
KEY `idx_order_id` (`order_id`),
|
||||||
KEY `idx_sku_id` (`sku_id`),
|
KEY `idx_sku_id` (`sku_id`),
|
||||||
KEY `idx_user_id` (`user_id`)
|
KEY `idx_user_id` (`user_id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='交易订单项表';
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='交易订单项表';
|
||||||
|
|
||||||
|
|
||||||
-- 订单日志表 (trade_order_log)
|
-- 订单日志表 (trade_order_log)
|
||||||
CREATE TABLE `tz_trade_order_log`
|
CREATE TABLE `tz_trade_order_log`
|
||||||
@@ -102,10 +131,12 @@ CREATE TABLE `tz_trade_order_log`
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `idx_order_id` (`order_id`),
|
KEY `idx_order_id` (`order_id`),
|
||||||
KEY `idx_user_id` (`user_id`)
|
KEY `idx_user_id` (`user_id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单日志表';
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='订单日志表';
|
||||||
|
|
||||||
-- 售后订单表 (tz_trade_after_sale)
|
-- 售后订单表 (tz_trade_after_sale)
|
||||||
CREATE TABLE `tz_trade_after_sale` (
|
CREATE TABLE `tz_trade_after_sale`
|
||||||
|
(
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '售后编号,主键自增',
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '售后编号,主键自增',
|
||||||
`no` varchar(64) NOT NULL COMMENT '售后单号',
|
`no` varchar(64) NOT NULL COMMENT '售后单号',
|
||||||
`status` tinyint(4) NOT NULL COMMENT '退款状态 (枚举 AfterSaleStatusEnum)',
|
`status` tinyint(4) NOT NULL COMMENT '退款状态 (枚举 AfterSaleStatusEnum)',
|
||||||
@@ -146,10 +177,12 @@ CREATE TABLE `tz_trade_after_sale` (
|
|||||||
KEY `idx_order_id` (`order_id`),
|
KEY `idx_order_id` (`order_id`),
|
||||||
KEY `idx_order_item_id` (`order_item_id`),
|
KEY `idx_order_item_id` (`order_item_id`),
|
||||||
KEY `idx_status` (`status`)
|
KEY `idx_status` (`status`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='售后订单表';
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='售后订单表';
|
||||||
|
|
||||||
-- 交易售后日志表 (tz_trade_after_sale_log)
|
-- 交易售后日志表 (tz_trade_after_sale_log)
|
||||||
CREATE TABLE `tz_trade_after_sale_log` (
|
CREATE TABLE `tz_trade_after_sale_log`
|
||||||
|
(
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||||
`user_id` bigint(20) NOT NULL COMMENT '用户编号',
|
`user_id` bigint(20) NOT NULL COMMENT '用户编号',
|
||||||
`user_type` tinyint(4) NOT NULL COMMENT '用户类型 (枚举 UserTypeEnum)',
|
`user_type` tinyint(4) NOT NULL COMMENT '用户类型 (枚举 UserTypeEnum)',
|
||||||
@@ -167,11 +200,13 @@ CREATE TABLE `tz_trade_after_sale_log` (
|
|||||||
KEY `idx_after_sale_id` (`after_sale_id`),
|
KEY `idx_after_sale_id` (`after_sale_id`),
|
||||||
KEY `idx_user_id` (`user_id`),
|
KEY `idx_user_id` (`user_id`),
|
||||||
KEY `idx_operate_type` (`operate_type`)
|
KEY `idx_operate_type` (`operate_type`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='交易售后日志表';
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='交易售后日志表';
|
||||||
|
|
||||||
|
|
||||||
-- 快递公司表 (trade_delivery_express)
|
-- 快递公司表 (trade_delivery_express)
|
||||||
CREATE TABLE `tz_trade_delivery_express` (
|
CREATE TABLE `tz_trade_delivery_express`
|
||||||
|
(
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
||||||
`code` varchar(64) NOT NULL COMMENT '快递公司 code',
|
`code` varchar(64) NOT NULL COMMENT '快递公司 code',
|
||||||
`name` varchar(128) NOT NULL COMMENT '快递公司名称',
|
`name` varchar(128) NOT NULL COMMENT '快递公司名称',
|
||||||
@@ -185,10 +220,12 @@ CREATE TABLE `tz_trade_delivery_express` (
|
|||||||
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `uk_code` (`code`)
|
UNIQUE KEY `uk_code` (`code`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='快递公司表';
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='快递公司表';
|
||||||
|
|
||||||
-- 快递运费模板表 (trade_delivery_express_template)
|
-- 快递运费模板表 (trade_delivery_express_template)
|
||||||
CREATE TABLE `tz_trade_delivery_express_template` (
|
CREATE TABLE `tz_trade_delivery_express_template`
|
||||||
|
(
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
||||||
`name` varchar(128) NOT NULL COMMENT '模板名称',
|
`name` varchar(128) NOT NULL COMMENT '模板名称',
|
||||||
`charge_mode` tinyint(4) NOT NULL COMMENT '配送计费方式 (枚举 DeliveryExpressChargeModeEnum)',
|
`charge_mode` tinyint(4) NOT NULL COMMENT '配送计费方式 (枚举 DeliveryExpressChargeModeEnum)',
|
||||||
@@ -199,10 +236,12 @@ CREATE TABLE `tz_trade_delivery_express_template` (
|
|||||||
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='快递运费模板表';
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='快递运费模板表';
|
||||||
|
|
||||||
-- 快递运费模板计费配置表 (trade_delivery_express_template_charge)
|
-- 快递运费模板计费配置表 (trade_delivery_express_template_charge)
|
||||||
CREATE TABLE `tz_trade_delivery_express_template_charge` (
|
CREATE TABLE `tz_trade_delivery_express_template_charge`
|
||||||
|
(
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
||||||
`template_id` bigint(20) NOT NULL COMMENT '配送模板编号',
|
`template_id` bigint(20) NOT NULL COMMENT '配送模板编号',
|
||||||
`area_ids` varchar(512) NOT NULL COMMENT '配送区域编号列表',
|
`area_ids` varchar(512) NOT NULL COMMENT '配送区域编号列表',
|
||||||
@@ -219,10 +258,12 @@ CREATE TABLE `tz_trade_delivery_express_template_charge` (
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `idx_template_id` (`template_id`),
|
KEY `idx_template_id` (`template_id`),
|
||||||
CONSTRAINT `fk_express_template_charge_template_id` FOREIGN KEY (`template_id`) REFERENCES `tz_trade_delivery_express_template` (`id`)
|
CONSTRAINT `fk_express_template_charge_template_id` FOREIGN KEY (`template_id`) REFERENCES `tz_trade_delivery_express_template` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='快递运费模板计费配置表';
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='快递运费模板计费配置表';
|
||||||
|
|
||||||
-- 快递运费模板包邮配置表 (trade_delivery_express_template_free)
|
-- 快递运费模板包邮配置表 (trade_delivery_express_template_free)
|
||||||
CREATE TABLE `tz_trade_delivery_express_template_free` (
|
CREATE TABLE `tz_trade_delivery_express_template_free`
|
||||||
|
(
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||||
`template_id` bigint(20) NOT NULL COMMENT '配送模板编号',
|
`template_id` bigint(20) NOT NULL COMMENT '配送模板编号',
|
||||||
`area_ids` varchar(512) NOT NULL COMMENT '配送区域编号列表',
|
`area_ids` varchar(512) NOT NULL COMMENT '配送区域编号列表',
|
||||||
@@ -236,10 +277,12 @@ CREATE TABLE `tz_trade_delivery_express_template_free` (
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `idx_template_id` (`template_id`),
|
KEY `idx_template_id` (`template_id`),
|
||||||
CONSTRAINT `fk_express_template_free_template_id` FOREIGN KEY (`template_id`) REFERENCES `tz_trade_delivery_express_template` (`id`)
|
CONSTRAINT `fk_express_template_free_template_id` FOREIGN KEY (`template_id`) REFERENCES `tz_trade_delivery_express_template` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='快递运费模板包邮配置表';
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='快递运费模板包邮配置表';
|
||||||
|
|
||||||
-- 自提门店表 (trade_delivery_pick_up_store)
|
-- 自提门店表 (trade_delivery_pick_up_store)
|
||||||
CREATE TABLE `tz_trade_delivery_pick_up_store` (
|
CREATE TABLE `tz_trade_delivery_pick_up_store`
|
||||||
|
(
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||||
`name` varchar(128) NOT NULL COMMENT '门店名称',
|
`name` varchar(128) NOT NULL COMMENT '门店名称',
|
||||||
`introduction` varchar(512) DEFAULT NULL COMMENT '门店简介',
|
`introduction` varchar(512) DEFAULT NULL COMMENT '门店简介',
|
||||||
@@ -261,6 +304,23 @@ CREATE TABLE `tz_trade_delivery_pick_up_store` (
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `idx_area_id` (`area_id`),
|
KEY `idx_area_id` (`area_id`),
|
||||||
KEY `idx_status` (`status`)
|
KEY `idx_status` (`status`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自提门店表';
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='自提门店表';
|
||||||
|
|
||||||
|
-- 订单预约时间修改记录表 (tz_trade_sub_log)
|
||||||
|
CREATE TABLE `tz_trade_sub_log`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||||
|
`user_id` bigint(20) NOT NULL COMMENT '用户编号',
|
||||||
|
`order_id` bigint(20) NOT NULL COMMENT '订单号',
|
||||||
|
`sub_time` datetime NOT NULL COMMENT '预约时间',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_order_id` (`order_id`),
|
||||||
|
KEY `idx_user_id` (`user_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='订单预约时间修改记录表';
|
||||||
|
|
||||||
|
|||||||
90
sql/mysql/user.sql
Normal file
90
sql/mysql/user.sql
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
-- 登录用户表 (tz_login_user) 后续拓展用户信息表
|
||||||
|
CREATE TABLE `tz_user_login`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
||||||
|
`mobile` varchar(11) NOT NULL COMMENT '手机',
|
||||||
|
`password` varchar(128) NOT NULL COMMENT '加密后的密码',
|
||||||
|
`status` tinyint(4) NOT NULL COMMENT '帐号状态 (枚举 CommonStatusEnum)',
|
||||||
|
`register_ip` varchar(32) DEFAULT NULL COMMENT '注册 IP',
|
||||||
|
`register_terminal` tinyint(4) DEFAULT NULL COMMENT '注册渠道 (枚举 TerminalEnum)',
|
||||||
|
`register_date` datetime DEFAULT NULL COMMENT '注册时间',
|
||||||
|
`login_ip` varchar(32) DEFAULT NULL COMMENT '最后登录IP',
|
||||||
|
`login_date` datetime DEFAULT NULL COMMENT '最后登录时间',
|
||||||
|
`login_terminal` varchar(32) DEFAULT NULL COMMENT '最后登录设备',
|
||||||
|
`nickname` varchar(64) DEFAULT NULL COMMENT '用户昵称',
|
||||||
|
`avatar` varchar(512) DEFAULT NULL COMMENT '用户头像',
|
||||||
|
`remark` varchar(512) DEFAULT NULL COMMENT '用户备注',
|
||||||
|
`tenant_id` bigint(20) NOT NULL COMMENT '租户ID',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_mobile` (`mobile`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='登录用户表';
|
||||||
|
|
||||||
|
-- 会员信息表 (tz_user_member)
|
||||||
|
CREATE TABLE `tz_user_member`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
||||||
|
`name` varchar(64) DEFAULT NULL COMMENT '真实名字',
|
||||||
|
`sex` tinyint DEFAULT NULL COMMENT '性别 (枚举 SexEnum)',
|
||||||
|
`birthday` datetime DEFAULT NULL COMMENT '出生日期',
|
||||||
|
`area_id` int DEFAULT NULL COMMENT '所在地 (关联 Area.id 字段)',
|
||||||
|
`point` int DEFAULT NULL COMMENT '积分',
|
||||||
|
`tag_ids` varchar(512) DEFAULT NULL COMMENT '会员标签列表,以逗号分隔',
|
||||||
|
`level_id` bigint DEFAULT NULL COMMENT '会员级别编号 (关联 MemberLevelDO.id 字段)',
|
||||||
|
`experience` int DEFAULT NULL COMMENT '会员经验',
|
||||||
|
`group_id` bigint DEFAULT NULL COMMENT '用户分组编号 (关联 MemberGroupDO.id 字段)',
|
||||||
|
`tenant_id` bigint(20) NOT NULL COMMENT '租户ID',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='会员信息表';
|
||||||
|
|
||||||
|
-- 会员地址表 (tz_user_member_address)
|
||||||
|
CREATE TABLE `tz_user_member_address`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户编号',
|
||||||
|
`name` varchar(128) DEFAULT NULL COMMENT '收件人名称',
|
||||||
|
`mobile` varchar(11) DEFAULT NULL COMMENT '手机号',
|
||||||
|
`areaId` bigint(20) DEFAULT NULL COMMENT '地区编号',
|
||||||
|
`detailAddress` varchar(255) DEFAULT NULL COMMENT '收件详细地址',
|
||||||
|
`defaultStatus` int DEFAULT NULL COMMENT '是否默认',
|
||||||
|
`tenant_id` bigint(20) NOT NULL COMMENT '租户ID',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='会员地址表';
|
||||||
|
|
||||||
|
-- 会员等级表 (tz_user_member_level)
|
||||||
|
CREATE TABLE `tz_user_member_level`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||||
|
`level_name` varchar(64) DEFAULT NULL COMMENT '等级名称',
|
||||||
|
`level` int DEFAULT NULL COMMENT '性别 (枚举 SexEnum)',
|
||||||
|
`experience` int DEFAULT NULL COMMENT '会员经验',
|
||||||
|
`discount_percent` int DEFAULT NULL COMMENT '享受折扣',
|
||||||
|
`icon` varchar(128) DEFAULT NULL COMMENT '等级图标',
|
||||||
|
`background_url` varchar(128) DEFAULT NULL COMMENT '等级背景图',
|
||||||
|
`status` int DEFAULT NULL COMMENT '状态',
|
||||||
|
`tenant_id` bigint(20) NOT NULL COMMENT '租户ID',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='会员等级表';
|
||||||
|
|
||||||
8
sql/tools/.gitignore
vendored
8
sql/tools/.gitignore
vendored
@@ -1,8 +0,0 @@
|
|||||||
# 忽略python虚拟环境
|
|
||||||
.env
|
|
||||||
.venv
|
|
||||||
env/
|
|
||||||
venv/
|
|
||||||
ENV/
|
|
||||||
env.bak/
|
|
||||||
venv.bak/
|
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
## 0. 友情提示
|
|
||||||
|
|
||||||
在 `sql/tools` 目录下,我们提供一些数据库相关的工具,包括测试数据库的快速启动、MySQL 转换其它数据库等等。
|
|
||||||
|
|
||||||
注意!所有的操作,必须在 `sql/tools` 目录下执行。
|
|
||||||
|
|
||||||
## 1. 测试数据库的快速启动
|
|
||||||
|
|
||||||
基于 Docker Compose,快速启动 MySQL、Oracle、PostgreSQL、SQL Server 等数据库。
|
|
||||||
|
|
||||||
注意!使用 Docker Compose 启动完测试数据后,因为会自动导入项目的 SQL 脚本,所以可能需要等待 1-2 分钟。
|
|
||||||
|
|
||||||
### 1.1 MySQL
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker compose up -d mysql
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 1.2 Oracle
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
## x86 版本
|
|
||||||
docker compose up -d oracle
|
|
||||||
|
|
||||||
## MacBook Apple Silicon
|
|
||||||
docker compose up -d oracle_m1
|
|
||||||
```
|
|
||||||
|
|
||||||
> 注意:如果使用 MacBook Apple Silicon 版本,它的 ORACLE_SID 不是 XE,而是 FREE!!!
|
|
||||||
|
|
||||||
### 1.3 PostgreSQL
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker compose up -d postgres
|
|
||||||
```
|
|
||||||
|
|
||||||
### 1.4 SQL Server
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker compose up -d sqlserver
|
|
||||||
# 注意:启动完 sqlserver 后,需要手动再执行如下命令,因为 SQL Server 不支持初始化脚本
|
|
||||||
docker compose exec sqlserver bash /tmp/create_schema.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
### 1.5 DM 达梦
|
|
||||||
|
|
||||||
① 下载达梦 Docker 镜像:<https://eco.dameng.com/download/> 地址,点击“Docker 镜像”选项,进行下载。
|
|
||||||
|
|
||||||
② 加载镜像文件,在镜像 tar 文件所在目录运行:
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker load -i dm8_20240715_x86_rh6_rq_single.tar
|
|
||||||
```
|
|
||||||
|
|
||||||
③ 在项目 `sql/tools` 目录下运行:
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker compose up -d dm8
|
|
||||||
# 注意:启动完 dm 后,需要手动再执行如下命令,因为 dm 不支持初始化脚本
|
|
||||||
docker compose exec dm8 bash -c '/opt/dmdbms/bin/disql SYSDBA/SYSDBA001 \`/tmp/schema.sql'
|
|
||||||
exit
|
|
||||||
```
|
|
||||||
|
|
||||||
### 1.6 KingbaseES 人大金仓
|
|
||||||
|
|
||||||
① 下载人大金仓 Docker 镜像:
|
|
||||||
|
|
||||||
* [x86_64 版本](https://kingbase.oss-cn-beijing.aliyuncs.com/KESV8R3/V009R001C001B0025-安装包-docker/x86_64/kdb_x86_64_V009R001C001B0025.tar) 【Windows 选择这个】
|
|
||||||
* [aarch64 版本](https://kingbase.oss-cn-beijing.aliyuncs.com/KESV8R3/V009R001C001B0025-安装包-docker/aarch64/kdb_aarch64_V009R001C001B0025.tar) 【MacBook Apple Silicon 选择这个】
|
|
||||||
|
|
||||||
② 加载镜像文件,在镜像 tar 文件所在目录运行:
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker load -i kdb_x86_64_V009R001C001B0025.tar
|
|
||||||
```
|
|
||||||
|
|
||||||
③ 在项目 `sql/tools` 目录下运行:
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker compose up -d kingbase
|
|
||||||
# 注意:启动完 kingbase 后,需要手动再执行如下命令
|
|
||||||
docker compose exec kingbase bash -c 'ksql -U $DB_USER -d test -f /tmp/schema.sql'
|
|
||||||
```
|
|
||||||
|
|
||||||
### 1.7 华为 OpenGauss
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker compose up -d opengauss
|
|
||||||
# 注意:启动完 opengauss 后,需要手动再执行如下命令
|
|
||||||
docker compose exec opengauss bash -c '/usr/local/opengauss/bin/gsql -U $GS_USERNAME -W $GS_PASSWORD -d postgres -f /tmp/schema.sql'
|
|
||||||
```
|
|
||||||
|
|
||||||
## 1.X 容器的销毁重建
|
|
||||||
|
|
||||||
开发测试过程中,有时候需要创建全新干净的数据库。由于测试数据 Docker 容器采用数据卷 Volume 挂载数据库实例的数据目录,因此销毁数据需要停止容器后,删除数据卷,然后再重新创建容器。
|
|
||||||
|
|
||||||
以 postgres 为例,操作如下:
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker compose down postgres
|
|
||||||
docker volume rm ruoyi-vue-pro_postgres
|
|
||||||
```
|
|
||||||
|
|
||||||
## 2. MySQL 转换其它数据库
|
|
||||||
|
|
||||||
项目提供了 `sql/tools/convertor.py` 脚本,支持将 MySQL 转换为 Oracle、PostgreSQL、SQL Server、达梦、人大金仓、OpenGauss 等数据库的脚本。
|
|
||||||
|
|
||||||
### 2.1 实现原理
|
|
||||||
|
|
||||||
通过读取 MySQL 的 `sql/mysql/ruoyi-vue-pro.sql` 数据库文件,转换成对应的数据库脚本。
|
|
||||||
|
|
||||||
### 2.2 使用方法
|
|
||||||
|
|
||||||
① 安装依赖库 `simple-ddl-parser`
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pip install simple-ddl-parser
|
|
||||||
# pip3 install simple-ddl-parser
|
|
||||||
```
|
|
||||||
|
|
||||||
② 在 `sql/tools/` 目录下,执行如下命令打印生成 postgres 的脚本内容,其他可选参数有:`oracle`、`sqlserver`、`dm8`、`kingbase`、`opengauss`:
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
python3 convertor.py postgres
|
|
||||||
# python3 convertor.py postgres > tmp.sql
|
|
||||||
```
|
|
||||||
|
|
||||||
程序将 SQL 脚本打印到终端,可以重定向到临时文件 `tmp.sql`。
|
|
||||||
|
|
||||||
确认无误后,可以利用 IDEA 进行格式化。当然,也可以直接导入到数据库中。
|
|
||||||
@@ -1,844 +0,0 @@
|
|||||||
# encoding=utf8
|
|
||||||
"""芋道系统数据库迁移工具
|
|
||||||
|
|
||||||
Author: dhb52 (https://gitee.com/dhb52)
|
|
||||||
|
|
||||||
pip install simple-ddl-parser
|
|
||||||
"""
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import pathlib
|
|
||||||
import re
|
|
||||||
import time
|
|
||||||
from abc import ABC, abstractmethod
|
|
||||||
from typing import Dict, Generator, Optional, Tuple, Union
|
|
||||||
|
|
||||||
from simple_ddl_parser import DDLParser
|
|
||||||
|
|
||||||
PREAMBLE = """/*
|
|
||||||
Yudao Database Transfer Tool
|
|
||||||
|
|
||||||
Source Server Type : MySQL
|
|
||||||
|
|
||||||
Target Server Type : {db_type}
|
|
||||||
|
|
||||||
Date: {date}
|
|
||||||
*/
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def load_and_clean(sql_file: str) -> str:
|
|
||||||
"""加载源 SQL 文件,并清理内容方便下一步 ddl 解析
|
|
||||||
|
|
||||||
Args:
|
|
||||||
sql_file (str): sql文件路径
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: 清理后的sql文件内容
|
|
||||||
"""
|
|
||||||
REPLACE_PAIR_LIST = (
|
|
||||||
(" CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ", " "),
|
|
||||||
(" KEY `", " INDEX `"),
|
|
||||||
("UNIQUE INDEX", "UNIQUE KEY"),
|
|
||||||
("b'0'", "'0'"),
|
|
||||||
("b'1'", "'1'"),
|
|
||||||
)
|
|
||||||
|
|
||||||
content = open(sql_file).read()
|
|
||||||
for replace_pair in REPLACE_PAIR_LIST:
|
|
||||||
content = content.replace(*replace_pair)
|
|
||||||
content = re.sub(r"ENGINE.*COMMENT", "COMMENT", content)
|
|
||||||
content = re.sub(r"ENGINE.*;", ";", content)
|
|
||||||
return content
|
|
||||||
|
|
||||||
|
|
||||||
class Convertor(ABC):
|
|
||||||
def __init__(self, src: str, db_type) -> None:
|
|
||||||
self.src = src
|
|
||||||
self.db_type = db_type
|
|
||||||
self.content = load_and_clean(self.src)
|
|
||||||
self.table_script_list = re.findall(r"CREATE TABLE [^;]*;", self.content)
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def translate_type(self, type: str, size: Optional[Union[int, Tuple[int]]]) -> str:
|
|
||||||
"""字段类型转换
|
|
||||||
|
|
||||||
Args:
|
|
||||||
type (str): 字段类型
|
|
||||||
size (Optional[Union[int, Tuple[int]]]): 字段长度描述, 如varchar(255), decimal(10,2)
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: 类型定义
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def gen_create(self, table_ddl: Dict) -> str:
|
|
||||||
"""生成 create 脚本
|
|
||||||
|
|
||||||
Args:
|
|
||||||
table_ddl (Dict): 表DDL
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: 生成脚本
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def gen_pk(self, table_name: str) -> str:
|
|
||||||
"""生成主键定义
|
|
||||||
|
|
||||||
Args:
|
|
||||||
table_name (str): 表名
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: 生成脚本
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def gen_index(self, ddl: Dict) -> str:
|
|
||||||
"""生成索引定义
|
|
||||||
|
|
||||||
Args:
|
|
||||||
table_ddl (Dict): 表DDL
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: 生成脚本
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def gen_comment(self, table_sql: str, table_name: str) -> str:
|
|
||||||
"""生成字段/表注释
|
|
||||||
|
|
||||||
Args:
|
|
||||||
table_sql (str): 原始表SQL
|
|
||||||
table_name (str): 表名
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: 生成脚本
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def gen_insert(self, table_name: str) -> str:
|
|
||||||
"""生成 insert 语句块
|
|
||||||
|
|
||||||
Args:
|
|
||||||
table_name (str): 表名
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: 生成脚本
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def gen_dual(self) -> str:
|
|
||||||
"""生成虚拟 dual 表
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: 生成脚本, 默认返回空脚本, 表示当前数据库无需手工创建
|
|
||||||
"""
|
|
||||||
return ""
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def inserts(table_name: str, script_content: str) -> Generator:
|
|
||||||
PREFIX = f"INSERT INTO `{table_name}`"
|
|
||||||
|
|
||||||
# 收集 `table_name` 对应的 insert 语句
|
|
||||||
for line in script_content.split("\n"):
|
|
||||||
if line.startswith(PREFIX):
|
|
||||||
head, tail = line.replace(PREFIX, "").split(" VALUES ", maxsplit=1)
|
|
||||||
head = head.strip().replace("`", "").lower()
|
|
||||||
tail = tail.strip().replace(r"\"", '"')
|
|
||||||
# tail = tail.replace("b'0'", "'0'").replace("b'1'", "'1'")
|
|
||||||
yield f"INSERT INTO {table_name.lower()} {head} VALUES {tail}"
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def index(ddl: Dict) -> Generator:
|
|
||||||
"""生成索引定义
|
|
||||||
|
|
||||||
Args:
|
|
||||||
ddl (Dict): 表DDL
|
|
||||||
|
|
||||||
Yields:
|
|
||||||
Generator[str]: create index 语句
|
|
||||||
"""
|
|
||||||
|
|
||||||
def generate_columns(columns):
|
|
||||||
keys = [
|
|
||||||
f"{col['name'].lower()}{' ' + col['order'].lower() if col['order'] != 'ASC' else ''}"
|
|
||||||
for col in columns[0]
|
|
||||||
]
|
|
||||||
return ", ".join(keys)
|
|
||||||
|
|
||||||
for no, index in enumerate(ddl["index"], 1):
|
|
||||||
columns = generate_columns(index["columns"])
|
|
||||||
table_name = ddl["table_name"].lower()
|
|
||||||
yield f"CREATE INDEX idx_{table_name}_{no:02d} ON {table_name} ({columns})"
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def filed_comments(table_sql: str) -> Generator:
|
|
||||||
for line in table_sql.split("\n"):
|
|
||||||
match = re.match(r"^`([^`]+)`.* COMMENT '([^']+)'", line.strip())
|
|
||||||
if match:
|
|
||||||
field = match.group(1)
|
|
||||||
comment_string = match.group(2).replace("\\n", "\n")
|
|
||||||
yield field, comment_string
|
|
||||||
|
|
||||||
def table_comment(self, table_sql: str) -> str:
|
|
||||||
match = re.search(r"COMMENT \= '([^']+)';", table_sql)
|
|
||||||
return match.group(1) if match else None
|
|
||||||
|
|
||||||
def print(self):
|
|
||||||
"""打印转换后的sql脚本到终端"""
|
|
||||||
print(
|
|
||||||
PREAMBLE.format(
|
|
||||||
db_type=self.db_type,
|
|
||||||
date=time.strftime("%Y-%m-%d %H:%M:%S"),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
dual = self.gen_dual()
|
|
||||||
if dual:
|
|
||||||
print(
|
|
||||||
f"""-- ----------------------------
|
|
||||||
-- Table structure for dual
|
|
||||||
-- ----------------------------
|
|
||||||
{dual}
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
error_scripts = []
|
|
||||||
for table_sql in self.table_script_list:
|
|
||||||
ddl = DDLParser(table_sql.replace("`", "")).run()
|
|
||||||
|
|
||||||
# 如果parse失败, 需要跟进
|
|
||||||
if len(ddl) == 0:
|
|
||||||
error_scripts.append(table_sql)
|
|
||||||
continue
|
|
||||||
|
|
||||||
table_ddl = ddl[0]
|
|
||||||
table_name = table_ddl["table_name"]
|
|
||||||
|
|
||||||
# 忽略 quartz 的内容
|
|
||||||
if table_name.lower().startswith("qrtz"):
|
|
||||||
continue
|
|
||||||
|
|
||||||
# 为每个表生成个5个基本部分
|
|
||||||
create = self.gen_create(table_ddl)
|
|
||||||
pk = self.gen_pk(table_name)
|
|
||||||
index = self.gen_index(table_ddl)
|
|
||||||
comment = self.gen_comment(table_sql, table_name)
|
|
||||||
inserts = self.gen_insert(table_name)
|
|
||||||
|
|
||||||
# 组合当前表的DDL脚本
|
|
||||||
script = f"""{create}
|
|
||||||
|
|
||||||
{pk}
|
|
||||||
|
|
||||||
{index}
|
|
||||||
|
|
||||||
{comment}
|
|
||||||
|
|
||||||
{inserts}
|
|
||||||
"""
|
|
||||||
|
|
||||||
# 清理
|
|
||||||
script = re.sub("\n{3,}", "\n\n", script).strip() + "\n"
|
|
||||||
|
|
||||||
print(script)
|
|
||||||
|
|
||||||
# 将parse失败的脚本打印出来
|
|
||||||
if error_scripts:
|
|
||||||
for script in error_scripts:
|
|
||||||
print(script)
|
|
||||||
|
|
||||||
|
|
||||||
class PostgreSQLConvertor(Convertor):
|
|
||||||
def __init__(self, src):
|
|
||||||
super().__init__(src, "PostgreSQL")
|
|
||||||
|
|
||||||
def translate_type(self, type: str, size: Optional[Union[int, Tuple[int]]]):
|
|
||||||
"""类型转换"""
|
|
||||||
|
|
||||||
type = type.lower()
|
|
||||||
|
|
||||||
if type == "varchar":
|
|
||||||
return f"varchar({size})"
|
|
||||||
if type == "int":
|
|
||||||
return "int4"
|
|
||||||
if type == "bigint" or type == "bigint unsigned":
|
|
||||||
return "int8"
|
|
||||||
if type == "datetime":
|
|
||||||
return "timestamp"
|
|
||||||
if type == "bit":
|
|
||||||
return "bool"
|
|
||||||
if type in ("tinyint", "smallint"):
|
|
||||||
return "int2"
|
|
||||||
if type == "text":
|
|
||||||
return "text"
|
|
||||||
if type in ("blob", "mediumblob"):
|
|
||||||
return "bytea"
|
|
||||||
if type == "decimal":
|
|
||||||
return (
|
|
||||||
f"numeric({','.join(str(s) for s in size)})" if len(size) else "numeric"
|
|
||||||
)
|
|
||||||
|
|
||||||
def gen_create(self, ddl: Dict) -> str:
|
|
||||||
"""生成 create"""
|
|
||||||
|
|
||||||
def _generate_column(col):
|
|
||||||
name = col["name"].lower()
|
|
||||||
if name == "deleted":
|
|
||||||
return "deleted int2 NOT NULL DEFAULT 0"
|
|
||||||
|
|
||||||
type = col["type"].lower()
|
|
||||||
full_type = self.translate_type(type, col["size"])
|
|
||||||
nullable = "NULL" if col["nullable"] else "NOT NULL"
|
|
||||||
default = f"DEFAULT {col['default']}" if col["default"] is not None else ""
|
|
||||||
return f"{name} {full_type} {nullable} {default}"
|
|
||||||
|
|
||||||
table_name = ddl["table_name"].lower()
|
|
||||||
columns = [f"{_generate_column(col).strip()}" for col in ddl["columns"]]
|
|
||||||
filed_def_list = ",\n ".join(columns)
|
|
||||||
script = f"""-- ----------------------------
|
|
||||||
-- Table structure for {table_name}
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS {table_name};
|
|
||||||
CREATE TABLE {table_name} (
|
|
||||||
{filed_def_list}
|
|
||||||
);"""
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_index(self, ddl: Dict) -> str:
|
|
||||||
return "\n".join(f"{script};" for script in self.index(ddl))
|
|
||||||
|
|
||||||
def gen_comment(self, table_sql: str, table_name: str) -> str:
|
|
||||||
"""生成字段及表的注释"""
|
|
||||||
|
|
||||||
script = ""
|
|
||||||
for field, comment_string in self.filed_comments(table_sql):
|
|
||||||
script += (
|
|
||||||
f"COMMENT ON COLUMN {table_name}.{field} IS '{comment_string}';" + "\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
table_comment = self.table_comment(table_sql)
|
|
||||||
if table_comment:
|
|
||||||
script += f"COMMENT ON TABLE {table_name} IS '{table_comment}';\n"
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_pk(self, table_name) -> str:
|
|
||||||
"""生成主键定义"""
|
|
||||||
return f"ALTER TABLE {table_name} ADD CONSTRAINT pk_{table_name} PRIMARY KEY (id);\n"
|
|
||||||
|
|
||||||
def gen_insert(self, table_name: str) -> str:
|
|
||||||
"""生成 insert 语句,以及根据最后的 insert id+1 生成 Sequence"""
|
|
||||||
|
|
||||||
inserts = list(Convertor.inserts(table_name, self.content))
|
|
||||||
## 生成 insert 脚本
|
|
||||||
script = ""
|
|
||||||
last_id = 0
|
|
||||||
if inserts:
|
|
||||||
inserts_lines = "\n".join(inserts)
|
|
||||||
script += f"""\n\n-- ----------------------------
|
|
||||||
-- Records of {table_name.lower()}
|
|
||||||
-- ----------------------------
|
|
||||||
-- @formatter:off
|
|
||||||
BEGIN;
|
|
||||||
{inserts_lines}
|
|
||||||
COMMIT;
|
|
||||||
-- @formatter:on"""
|
|
||||||
match = re.search(r"VALUES \((\d+),", inserts[-1])
|
|
||||||
if match:
|
|
||||||
last_id = int(match.group(1))
|
|
||||||
|
|
||||||
# 生成 Sequence
|
|
||||||
script += (
|
|
||||||
"\n\n"
|
|
||||||
+ f"""DROP SEQUENCE IF EXISTS {table_name}_seq;
|
|
||||||
CREATE SEQUENCE {table_name}_seq
|
|
||||||
START {last_id + 1};"""
|
|
||||||
)
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_dual(self) -> str:
|
|
||||||
return """DROP TABLE IF EXISTS dual;
|
|
||||||
CREATE TABLE dual
|
|
||||||
(
|
|
||||||
id int2
|
|
||||||
);
|
|
||||||
|
|
||||||
COMMENT ON TABLE dual IS '数据库连接的表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of dual
|
|
||||||
-- ----------------------------
|
|
||||||
-- @formatter:off
|
|
||||||
INSERT INTO dual VALUES (1);
|
|
||||||
-- @formatter:on"""
|
|
||||||
|
|
||||||
|
|
||||||
class OracleConvertor(Convertor):
|
|
||||||
def __init__(self, src):
|
|
||||||
super().__init__(src, "Oracle")
|
|
||||||
|
|
||||||
def translate_type(self, type: str, size: Optional[Union[int, Tuple[int]]]):
|
|
||||||
"""类型转换"""
|
|
||||||
type = type.lower()
|
|
||||||
|
|
||||||
if type == "varchar":
|
|
||||||
return f"varchar2({size if size < 4000 else 4000})"
|
|
||||||
if type == "int":
|
|
||||||
return "number"
|
|
||||||
if type == "bigint" or type == "bigint unsigned":
|
|
||||||
return "number"
|
|
||||||
if type == "datetime":
|
|
||||||
return "date"
|
|
||||||
if type == "bit":
|
|
||||||
return "number(1,0)"
|
|
||||||
if type in ("tinyint", "smallint"):
|
|
||||||
return "smallint"
|
|
||||||
if type == "text":
|
|
||||||
return "clob"
|
|
||||||
if type in ("blob", "mediumblob"):
|
|
||||||
return "blob"
|
|
||||||
if type == "decimal":
|
|
||||||
return (
|
|
||||||
f"number({','.join(str(s) for s in size)})" if len(size) else "number"
|
|
||||||
)
|
|
||||||
|
|
||||||
def gen_create(self, ddl) -> str:
|
|
||||||
"""生成 CREATE 语句"""
|
|
||||||
|
|
||||||
def generate_column(col):
|
|
||||||
name = col["name"].lower()
|
|
||||||
if name == "deleted":
|
|
||||||
return "deleted number(1,0) DEFAULT 0 NOT NULL"
|
|
||||||
|
|
||||||
type = col["type"].lower()
|
|
||||||
full_type = self.translate_type(type, col["size"])
|
|
||||||
nullable = "NULL" if col["nullable"] else "NOT NULL"
|
|
||||||
default = f"DEFAULT {col['default']}" if col["default"] is not None else ""
|
|
||||||
# Oracle 中 size 不能作为字段名
|
|
||||||
field_name = '"size"' if name == "size" else name
|
|
||||||
# Oracle DEFAULT 定义在 NULLABLE 之前
|
|
||||||
return f"{field_name} {full_type} {default} {nullable}"
|
|
||||||
|
|
||||||
table_name = ddl["table_name"].lower()
|
|
||||||
columns = [f"{generate_column(col).strip()}" for col in ddl["columns"]]
|
|
||||||
field_def_list = ",\n ".join(columns)
|
|
||||||
script = f"""-- ----------------------------
|
|
||||||
-- Table structure for {table_name}
|
|
||||||
-- ----------------------------
|
|
||||||
CREATE TABLE {table_name} (
|
|
||||||
{field_def_list}
|
|
||||||
);"""
|
|
||||||
|
|
||||||
# oracle INSERT '' 不能通过 NOT NULL 校验
|
|
||||||
script = script.replace("DEFAULT '' NOT NULL", "DEFAULT '' NULL")
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_index(self, ddl: Dict) -> str:
|
|
||||||
return "\n".join(f"{script};" for script in self.index(ddl))
|
|
||||||
|
|
||||||
def gen_comment(self, table_sql: str, table_name: str) -> str:
|
|
||||||
script = ""
|
|
||||||
for field, comment_string in self.filed_comments(table_sql):
|
|
||||||
script += (
|
|
||||||
f"COMMENT ON COLUMN {table_name}.{field} IS '{comment_string}';" + "\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
table_comment = self.table_comment(table_sql)
|
|
||||||
if table_comment:
|
|
||||||
script += f"COMMENT ON TABLE {table_name} IS '{table_comment}';\n"
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_pk(self, table_name: str) -> str:
|
|
||||||
"""生成主键定义"""
|
|
||||||
return f"ALTER TABLE {table_name} ADD CONSTRAINT pk_{table_name} PRIMARY KEY (id);\n"
|
|
||||||
|
|
||||||
def gen_index(self, ddl: Dict) -> str:
|
|
||||||
return "\n".join(f"{script};" for script in self.index(ddl))
|
|
||||||
|
|
||||||
def gen_insert(self, table_name: str) -> str:
|
|
||||||
"""拷贝 INSERT 语句"""
|
|
||||||
inserts = []
|
|
||||||
for insert_script in Convertor.inserts(table_name, self.content):
|
|
||||||
# 对日期数据添加 TO_DATE 转换
|
|
||||||
insert_script = re.sub(
|
|
||||||
r"('\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}')",
|
|
||||||
r"to_date(\g<1>, 'SYYYY-MM-DD HH24:MI:SS')",
|
|
||||||
insert_script,
|
|
||||||
)
|
|
||||||
inserts.append(insert_script)
|
|
||||||
|
|
||||||
## 生成 insert 脚本
|
|
||||||
script = ""
|
|
||||||
last_id = 0
|
|
||||||
if inserts:
|
|
||||||
inserts_lines = "\n".join(inserts)
|
|
||||||
script += f"""\n\n-- ----------------------------
|
|
||||||
-- Records of {table_name.lower()}
|
|
||||||
-- ----------------------------
|
|
||||||
-- @formatter:off
|
|
||||||
{inserts_lines}
|
|
||||||
COMMIT;
|
|
||||||
-- @formatter:on"""
|
|
||||||
match = re.search(r"VALUES \((\d+),", inserts[-1])
|
|
||||||
if match:
|
|
||||||
last_id = int(match.group(1))
|
|
||||||
|
|
||||||
# 生成 Sequence
|
|
||||||
script += f"""
|
|
||||||
|
|
||||||
CREATE SEQUENCE {table_name}_seq
|
|
||||||
START WITH {last_id + 1};"""
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
|
|
||||||
class SQLServerConvertor(Convertor):
|
|
||||||
"""_summary_
|
|
||||||
|
|
||||||
Args:
|
|
||||||
Convertor (_type_): _description_
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, src):
|
|
||||||
super().__init__(src, "Microsoft SQL Server")
|
|
||||||
|
|
||||||
def translate_type(self, type: str, size: Optional[Union[int, Tuple[int]]]):
|
|
||||||
"""类型转换"""
|
|
||||||
|
|
||||||
type = type.lower()
|
|
||||||
|
|
||||||
if type == "varchar":
|
|
||||||
return f"nvarchar({size if size < 4000 else 4000})"
|
|
||||||
if type == "int":
|
|
||||||
return "int"
|
|
||||||
if type == "bigint" or type == "bigint unsigned":
|
|
||||||
return "bigint"
|
|
||||||
if type == "datetime":
|
|
||||||
return "datetime2"
|
|
||||||
if type == "bit":
|
|
||||||
return "varchar(1)"
|
|
||||||
if type in ("tinyint", "smallint"):
|
|
||||||
return "tinyint"
|
|
||||||
if type == "text":
|
|
||||||
return "nvarchar(max)"
|
|
||||||
if type in ("blob", "mediumblob"):
|
|
||||||
return "varbinary(max)"
|
|
||||||
if type == "decimal":
|
|
||||||
return (
|
|
||||||
f"numeric({','.join(str(s) for s in size)})" if len(size) else "numeric"
|
|
||||||
)
|
|
||||||
|
|
||||||
def gen_create(self, ddl: Dict) -> str:
|
|
||||||
"""生成 create"""
|
|
||||||
|
|
||||||
def _generate_column(col):
|
|
||||||
name = col["name"].lower()
|
|
||||||
if name == "id":
|
|
||||||
return "id bigint NOT NULL PRIMARY KEY IDENTITY"
|
|
||||||
if name == "deleted":
|
|
||||||
return "deleted bit DEFAULT 0 NOT NULL"
|
|
||||||
|
|
||||||
type = col["type"].lower()
|
|
||||||
full_type = self.translate_type(type, col["size"])
|
|
||||||
nullable = "NULL" if col["nullable"] else "NOT NULL"
|
|
||||||
default = f"DEFAULT {col['default']}" if col["default"] is not None else ""
|
|
||||||
return f"{name} {full_type} {default} {nullable}"
|
|
||||||
|
|
||||||
table_name = ddl["table_name"].lower()
|
|
||||||
columns = [f"{_generate_column(col).strip()}" for col in ddl["columns"]]
|
|
||||||
filed_def_list = ",\n ".join(columns)
|
|
||||||
script = f"""-- ----------------------------
|
|
||||||
-- Table structure for {table_name}
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS {table_name}
|
|
||||||
GO
|
|
||||||
CREATE TABLE {table_name} (
|
|
||||||
{filed_def_list}
|
|
||||||
)
|
|
||||||
GO"""
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_comment(self, table_sql: str, table_name: str) -> str:
|
|
||||||
"""生成字段及表的注释"""
|
|
||||||
|
|
||||||
script = ""
|
|
||||||
|
|
||||||
for field, comment_string in self.filed_comments(table_sql):
|
|
||||||
script += f"""EXEC sp_addextendedproperty
|
|
||||||
'MS_Description', N'{comment_string}',
|
|
||||||
'SCHEMA', N'dbo',
|
|
||||||
'TABLE', N'{table_name}',
|
|
||||||
'COLUMN', N'{field}'
|
|
||||||
GO
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
table_comment = self.table_comment(table_sql)
|
|
||||||
if table_comment:
|
|
||||||
script += f"""EXEC sp_addextendedproperty
|
|
||||||
'MS_Description', N'{table_comment}',
|
|
||||||
'SCHEMA', N'dbo',
|
|
||||||
'TABLE', N'{table_name}'
|
|
||||||
GO
|
|
||||||
|
|
||||||
"""
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_pk(self, table_name: str) -> str:
|
|
||||||
"""生成主键定义"""
|
|
||||||
return ""
|
|
||||||
|
|
||||||
def gen_index(self, ddl: Dict) -> str:
|
|
||||||
"""生成 index"""
|
|
||||||
return "\n".join(f"{script}\nGO" for script in self.index(ddl))
|
|
||||||
|
|
||||||
def gen_insert(self, table_name: str) -> str:
|
|
||||||
"""生成 insert 语句"""
|
|
||||||
|
|
||||||
# 收集 `table_name` 对应的 insert 语句
|
|
||||||
inserts = []
|
|
||||||
for insert_script in Convertor.inserts(table_name, self.content):
|
|
||||||
# SQLServer: 字符串前加N,hack,是否存在替换字符串内容的风险
|
|
||||||
insert_script = insert_script.replace(", '", ", N'").replace(
|
|
||||||
"VALUES ('", "VALUES (N')"
|
|
||||||
)
|
|
||||||
# 删除 insert 的结尾分号
|
|
||||||
insert_script = re.sub(";$", r"\nGO", insert_script)
|
|
||||||
inserts.append(insert_script)
|
|
||||||
|
|
||||||
## 生成 insert 脚本
|
|
||||||
script = ""
|
|
||||||
if inserts:
|
|
||||||
inserts_lines = "\n".join(inserts)
|
|
||||||
script += f"""\n\n-- ----------------------------
|
|
||||||
-- Records of {table_name.lower()}
|
|
||||||
-- ----------------------------
|
|
||||||
-- @formatter:off
|
|
||||||
BEGIN TRANSACTION
|
|
||||||
GO
|
|
||||||
SET IDENTITY_INSERT {table_name.lower()} ON
|
|
||||||
GO
|
|
||||||
{inserts_lines}
|
|
||||||
SET IDENTITY_INSERT {table_name.lower()} OFF
|
|
||||||
GO
|
|
||||||
COMMIT
|
|
||||||
GO
|
|
||||||
-- @formatter:on"""
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_dual(self) -> str:
|
|
||||||
return """DROP TABLE IF EXISTS dual
|
|
||||||
GO
|
|
||||||
CREATE TABLE dual
|
|
||||||
(
|
|
||||||
id int
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
EXEC sp_addextendedproperty
|
|
||||||
'MS_Description', N'数据库连接的表',
|
|
||||||
'SCHEMA', N'dbo',
|
|
||||||
'TABLE', N'dual'
|
|
||||||
GO
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of dual
|
|
||||||
-- ----------------------------
|
|
||||||
-- @formatter:off
|
|
||||||
INSERT INTO dual VALUES (1)
|
|
||||||
GO
|
|
||||||
-- @formatter:on"""
|
|
||||||
|
|
||||||
|
|
||||||
class DM8Convertor(Convertor):
|
|
||||||
def __init__(self, src):
|
|
||||||
super().__init__(src, "DM8")
|
|
||||||
|
|
||||||
def translate_type(self, type: str, size: Optional[Union[int, Tuple[int]]]):
|
|
||||||
"""类型转换"""
|
|
||||||
type = type.lower()
|
|
||||||
|
|
||||||
if type == "varchar":
|
|
||||||
return f"varchar({size})"
|
|
||||||
if type == "int":
|
|
||||||
return "int"
|
|
||||||
if type == "bigint" or type == "bigint unsigned":
|
|
||||||
return "bigint"
|
|
||||||
if type == "datetime":
|
|
||||||
return "datetime"
|
|
||||||
if type == "bit":
|
|
||||||
return "bit"
|
|
||||||
if type in ("tinyint", "smallint"):
|
|
||||||
return "smallint"
|
|
||||||
if type == "text":
|
|
||||||
return "text"
|
|
||||||
if type == "blob":
|
|
||||||
return "blob"
|
|
||||||
if type == "mediumblob":
|
|
||||||
return "varchar(10240)"
|
|
||||||
if type == "decimal":
|
|
||||||
return (
|
|
||||||
f"decimal({','.join(str(s) for s in size)})" if len(size) else "decimal"
|
|
||||||
)
|
|
||||||
|
|
||||||
def gen_create(self, ddl) -> str:
|
|
||||||
"""生成 CREATE 语句"""
|
|
||||||
|
|
||||||
def generate_column(col):
|
|
||||||
name = col["name"].lower()
|
|
||||||
if name == "id":
|
|
||||||
return "id bigint NOT NULL PRIMARY KEY IDENTITY"
|
|
||||||
|
|
||||||
type = col["type"].lower()
|
|
||||||
full_type = self.translate_type(type, col["size"])
|
|
||||||
nullable = "NULL" if col["nullable"] else "NOT NULL"
|
|
||||||
default = f"DEFAULT {col['default']}" if col["default"] is not None else ""
|
|
||||||
return f"{name} {full_type} {default} {nullable}"
|
|
||||||
|
|
||||||
table_name = ddl["table_name"].lower()
|
|
||||||
columns = [f"{generate_column(col).strip()}" for col in ddl["columns"]]
|
|
||||||
field_def_list = ",\n ".join(columns)
|
|
||||||
script = f"""-- ----------------------------
|
|
||||||
-- Table structure for {table_name}
|
|
||||||
-- ----------------------------
|
|
||||||
CREATE TABLE {table_name} (
|
|
||||||
{field_def_list}
|
|
||||||
);"""
|
|
||||||
|
|
||||||
# oracle INSERT '' 不能通过 NOT NULL 校验
|
|
||||||
script = script.replace("DEFAULT '' NOT NULL", "DEFAULT '' NULL")
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_index(self, ddl: Dict) -> str:
|
|
||||||
return "\n".join(f"{script};" for script in self.index(ddl))
|
|
||||||
|
|
||||||
def gen_comment(self, table_sql: str, table_name: str) -> str:
|
|
||||||
script = ""
|
|
||||||
for field, comment_string in self.filed_comments(table_sql):
|
|
||||||
script += (
|
|
||||||
f"COMMENT ON COLUMN {table_name}.{field} IS '{comment_string}';" + "\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
table_comment = self.table_comment(table_sql)
|
|
||||||
if table_comment:
|
|
||||||
script += f"COMMENT ON TABLE {table_name} IS '{table_comment}';\n"
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_pk(self, table_name: str) -> str:
|
|
||||||
"""生成主键定义"""
|
|
||||||
return ""
|
|
||||||
|
|
||||||
def gen_index(self, ddl: Dict) -> str:
|
|
||||||
return "\n".join(f"{script};" for script in self.index(ddl))
|
|
||||||
|
|
||||||
def gen_insert(self, table_name: str) -> str:
|
|
||||||
"""拷贝 INSERT 语句"""
|
|
||||||
inserts = list(Convertor.inserts(table_name, self.content))
|
|
||||||
|
|
||||||
## 生成 insert 脚本
|
|
||||||
script = ""
|
|
||||||
if inserts:
|
|
||||||
inserts_lines = "\n".join(inserts)
|
|
||||||
script += f"""\n\n-- ----------------------------
|
|
||||||
-- Records of {table_name.lower()}
|
|
||||||
-- ----------------------------
|
|
||||||
-- @formatter:off
|
|
||||||
SET IDENTITY_INSERT {table_name.lower()} ON;
|
|
||||||
{inserts_lines}
|
|
||||||
COMMIT;
|
|
||||||
SET IDENTITY_INSERT {table_name.lower()} OFF;
|
|
||||||
-- @formatter:on"""
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
|
|
||||||
class KingbaseConvertor(PostgreSQLConvertor):
|
|
||||||
def __init__(self, src):
|
|
||||||
super().__init__(src)
|
|
||||||
self.db_type = "Kingbase"
|
|
||||||
|
|
||||||
def gen_create(self, ddl: Dict) -> str:
|
|
||||||
"""生成 create"""
|
|
||||||
|
|
||||||
def _generate_column(col):
|
|
||||||
name = col["name"].lower()
|
|
||||||
if name == "deleted":
|
|
||||||
return "deleted int2 NOT NULL DEFAULT 0"
|
|
||||||
|
|
||||||
type = col["type"].lower()
|
|
||||||
full_type = self.translate_type(type, col["size"])
|
|
||||||
nullable = "NULL" if col["nullable"] else "NOT NULL"
|
|
||||||
default = f"DEFAULT {col['default']}" if col["default"] is not None else ""
|
|
||||||
return f"{name} {full_type} {nullable} {default}"
|
|
||||||
|
|
||||||
table_name = ddl["table_name"].lower()
|
|
||||||
columns = [f"{_generate_column(col).strip()}" for col in ddl["columns"]]
|
|
||||||
filed_def_list = ",\n ".join(columns)
|
|
||||||
script = f"""-- ----------------------------
|
|
||||||
-- Table structure for {table_name}
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS {table_name};
|
|
||||||
CREATE TABLE {table_name} (
|
|
||||||
{filed_def_list}
|
|
||||||
);"""
|
|
||||||
|
|
||||||
# Kingbase INSERT '' 不能通过 NOT NULL 校验
|
|
||||||
script = script.replace("NOT NULL DEFAULT ''", "NULL DEFAULT ''")
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
|
|
||||||
class OpengaussConvertor(KingbaseConvertor):
|
|
||||||
def __init__(self, src):
|
|
||||||
super().__init__(src)
|
|
||||||
self.db_type = "OpenGauss"
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
parser = argparse.ArgumentParser(description="芋道系统数据库转换工具")
|
|
||||||
parser.add_argument(
|
|
||||||
"type",
|
|
||||||
type=str,
|
|
||||||
help="目标数据库类型",
|
|
||||||
choices=["postgres", "oracle", "sqlserver", "dm8", "kingbase", "opengauss"],
|
|
||||||
)
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
sql_file = pathlib.Path("../mysql/ruoyi-vue-pro.sql").resolve().as_posix()
|
|
||||||
convertor = None
|
|
||||||
if args.type == "postgres":
|
|
||||||
convertor = PostgreSQLConvertor(sql_file)
|
|
||||||
elif args.type == "oracle":
|
|
||||||
convertor = OracleConvertor(sql_file)
|
|
||||||
elif args.type == "sqlserver":
|
|
||||||
convertor = SQLServerConvertor(sql_file)
|
|
||||||
elif args.type == "dm8":
|
|
||||||
convertor = DM8Convertor(sql_file)
|
|
||||||
elif args.type == "kingbase":
|
|
||||||
convertor = KingbaseConvertor(sql_file)
|
|
||||||
elif args.type == "opengauss":
|
|
||||||
convertor = OpengaussConvertor(sql_file)
|
|
||||||
else:
|
|
||||||
raise NotImplementedError(f"不支持目标数据库类型: {args.type}")
|
|
||||||
|
|
||||||
convertor.print()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
name: ruoyi-vue-pro
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
mysql: { }
|
|
||||||
postgres: { }
|
|
||||||
sqlserver: { }
|
|
||||||
dm8: { }
|
|
||||||
kingbase: { }
|
|
||||||
opengauss: { }
|
|
||||||
|
|
||||||
services:
|
|
||||||
mysql:
|
|
||||||
image: mysql:8.0.33
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
TZ: Asia/Shanghai
|
|
||||||
MYSQL_ROOT_PASSWORD: 123456
|
|
||||||
MYSQL_DATABASE: ruoyi-vue-pro
|
|
||||||
ports:
|
|
||||||
- "3306:3306"
|
|
||||||
volumes:
|
|
||||||
- mysql:/var/lib/mysql/
|
|
||||||
# 注入初始化脚本
|
|
||||||
- ./mysql/ruoyi-vue-pro.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
|
||||||
command:
|
|
||||||
--default-authentication-plugin=mysql_native_password
|
|
||||||
--character-set-server=utf8mb4
|
|
||||||
--collation-server=utf8mb4_general_ci
|
|
||||||
--explicit_defaults_for_timestamp=true
|
|
||||||
--lower_case_table_names=1
|
|
||||||
|
|
||||||
postgres:
|
|
||||||
image: postgres:14.2
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
POSTGRES_USER: root
|
|
||||||
POSTGRES_PASSWORD: 123456
|
|
||||||
POSTGRES_DB: ruoyi-vue-pro
|
|
||||||
ports:
|
|
||||||
- "5432:5432"
|
|
||||||
volumes:
|
|
||||||
- postgres:/var/lib/postgresql/data
|
|
||||||
# 注入初始化脚本
|
|
||||||
- ../postgresql/quartz.sql:/docker-entrypoint-initdb.d/quartz.sql:ro
|
|
||||||
- ../postgresql/ruoyi-vue-pro.sql:/docker-entrypoint-initdb.d/ruoyi-vue-pro.sql:ro
|
|
||||||
|
|
||||||
oracle:
|
|
||||||
image: gvenzl/oracle-xe:18-slim-faststart
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
## 登录信息 SID: XE user: system password: oracle
|
|
||||||
ORACLE_PASSWORD: oracle
|
|
||||||
ports:
|
|
||||||
- "1521:1521"
|
|
||||||
volumes:
|
|
||||||
- ../oracle/ruoyi-vue-pro.sql:/tmp/schema.sql:ro
|
|
||||||
# 创建app用户: ROOT/123456@//localhost/XEPDB1
|
|
||||||
- ./oracle/1_create_user.sql:/docker-entrypoint-initdb.d/1_create_user.sql:ro
|
|
||||||
- ./oracle/2_create_schema.sh:/docker-entrypoint-initdb.d/2_create_schema.sh:ro
|
|
||||||
|
|
||||||
oracle_m1:
|
|
||||||
image: einslib/oracle-19c:19.3.0-ee-slim-faststart
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
## 登录信息 SID: FREE user: system password: oracle
|
|
||||||
ORACLE_PASSWORD: oracle
|
|
||||||
ports:
|
|
||||||
- "1521:1521"
|
|
||||||
volumes:
|
|
||||||
- ../oracle/ruoyi-vue-pro.sql:/tmp/schema.sql:ro
|
|
||||||
# 创建app用户: ROOT/123456@//localhost/XEPDB1
|
|
||||||
- ./oracle/1_create_user.sql:/docker-entrypoint-initdb.d/1_create_user.sql:ro
|
|
||||||
- ./oracle/2_create_schema.sh:/docker-entrypoint-initdb.d/2_create_schema.sh:ro
|
|
||||||
|
|
||||||
sqlserver:
|
|
||||||
image: mcr.microsoft.com/mssql/server:2017-latest
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
TZ: Asia/Shanghai
|
|
||||||
ACCEPT_EULA: "Y"
|
|
||||||
SA_PASSWORD: "Yudao@2024"
|
|
||||||
ports:
|
|
||||||
- "1433:1433"
|
|
||||||
volumes:
|
|
||||||
- sqlserver:/var/opt/mssql
|
|
||||||
- ../sqlserver/ruoyi-vue-pro.sql:/tmp/schema.sql:ro
|
|
||||||
# docker compose exec sqlserver bash /tmp/create_schema.sh
|
|
||||||
- ./sqlserver/create_schema.sh:/tmp/create_schema.sh:ro
|
|
||||||
|
|
||||||
dm8:
|
|
||||||
# docker load -i dm8_20240715_x86_rh6_rq_single.tar
|
|
||||||
image: dm8_single:dm8_20240715_rev232765_x86_rh6_64
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
PAGE_SIZE: 16
|
|
||||||
LD_LIBRARY_PATH: /opt/dmdbms/bin
|
|
||||||
EXTENT_SIZE: 32
|
|
||||||
BLANK_PAD_MODE: 1
|
|
||||||
LOG_SIZE: 1024
|
|
||||||
UNICODE_FLAG: 1
|
|
||||||
LENGTH_IN_CHAR: 1
|
|
||||||
INSTANCE_NAME: dm8_test
|
|
||||||
ports:
|
|
||||||
- "5236:5236"
|
|
||||||
volumes:
|
|
||||||
- dm8:/opt/dmdbms/data
|
|
||||||
- ../dm/ruoyi-vue-pro-dm8.sql:/tmp/schema.sql:ro
|
|
||||||
|
|
||||||
kingbase:
|
|
||||||
image: kingbase_v009r001c001b0025_single_x86:v1
|
|
||||||
# image: kingbase_v009r001c001b0025_single_arm:v1
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
DB_USER: root
|
|
||||||
DB_PASSWORD: 123456
|
|
||||||
ports:
|
|
||||||
- "54321:54321"
|
|
||||||
volumes:
|
|
||||||
- kingbase:/home/kingbase/userdata
|
|
||||||
- ../kingbase/ruoyi-vue-pro.sql:/tmp/schema.sql:ro
|
|
||||||
|
|
||||||
opengauss:
|
|
||||||
image: opengauss/opengauss:5.0.0
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
GS_USERNAME: root
|
|
||||||
GS_PASSWORD: Yudao@2024
|
|
||||||
LD_LIBRARY_PATH: /usr/local/opengauss/lib:/usr/lib
|
|
||||||
ports:
|
|
||||||
- "5432:5432"
|
|
||||||
volumes:
|
|
||||||
- opengauss:/var/lib/opengauss
|
|
||||||
- ../opengauss/ruoyi-vue-pro.sql:/tmp/schema.sql:ro
|
|
||||||
# docker compose exec opengauss bash -c '/usr/local/opengauss/bin/gsql -U $GS_USERNAME -W $GS_PASSWORD -d postgres -f /tmp/schema.sql'
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
ALTER SESSION SET CONTAINER=XEPDB1;
|
|
||||||
CREATE USER ROOT IDENTIFIED BY 123456 QUOTA UNLIMITED ON USERS;
|
|
||||||
GRANT CONNECT, RESOURCE TO ROOT;
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
sqlplus -s ROOT/123456@//localhost/XEPDB1 @/tmp/schema.sql
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P ${SA_PASSWORD} -Q "CREATE DATABASE [ruoyi-vue-pro];
|
|
||||||
GO"
|
|
||||||
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P ${SA_PASSWORD} -d 'ruoyi-vue-pro' -i /tmp/schema.sql
|
|
||||||
@@ -34,6 +34,8 @@
|
|||||||
<rocketmq-spring.version>2.3.1</rocketmq-spring.version>
|
<rocketmq-spring.version>2.3.1</rocketmq-spring.version>
|
||||||
<!-- RPC 相关 -->
|
<!-- RPC 相关 -->
|
||||||
<!-- Config 配置中心相关 -->
|
<!-- Config 配置中心相关 -->
|
||||||
|
<springdoc.version>2.7.0</springdoc.version>
|
||||||
|
<knife4j.version>4.6.0</knife4j.version>
|
||||||
<!-- Job 定时任务相关 -->
|
<!-- Job 定时任务相关 -->
|
||||||
<xxl-job.version>2.4.0</xxl-job.version>
|
<xxl-job.version>2.4.0</xxl-job.version>
|
||||||
<!-- 服务保障相关 -->
|
<!-- 服务保障相关 -->
|
||||||
@@ -150,6 +152,11 @@
|
|||||||
<artifactId>tashow-data-permission</artifactId>
|
<artifactId>tashow-data-permission</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-sdk-file</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tashow.cloud</groupId>
|
<groupId>com.tashow.cloud</groupId>
|
||||||
@@ -186,6 +193,11 @@
|
|||||||
<artifactId>tashow-sdk-payment</artifactId>
|
<artifactId>tashow-sdk-payment</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-product-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Spring 核心 -->
|
<!-- Spring 核心 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -433,6 +445,22 @@
|
|||||||
<version>${spring-boot-admin.version}</version>
|
<version>${spring-boot-admin.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xingfudeshi</groupId> <!-- TODO 芋艿:https://github.com/xiaoymin/knife4j/issues/874 -->
|
||||||
|
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||||
|
<version>${knife4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
|
||||||
|
<version>${springdoc.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId> <!-- 接口文档 UI:knife4j【网关专属】 -->
|
||||||
|
<artifactId>knife4j-gateway-spring-boot-starter</artifactId>
|
||||||
|
<version>4.5.0</version> <!-- TODO 芋艿:等 4.5.0 => 4.6.0 -->
|
||||||
|
</dependency>
|
||||||
<!-- Test 测试相关 -->
|
<!-- Test 测试相关 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
|
|||||||
@@ -9,8 +9,10 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RPC 服务 - 文件
|
||||||
|
*/
|
||||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
/** RPC 服务 - 文件 */
|
|
||||||
public interface FileApi {
|
public interface FileApi {
|
||||||
|
|
||||||
String PREFIX = ApiConstants.PREFIX + "/file";
|
String PREFIX = ApiConstants.PREFIX + "/file";
|
||||||
@@ -52,7 +54,9 @@ public interface FileApi {
|
|||||||
.getCheckedData();
|
.getCheckedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存文件,并返回文件的访问路径
|
||||||
|
*/
|
||||||
@PostMapping(PREFIX + "/create")
|
@PostMapping(PREFIX + "/create")
|
||||||
/** 保存文件,并返回文件的访问路径 */
|
|
||||||
CommonResult<String> createFile(@Valid @RequestBody FileCreateReqDTO createReqDTO);
|
CommonResult<String> createFile(@Valid @RequestBody FileCreateReqDTO createReqDTO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,11 @@
|
|||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.validation</groupId>
|
||||||
|
<artifactId>jakarta.validation-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- RPC 远程调用相关 -->
|
<!-- RPC 远程调用相关 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.ProdDO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prod.ProdListVO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prod.ProdPageReqVO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prod.ProdServiceVO;
|
||||||
|
import com.tashow.cloud.productapi.enums.ApiConstants;
|
||||||
|
import jakarta.annotation.security.PermitAll;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
|
/** RPC 服务 - 参数配置 */
|
||||||
|
public interface ProdApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/prod";
|
||||||
|
/**
|
||||||
|
* 获取商品详情
|
||||||
|
*
|
||||||
|
* @param id 商品id
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping(PREFIX + "/getProdInfo")
|
||||||
|
@PermitAll
|
||||||
|
CommonResult<ProdDO> getProdInfo(@RequestParam(value = "id", required = false) Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品服务配置
|
||||||
|
*
|
||||||
|
* @param id 商品id
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
@GetMapping(PREFIX + "/getProdService")
|
||||||
|
ProdServiceVO getProdService(@RequestParam(value = "id", required = false) Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得商品分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 商品分页
|
||||||
|
*/
|
||||||
|
@GetMapping(PREFIX + "/getProdPage")
|
||||||
|
PageResult<ProdListVO> getProdPage(ProdPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扣减库存
|
||||||
|
* @param skuId 单品ID
|
||||||
|
* @param stocksNum 扣减数量
|
||||||
|
*/
|
||||||
|
@GetMapping(PREFIX + "/reduceStocks")
|
||||||
|
CommonResult<Boolean> reduceStocks(Long skuId, Integer stocksNum) ;
|
||||||
|
/**
|
||||||
|
* 增加库存
|
||||||
|
* @param skuId 单品ID
|
||||||
|
* @param stocksNum 增加数量
|
||||||
|
*/
|
||||||
|
@GetMapping(PREFIX + "/increaseStocks")
|
||||||
|
CommonResult<Boolean> increaseStocks(Long skuId, Integer stocksNum);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product;
|
||||||
|
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.CategoryDO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.ShopDetailDO;
|
||||||
|
import com.tashow.cloud.productapi.enums.ApiConstants;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
|
/** RPC 服务 - 参数配置 */
|
||||||
|
public interface ShopDetailApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/shop";
|
||||||
|
|
||||||
|
@GetMapping(PREFIX + "/getShopInfo")
|
||||||
|
ShopDetailDO getShopInfo(@RequestParam(value = "id", required = false) Long id);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,7 +12,6 @@ import java.util.List;
|
|||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
|
||||||
public class CategoryDto {
|
public class CategoryDto {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -43,16 +43,22 @@ public class ProdAdditionalFeeDatesDO extends BaseDO {
|
|||||||
* 日期类型0:'自定义日期范围':1:'指定日期':2:'法定节假日',3:'固定休息日'
|
* 日期类型0:'自定义日期范围':1:'指定日期':2:'法定节假日',3:'固定休息日'
|
||||||
*/
|
*/
|
||||||
private Integer dateType;
|
private Integer dateType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义日期时间段
|
* 类型:1:特殊日期 2:可预约时段黑名单日期 3:紧急相应服务黑名单日期
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期
|
||||||
*/
|
*/
|
||||||
@TableField(typeHandler = StringListTypeHandler.class)
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
private List<String> customTimeSlots;
|
private List<String> customTimeSlots;
|
||||||
/**
|
/* *//**
|
||||||
* 指定日期
|
* 指定日期
|
||||||
*/
|
*//*
|
||||||
@TableField(typeHandler = StringListTypeHandler.class)
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
private List<String> specificDates;
|
private List<String> specificDates;*/
|
||||||
/**
|
/**
|
||||||
* 收费方式0:''固定金额'':1:''基准价上浮
|
* 收费方式0:''固定金额'':1:''基准价上浮
|
||||||
*/
|
*/
|
||||||
@@ -65,5 +71,7 @@ public class ProdAdditionalFeeDatesDO extends BaseDO {
|
|||||||
* 是否启用该规则是否启用该规则0关1开
|
* 是否启用该规则是否启用该规则0关1开
|
||||||
*/
|
*/
|
||||||
private Integer isEnabled;
|
private Integer isEnabled;
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return id == null ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -56,5 +56,7 @@ public class ProdAdditionalFeePeriodsDO extends BaseDO {
|
|||||||
* 浮动百分比
|
* 浮动百分比
|
||||||
*/
|
*/
|
||||||
private BigDecimal floatingPercentage;
|
private BigDecimal floatingPercentage;
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return id == null ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -39,23 +39,5 @@ public class ProdEmergencyResponseDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
@TableField(typeHandler = StringListTypeHandler.class)
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
private List<String> responseTimeSlots;
|
private List<String> responseTimeSlots;
|
||||||
/**
|
|
||||||
* 黑名自定义日期
|
|
||||||
*/
|
|
||||||
@TableField(typeHandler = StringListTypeHandler.class)
|
|
||||||
private List<String> blacklistedDates;
|
|
||||||
/**
|
|
||||||
* 黑名单指定日期
|
|
||||||
*/
|
|
||||||
@TableField(typeHandler = StringListTypeHandler.class)
|
|
||||||
private List<String> blackAppointDates;
|
|
||||||
/**
|
|
||||||
* 法定节假日是否开启0:关闭1开启
|
|
||||||
*/
|
|
||||||
private Integer blackHappy;
|
|
||||||
/**
|
|
||||||
* 固定休息日周末是否开启0关闭1开启
|
|
||||||
*/
|
|
||||||
private Integer blackWeekend;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -38,9 +38,9 @@ public class ProdEmergencyResponseIntervalsDO extends BaseDO {
|
|||||||
private Long prodId;
|
private Long prodId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 响应模式名称
|
* 响应模式名称modeName
|
||||||
*/
|
*/
|
||||||
private String modeName;
|
private String name;
|
||||||
/**
|
/**
|
||||||
* 响应时间(小时)
|
* 响应时间(小时)
|
||||||
*/
|
*/
|
||||||
@@ -58,4 +58,8 @@ public class ProdEmergencyResponseIntervalsDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return id == null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -41,4 +41,9 @@ public class ProdExtendDO {
|
|||||||
*/
|
*/
|
||||||
private Integer isDisable;
|
private Integer isDisable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体重是否收费0否1是
|
||||||
|
*/
|
||||||
|
private Integer isWeightCharge;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -66,37 +66,6 @@ public class ProdReservationConfigDO extends BaseDO {
|
|||||||
* 允许更改预约时间的最大次数
|
* 允许更改预约时间的最大次数
|
||||||
*/
|
*/
|
||||||
private Integer maxChangeTimes;
|
private Integer maxChangeTimes;
|
||||||
/**
|
|
||||||
* 黑名自定义日期
|
|
||||||
*/
|
|
||||||
@TableField(typeHandler = StringListTypeHandler.class)
|
|
||||||
private List<String> blacklistedDates;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* '是否开启黑名单自定义0关1开'
|
|
||||||
*/
|
|
||||||
private Integer isBlacklisted;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* '是否开启黑名单指定日期0关1开'
|
|
||||||
*/
|
|
||||||
private Integer isBlackAppoint;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 黑名单指定日期
|
|
||||||
*/
|
|
||||||
//private String blackAppointDates;
|
|
||||||
@TableField(typeHandler = StringListTypeHandler.class)
|
|
||||||
private List<String> blackAppointDates;
|
|
||||||
/**
|
|
||||||
* 法定节假日是否开启0:关闭1开启
|
|
||||||
*/
|
|
||||||
private Integer blackHappy;
|
|
||||||
/**
|
|
||||||
* 固定休息日周末是否开启0关闭1开启
|
|
||||||
*/
|
|
||||||
private Integer blackWeekend;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预约时间区间设置
|
* 预约时间区间设置
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.tashow.cloud.productapi.api.product.vo;
|
package com.tashow.cloud.productapi.api.product.vo;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -63,12 +63,17 @@ public class ProdListVO {
|
|||||||
/**
|
/**
|
||||||
* 服务时段
|
* 服务时段
|
||||||
*/
|
*/
|
||||||
private BigDecimal reservationTimeSlots;
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
|
private List<String> reservationTimeSlots;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 还剩多少天
|
* 还剩多少天
|
||||||
*/
|
*/
|
||||||
private Long remainingDays;
|
private Long remainingDays;
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
private String pic;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审核备注
|
* 审核备注
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.tashow.cloud.productapi.api.product.vo.prod;
|
package com.tashow.cloud.productapi.api.product.vo.prod;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.tashow.cloud.productapi.general.StringListTypeHandler;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -49,7 +51,8 @@ public class ProdRestoreListVO {
|
|||||||
/**
|
/**
|
||||||
* 服务时段
|
* 服务时段
|
||||||
*/
|
*/
|
||||||
private BigDecimal reservationTimeSlots;
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
|
private List<String> reservationTimeSlots;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 还剩多少天
|
* 还剩多少天
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.tashow.cloud.productapi.api.product.vo.prod;
|
|||||||
import com.tashow.cloud.productapi.api.product.dto.SkuDO;
|
import com.tashow.cloud.productapi.api.product.dto.SkuDO;
|
||||||
import com.tashow.cloud.productapi.api.product.vo.prodprop.ProdPropSaveReqVO;
|
import com.tashow.cloud.productapi.api.product.vo.prodprop.ProdPropSaveReqVO;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product.vo.prod;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.ProdAdditionalFeeDatesDO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.ProdAdditionalFeePeriodsDO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.ProdWeightRangePricesDO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.ProductOrderLimitDO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prodemergencyresponse.ProdEmergencyInfoReqVO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prodemergencyresponse.ProdEmergencyInfoVO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prodreservationconfig.ProdReservationInfoReqVO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prodreservationconfig.ProdReservationInfoVO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prodserviceareas.ProdServiceAreasInfoVO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prodweightrangeprices.ProdWeightRangePricesSaveInfoVO;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Schema(description = "商品服务配置 VO")
|
||||||
|
@Data
|
||||||
|
public class ProdServiceInfoVO {
|
||||||
|
|
||||||
|
@Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6943")
|
||||||
|
private Long prodId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@Schema(description = "修改时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
@Schema(description = "新建人")
|
||||||
|
private String creator;
|
||||||
|
|
||||||
|
@Schema(description = "修改人")
|
||||||
|
private String updater;
|
||||||
|
|
||||||
|
@Schema(description = "分类名称")
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
|
@Schema(description = "是否开启服务区域配置0关1开")
|
||||||
|
private Integer regionSwitch;
|
||||||
|
@Schema(description = "服务区域配置")
|
||||||
|
public ProdServiceAreasInfoVO prodServiceAreasInfo;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "是否预约0关1开")
|
||||||
|
private Integer reservationSwitch;
|
||||||
|
@Schema(description = "预约配置")
|
||||||
|
public ProdReservationInfoReqVO prodReservationConfig;
|
||||||
|
|
||||||
|
@Schema(description = "是否紧急响应服务0关1开")
|
||||||
|
private Integer emergencySwitch;
|
||||||
|
@Schema(description = "急响应服务配置")
|
||||||
|
public ProdEmergencyInfoReqVO prodEmergencyInfoVO;
|
||||||
|
|
||||||
|
@Schema(description = "是否接单上线0关1开")
|
||||||
|
private Integer orderLimitSwitch;
|
||||||
|
@Schema(description = "接单上线配置")
|
||||||
|
public ProductOrderLimitDO productOrderLimitVO;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "是否特殊日期(节假日周末什么的)0关1开 ")
|
||||||
|
private Integer additionalSwitch;
|
||||||
|
@Schema(description = "特殊日期规则配置")
|
||||||
|
public List<ProdAdditionalFeeDatesDO> prodAdditionalFeeDatesList;
|
||||||
|
|
||||||
|
@Schema(description = "是否特殊时段0关1开")
|
||||||
|
private Integer additionalFeeSwitch;
|
||||||
|
@Schema(description = "特殊时段规则配置 ")
|
||||||
|
public List<ProdAdditionalFeePeriodsDO> prodAdditionalFeePeriodsList;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "是否开启体重配置0关1开")
|
||||||
|
private Integer weightSwitch;
|
||||||
|
@Schema(description = "体重配置")
|
||||||
|
public ProdWeightRangePricesSaveInfoVO prodWeightConfig;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,14 +1,20 @@
|
|||||||
package com.tashow.cloud.productapi.api.product.vo.prod;
|
package com.tashow.cloud.productapi.api.product.vo.prod;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prodadditionalfeedates.ProdAdditionalFeeBlackVO;
|
||||||
import com.tashow.cloud.productapi.api.product.vo.prodemergencyresponse.ProdEmergencyInfoVO;
|
import com.tashow.cloud.productapi.api.product.vo.prodemergencyresponse.ProdEmergencyInfoVO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prodreservationconfig.ProdReservationInfoVO;
|
||||||
import com.tashow.cloud.productapi.api.product.vo.prodserviceareas.ProdServiceAreasInfoVO;
|
import com.tashow.cloud.productapi.api.product.vo.prodserviceareas.ProdServiceAreasInfoVO;
|
||||||
import com.tashow.cloud.productapi.api.product.dto.*;
|
import com.tashow.cloud.productapi.api.product.dto.*;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prodweightrangeprices.ProdWeightRangePricesSaveInfoVO;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Schema(description = "商品服务配置 VO")
|
@Schema(description = "商品服务配置 VO")
|
||||||
@Data
|
@Data
|
||||||
@@ -43,7 +49,23 @@ public class ProdServiceVO {
|
|||||||
@Schema(description = "是否预约0关1开")
|
@Schema(description = "是否预约0关1开")
|
||||||
private Integer reservationSwitch;
|
private Integer reservationSwitch;
|
||||||
@Schema(description = "预约配置")
|
@Schema(description = "预约配置")
|
||||||
public ProdReservationConfigDO prodReservationConfig;
|
public ProdReservationInfoVO prodReservationConfig;
|
||||||
|
|
||||||
|
/* public List<ProdAdditionalFeeBlackVO> getProdReservationBlackList() {
|
||||||
|
if (prodReservationBlackList == null || prodReservationBlackList.isEmpty()) {
|
||||||
|
return prodReservationBlackList;
|
||||||
|
}
|
||||||
|
return prodReservationBlackList.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProdReservationBlackList(List<ProdAdditionalFeeBlackVO> prodReservationBlackList) {
|
||||||
|
this.prodReservationBlackList = prodReservationBlackList;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "是否紧急响应服务0关1开")
|
@Schema(description = "是否紧急响应服务0关1开")
|
||||||
private Integer emergencySwitch;
|
private Integer emergencySwitch;
|
||||||
@@ -56,20 +78,42 @@ public class ProdServiceVO {
|
|||||||
public ProductOrderLimitDO productOrderLimitVO;
|
public ProductOrderLimitDO productOrderLimitVO;
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "是否特殊时段0关1开")
|
@Schema(description = "是否特殊日期(节假日周末什么的)0关1开")
|
||||||
private Integer additionalSwitch;
|
private Integer additionalSwitch;
|
||||||
@Schema(description = "特殊时段规则配置")
|
@Schema(description = "特殊日期规则配置")
|
||||||
public List<ProdAdditionalFeeDatesDO> prodAdditionalFeeDatesList;
|
public List<ProdAdditionalFeeDatesDO> prodAdditionalFeeDatesList;
|
||||||
|
|
||||||
@Schema(description = "是否特殊日期(节假日周末什么的)0关1开")
|
@Schema(description = "是否特殊时段0关1开 ")
|
||||||
private Integer additionalFeeSwitch;
|
private Integer additionalFeeSwitch;
|
||||||
@Schema(description = "特殊日期规则配置")
|
@Schema(description = "特殊时段规则配置 ")
|
||||||
public List<ProdAdditionalFeePeriodsDO> prodAdditionalFeePeriodsList;
|
public List<ProdAdditionalFeePeriodsDO> prodAdditionalFeePeriodsList;
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "是否开启体重配置0关1开")
|
@Schema(description = "是否开启体重配置0关1开")
|
||||||
private Integer weightSwitch;
|
private Integer weightSwitch;
|
||||||
@Schema(description = "体重配置")
|
@Schema(description = "体重配置")
|
||||||
public ProdWeightRangePricesDO prodWeightConfig;
|
public ProdWeightRangePricesSaveInfoVO prodWeightConfig;
|
||||||
|
|
||||||
|
|
||||||
|
public ProdReservationInfoVO getProdReservationConfig() {
|
||||||
|
|
||||||
|
if (this.prodReservationConfig == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// 判断是否“逻辑上为空”
|
||||||
|
if (isProdReservationInfoEmpty(this.prodReservationConfig)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return this.prodReservationConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProdReservationConfig(ProdReservationInfoVO prodReservationConfig) {
|
||||||
|
this.prodReservationConfig = prodReservationConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isProdReservationInfoEmpty(ProdReservationInfoVO config) {
|
||||||
|
if (config == null) return true;
|
||||||
|
// 判断所有字段是否都为 null 或空
|
||||||
|
return config.getId() == null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product.vo.prodadditionalfeedates;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.tashow.cloud.productapi.general.StringListTypeHandler;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 特殊日期附加费用规则 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class ProdAdditionalFeeBlackVO {
|
||||||
|
|
||||||
|
@Schema(description = "特殊日期规则的唯一标识符")
|
||||||
|
@ExcelProperty("特殊日期规则的唯一标识符")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "日期类型0:'自定义日期范围':1:'指定日期':2:'法定节假日',3:'固定休息日'")
|
||||||
|
@ExcelProperty("日期类型0:'自定义日期范围':1:'指定日期':2:'法定节假日',3:'固定休息日'")
|
||||||
|
private Integer dateType;
|
||||||
|
|
||||||
|
@Schema(description = "黑名单日期设置")
|
||||||
|
@ExcelProperty("黑名单日期设置")
|
||||||
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
|
private List<String> customTimeSlots;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "类型:1:特殊日期 2:可预约时段黑名单日期 3:紧急相应服务黑名单日期")
|
||||||
|
@ExcelProperty("类型:1:特殊日期 2:可预约时段黑名单日期 3:紧急相应服务黑名单日期")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@Schema(description = "是否启用该规则是否启用该规则0关1开", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("是否启用该规则是否启用该规则0关1开")
|
||||||
|
private Integer isEnabled;
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return id == null ;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product.vo.prodemergencyresponse;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.ProdEmergencyResponseIntervalsDO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prodadditionalfeedates.ProdAdditionalFeeBlackVO;
|
||||||
|
import com.tashow.cloud.productapi.general.StringListTypeHandler;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 商品紧急响应服务设置 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class ProdEmergencyInfoReqVO {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 紧急响应服务配置的唯一标识符
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 关联的商品ID
|
||||||
|
*/
|
||||||
|
private Long prodId;
|
||||||
|
/**
|
||||||
|
* 可响应时间段
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
|
private List<String> responseTimeSlots;
|
||||||
|
|
||||||
|
@Schema(description = "紧急响应时间区间设置")
|
||||||
|
public List<ProdEmergencyResponseIntervalsDO> prodEmergencyResponseIntervalsList;
|
||||||
|
|
||||||
|
@Schema(description = "紧急响应黑名单日期设置")
|
||||||
|
public List<ProdAdditionalFeeBlackVO> prodEmergencyResponseBlackList;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,11 +1,15 @@
|
|||||||
package com.tashow.cloud.productapi.api.product.vo.prodemergencyresponse;
|
package com.tashow.cloud.productapi.api.product.vo.prodemergencyresponse;
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.tashow.cloud.productapi.api.product.dto.ProdEmergencyResponseIntervalsDO;
|
import com.tashow.cloud.productapi.api.product.dto.ProdEmergencyResponseIntervalsDO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prodadditionalfeedates.ProdAdditionalFeeBlackVO;
|
||||||
|
import com.tashow.cloud.productapi.general.StringListTypeHandler;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 商品紧急响应服务设置 Response VO")
|
@Schema(description = "管理后台 - 商品紧急响应服务设置 Response VO")
|
||||||
@Data
|
@Data
|
||||||
@@ -24,27 +28,12 @@ public class ProdEmergencyInfoVO {
|
|||||||
/**
|
/**
|
||||||
* 可响应时间段
|
* 可响应时间段
|
||||||
*/
|
*/
|
||||||
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
private List<String> responseTimeSlots;
|
private List<String> responseTimeSlots;
|
||||||
/**
|
|
||||||
* 黑名自定义日期
|
|
||||||
*/
|
|
||||||
private List<String> blacklistedDates;
|
|
||||||
/**
|
|
||||||
* 黑名单指定日期
|
|
||||||
*/
|
|
||||||
private List<String> blackAppointDates;
|
|
||||||
/**
|
|
||||||
* 法定节假日是否开启0:关闭1开启
|
|
||||||
*/
|
|
||||||
private Integer blackHappy;
|
|
||||||
/**
|
|
||||||
* 固定休息日周末是否开启0关闭1开启
|
|
||||||
*/
|
|
||||||
private Integer blackWeekend;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "紧急响应时间区间设置")
|
@Schema(description = "紧急响应时间区间设置")
|
||||||
public List<ProdEmergencyResponseIntervalsDO> prodEmergencyResponseIntervalsList;
|
public List<ProdEmergencyResponseIntervalsDO> prodEmergencyResponseIntervalsList;
|
||||||
|
|
||||||
|
@Schema(description = "紧急响应黑名单日期设置")
|
||||||
|
public List<ProdAdditionalFeeBlackVO> prodEmergencyResponseBlackList;
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@ public class ProdEmergencyResponseIntervalsPageReqVO extends PageParam {
|
|||||||
private Long configId;
|
private Long configId;
|
||||||
|
|
||||||
@Schema(description = "响应模式名称", example = "王五")
|
@Schema(description = "响应模式名称", example = "王五")
|
||||||
private String modeName;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "响应时间(小时)")
|
@Schema(description = "响应时间(小时)")
|
||||||
private BigDecimal responseHours;
|
private BigDecimal responseHours;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class ProdEmergencyResponseIntervalsRespVO {
|
|||||||
|
|
||||||
@Schema(description = "响应模式名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
@Schema(description = "响应模式名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||||
@ExcelProperty("响应模式名称")
|
@ExcelProperty("响应模式名称")
|
||||||
private String modeName;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "响应时间(小时)", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "响应时间(小时)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@ExcelProperty("响应时间(小时)")
|
@ExcelProperty("响应时间(小时)")
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class ProdEmergencyResponseIntervalsSaveReqVO {
|
|||||||
|
|
||||||
@Schema(description = "响应模式名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
@Schema(description = "响应模式名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||||
@NotEmpty(message = "响应模式名称不能为空")
|
@NotEmpty(message = "响应模式名称不能为空")
|
||||||
private String modeName;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "响应时间(小时)", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "响应时间(小时)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotNull(message = "响应时间(小时)不能为空")
|
@NotNull(message = "响应时间(小时)不能为空")
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product.vo.prodpropvalue;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class ProPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 属性规格名称
|
||||||
|
*/
|
||||||
|
private String propValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品id
|
||||||
|
*/
|
||||||
|
private Long prodId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product.vo.prodpropvalue;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ProPropRecycleBinVO {
|
||||||
|
@Schema(description = "规格值id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 属性规格名称
|
||||||
|
*/
|
||||||
|
private String propValue;
|
||||||
|
/**
|
||||||
|
* 关联规格属性id
|
||||||
|
*/
|
||||||
|
private Long propId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 还剩多少天
|
||||||
|
*/
|
||||||
|
private Long remainingDays;
|
||||||
|
/**
|
||||||
|
* 删除时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date deleteTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product.vo.prodreservationconfig;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prodadditionalfeedates.ProdAdditionalFeeBlackVO;
|
||||||
|
import com.tashow.cloud.productapi.general.StringListTypeHandler;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 商品紧急响应服务设置 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class ProdReservationInfoReqVO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约配置的唯一标识符
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 关联的商品ID
|
||||||
|
*/
|
||||||
|
private Long prodId;
|
||||||
|
/**
|
||||||
|
* 预约时段设置
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
|
private List<String> reservationTimeSlots;
|
||||||
|
/**
|
||||||
|
* 需提前多少小时预约
|
||||||
|
*/
|
||||||
|
private Integer advanceHours;
|
||||||
|
/**
|
||||||
|
* 预约日期范围 7天 10天 15天 30天
|
||||||
|
*/
|
||||||
|
private Integer reservationDateRange;
|
||||||
|
/**
|
||||||
|
* 是否允许更改预约时间 1可以 0不可以
|
||||||
|
*/
|
||||||
|
private Integer allowChange;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间段
|
||||||
|
*/
|
||||||
|
private Integer timeSlot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更改预约时间的时间规则(如服务开始前1小时可更改)
|
||||||
|
*/
|
||||||
|
private Integer changeTimeRule;
|
||||||
|
/**
|
||||||
|
* 允许更改预约时间的最大次数
|
||||||
|
*/
|
||||||
|
private Integer maxChangeTimes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约时间区间设置
|
||||||
|
*/
|
||||||
|
@TableField(exist=false)
|
||||||
|
private TimeBookVO timeBook;
|
||||||
|
|
||||||
|
public TimeBookVO getTimeBook() {
|
||||||
|
if (this.timeBook == null) {
|
||||||
|
this.timeBook = new TimeBookVO();
|
||||||
|
this.timeBook.setTimeSlot(this.timeSlot);
|
||||||
|
this.timeBook.setReservationTimeSlots(this.reservationTimeSlots);
|
||||||
|
}
|
||||||
|
return this.timeBook;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimeBook(TimeBookVO timeBook) {
|
||||||
|
this.timeBook = timeBook;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Schema(description = "预约黑名单日期设置")
|
||||||
|
public List<ProdAdditionalFeeBlackVO> prodReservationBlackList = new ArrayList<>();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product.vo.prodreservationconfig;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.ProdEmergencyResponseIntervalsDO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prodadditionalfeedates.ProdAdditionalFeeBlackVO;
|
||||||
|
import com.tashow.cloud.productapi.general.StringListTypeHandler;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 商品紧急响应服务设置 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class ProdReservationInfoVO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约配置的唯一标识符
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 关联的商品ID
|
||||||
|
*/
|
||||||
|
private Long prodId;
|
||||||
|
/**
|
||||||
|
* 预约时段设置
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
|
private List<String> reservationTimeSlots;
|
||||||
|
/**
|
||||||
|
* 需提前多少小时预约
|
||||||
|
*/
|
||||||
|
private Integer advanceHours;
|
||||||
|
/**
|
||||||
|
* 预约日期范围 7天 10天 15天 30天
|
||||||
|
*/
|
||||||
|
private Integer reservationDateRange;
|
||||||
|
/**
|
||||||
|
* 是否允许更改预约时间 1可以 0不可以
|
||||||
|
*/
|
||||||
|
private Integer allowChange;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间段
|
||||||
|
*/
|
||||||
|
private Integer timeSlot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更改预约时间的时间规则(如服务开始前1小时可更改)
|
||||||
|
*/
|
||||||
|
private Integer changeTimeRule;
|
||||||
|
/**
|
||||||
|
* 允许更改预约时间的最大次数
|
||||||
|
*/
|
||||||
|
private Integer maxChangeTimes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约时间区间设置
|
||||||
|
*/
|
||||||
|
@TableField(exist=false)
|
||||||
|
private TimeBookVO timeBook;
|
||||||
|
|
||||||
|
public TimeBookVO getTimeBook() {
|
||||||
|
if (this.timeBook == null) {
|
||||||
|
this.timeBook = new TimeBookVO();
|
||||||
|
this.timeBook.setTimeSlot(this.timeSlot);
|
||||||
|
this.timeBook.setReservationTimeSlots(this.reservationTimeSlots);
|
||||||
|
}
|
||||||
|
return this.timeBook;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimeBook(TimeBookVO timeBook) {
|
||||||
|
this.timeBook = timeBook;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Schema(description = "预约黑名单日期设置")
|
||||||
|
public List<ProdAdditionalFeeBlackVO> prodReservationBlackList;
|
||||||
|
|
||||||
|
|
||||||
|
/* public List<ProdAdditionalFeeBlackVO> getProdReservationBlackList() {
|
||||||
|
if (prodReservationBlackList == null || prodReservationBlackList.isEmpty()) {
|
||||||
|
return prodReservationBlackList;
|
||||||
|
}
|
||||||
|
return prodReservationBlackList.stream()
|
||||||
|
.filter(black -> black != null && !black.isEmpty())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProdReservationBlackList(List<ProdAdditionalFeeBlackVO> prodReservationBlackList) {
|
||||||
|
this.prodReservationBlackList = prodReservationBlackList;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product.vo.prodweightrangeprices;
|
||||||
|
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.ProdWeightRangePricesDO;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 体重区间价格新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class ProdWeightRangePricesSaveInfoVO {
|
||||||
|
|
||||||
|
@Schema(description = "体重是否收费0否1是")
|
||||||
|
private Integer isWeightCharge;
|
||||||
|
|
||||||
|
@Schema(description = "体重配置")
|
||||||
|
public List<ProdWeightRangePricesDO> prodWeightConfigList;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.tashow.cloud.productapi.api.product.vo.sku;
|
package com.tashow.cloud.productapi.api.product.vo.sku;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -12,9 +15,13 @@ public class SkuRecycleBinVO {
|
|||||||
private Long skuId;
|
private Long skuId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否显示失效规格值 0否1是
|
* 属性规格名称
|
||||||
*/
|
*/
|
||||||
private String properties;
|
private String properties;
|
||||||
|
/**
|
||||||
|
* 是否显示失效规格值 0否1是
|
||||||
|
*/
|
||||||
|
private String skuName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 还剩多少天
|
* 还剩多少天
|
||||||
@@ -25,4 +32,140 @@ public class SkuRecycleBinVO {
|
|||||||
*/
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date deleteTime;
|
private Date deleteTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18784")
|
||||||
|
@ExcelProperty("商品ID")
|
||||||
|
private Long prodId;
|
||||||
|
|
||||||
|
@Schema(description = "别名")
|
||||||
|
@ExcelProperty("别名")
|
||||||
|
private String alias;
|
||||||
|
|
||||||
|
@Schema(description = "当前价格", example = "32405")
|
||||||
|
@ExcelProperty("价格")
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基准价
|
||||||
|
*/
|
||||||
|
private BigDecimal basePrice;
|
||||||
|
|
||||||
|
@Schema(description = "最低价格", example = "5040")
|
||||||
|
@ExcelProperty("最低价格")
|
||||||
|
private BigDecimal minPrice;
|
||||||
|
|
||||||
|
@Schema(description = "最高价格", example = "11547")
|
||||||
|
@ExcelProperty("最高价格")
|
||||||
|
private BigDecimal maxPrice;
|
||||||
|
|
||||||
|
@Schema(description = "成本价", example = "28062")
|
||||||
|
@ExcelProperty("成本价")
|
||||||
|
private BigDecimal originalPrice;
|
||||||
|
|
||||||
|
@Schema(description = "市场价", example = "11547")
|
||||||
|
@ExcelProperty("市场价")
|
||||||
|
private BigDecimal marketPrice;
|
||||||
|
|
||||||
|
@Schema(description = "单位")
|
||||||
|
@ExcelProperty("单位")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
@Schema(description = "0:主服务1:待定", example = "1")
|
||||||
|
@ExcelProperty("0:主服务1:待定")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@Schema(description = "概述")
|
||||||
|
@ExcelProperty("概述")
|
||||||
|
private String overview;
|
||||||
|
|
||||||
|
@Schema(description = "库存")
|
||||||
|
@ExcelProperty("库存")
|
||||||
|
private Integer stocks;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "总库存是0 无线库存是1")
|
||||||
|
@ExcelProperty("总库存是0 无线库存是1")
|
||||||
|
private Integer stocksFlg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 锁定库存数
|
||||||
|
*/
|
||||||
|
@Schema(description = "锁定库存数")
|
||||||
|
@ExcelProperty("锁定库存数")
|
||||||
|
private Integer stocksLockNum;
|
||||||
|
|
||||||
|
@Schema(description = "预警库存")
|
||||||
|
@ExcelProperty("预警库存")
|
||||||
|
private Integer warnStocks;
|
||||||
|
|
||||||
|
@Schema(description = "库存扣款时机0:付款扣1:下单扣", example = "1")
|
||||||
|
@ExcelProperty("库存扣款时机0:付款扣1:下单扣")
|
||||||
|
private Boolean stocksType;
|
||||||
|
|
||||||
|
@Schema(description = "sku编码")
|
||||||
|
@ExcelProperty("sku编码")
|
||||||
|
private String skuCode;
|
||||||
|
|
||||||
|
@Schema(description = "商品条形码", example = "14390")
|
||||||
|
@ExcelProperty("商品条形码")
|
||||||
|
private String modelId;
|
||||||
|
|
||||||
|
@Schema(description = "sku图片")
|
||||||
|
@ExcelProperty("sku图片")
|
||||||
|
private String pic;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "商品名称", example = "芋艿")
|
||||||
|
@ExcelProperty("商品名称")
|
||||||
|
private String prodName;
|
||||||
|
|
||||||
|
@Schema(description = "版本号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("版本号")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
@Schema(description = "商品重量")
|
||||||
|
@ExcelProperty("商品重量")
|
||||||
|
private Double weight;
|
||||||
|
|
||||||
|
@Schema(description = "商品体积")
|
||||||
|
@ExcelProperty("商品体积")
|
||||||
|
private Double volume;
|
||||||
|
|
||||||
|
@Schema(description = "0 禁用 1 启用", example = "1")
|
||||||
|
@ExcelProperty("0 禁用 1 启用")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "0 正常 1 已被删除")
|
||||||
|
@ExcelProperty("0 正常 1 已被删除")
|
||||||
|
private Integer isDelete;
|
||||||
|
|
||||||
|
@Schema(description = "最小购买数量")
|
||||||
|
@ExcelProperty("最小购买数量")
|
||||||
|
private Integer moq;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
/**
|
||||||
|
* 是否上下架0下架1上架
|
||||||
|
*/
|
||||||
|
private Integer isShelf;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否默认规则0否1是
|
||||||
|
*/
|
||||||
|
private Integer isSpecs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务内容
|
||||||
|
*/
|
||||||
|
private String serviceContent;
|
||||||
|
/**
|
||||||
|
* 规格id 多个用逗号分隔(1,2,3)
|
||||||
|
*/
|
||||||
|
private String propIds;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ public class SkuSaveReqVO {
|
|||||||
private Long skuId;
|
private Long skuId;
|
||||||
|
|
||||||
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18784")
|
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18784")
|
||||||
@NotNull(message = "商品ID不能为空")
|
|
||||||
private Long prodId;
|
private Long prodId;
|
||||||
|
|
||||||
@Schema(description = "销售属性组合字符串 格式是p1:v1;p2:v2")
|
@Schema(description = "销售属性组合字符串 格式是p1:v1;p2:v2")
|
||||||
@@ -86,7 +85,6 @@ public class SkuSaveReqVO {
|
|||||||
private String prodName;
|
private String prodName;
|
||||||
|
|
||||||
@Schema(description = "版本号", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "版本号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotNull(message = "版本号不能为空")
|
|
||||||
private Integer version;
|
private Integer version;
|
||||||
|
|
||||||
@Schema(description = "商品重量")
|
@Schema(description = "商品重量")
|
||||||
@@ -103,6 +101,11 @@ public class SkuSaveReqVO {
|
|||||||
|
|
||||||
@Schema(description = "最小购买数量")
|
@Schema(description = "最小购买数量")
|
||||||
private Integer moq;
|
private Integer moq;
|
||||||
|
/**
|
||||||
|
* 是否默认规则0否1是
|
||||||
|
*/
|
||||||
|
private Integer isSpecs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扩展服务表单id
|
* 扩展服务表单id
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class ApiConstants {
|
|||||||
*/
|
*/
|
||||||
public static final String NAME = "product-server";
|
public static final String NAME = "product-server";
|
||||||
|
|
||||||
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/infra";
|
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/product";
|
||||||
|
|
||||||
public static final String VERSION = "1.0.0";
|
public static final String VERSION = "1.0.0";
|
||||||
|
|
||||||
|
|||||||
@@ -32,4 +32,10 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode SKU_SERVICES_FORM_NOT_EXISTS = new ErrorCode(10021, "商品SKU扩展服务表单不存在");
|
ErrorCode SKU_SERVICES_FORM_NOT_EXISTS = new ErrorCode(10021, "商品SKU扩展服务表单不存在");
|
||||||
ErrorCode SKU_SERVICE_TRANSPORT_NOT_EXISTS = new ErrorCode(10022, "服务遗体运输不存在");
|
ErrorCode SKU_SERVICE_TRANSPORT_NOT_EXISTS = new ErrorCode(10022, "服务遗体运输不存在");
|
||||||
ErrorCode SKU_SERVICE_DETAILS_NOT_EXISTS = new ErrorCode(10023, "服务详情不存在");
|
ErrorCode SKU_SERVICE_DETAILS_NOT_EXISTS = new ErrorCode(10023, "服务详情不存在");
|
||||||
|
|
||||||
|
ErrorCode SKU_DOES_NOT_EXIST = new ErrorCode(10030, "商品不存在");
|
||||||
|
ErrorCode SKU_DELETE = new ErrorCode(10030, "商品已删除");
|
||||||
|
ErrorCode SKU_DISABLE = new ErrorCode(10031, "商品已禁用");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode ORDER_ITEM_NOT_FOUND = new ErrorCode(1_011_000_010, "交易订单项不存在");
|
ErrorCode ORDER_ITEM_NOT_FOUND = new ErrorCode(1_011_000_010, "交易订单项不存在");
|
||||||
ErrorCode ORDER_NOT_FOUND = new ErrorCode(1_011_000_011, "交易订单不存在");
|
ErrorCode ORDER_NOT_FOUND = new ErrorCode(1_011_000_011, "交易订单不存在");
|
||||||
ErrorCode ORDER_ITEM_UPDATE_AFTER_SALE_STATUS_FAIL = new ErrorCode(1_011_000_012, "交易订单项更新售后状态失败,请重试");
|
ErrorCode ORDER_ITEM_UPDATE_AFTER_SALE_STATUS_FAIL = new ErrorCode(1_011_000_012, "交易订单项更新售后状态失败,请重试");
|
||||||
|
ErrorCode ORDER_UPDATE_UNWAITACCEPT_FAIL = new ErrorCode(1_011_000_012, "交易订单更新状态失败,当前订单不处于待验收状态");
|
||||||
ErrorCode ORDER_UPDATE_PAID_STATUS_NOT_UNPAID = new ErrorCode(1_011_000_013, "交易订单更新支付状态失败,订单不是【未支付】状态");
|
ErrorCode ORDER_UPDATE_PAID_STATUS_NOT_UNPAID = new ErrorCode(1_011_000_013, "交易订单更新支付状态失败,订单不是【未支付】状态");
|
||||||
ErrorCode ORDER_UPDATE_PAID_FAIL_PAY_ORDER_ID_ERROR = new ErrorCode(1_011_000_014, "交易订单更新支付状态失败,支付单编号不匹配");
|
ErrorCode ORDER_UPDATE_PAID_FAIL_PAY_ORDER_ID_ERROR = new ErrorCode(1_011_000_014, "交易订单更新支付状态失败,支付单编号不匹配");
|
||||||
ErrorCode ORDER_UPDATE_PAID_FAIL_PAY_ORDER_STATUS_NOT_SUCCESS = new ErrorCode(1_011_000_015, "交易订单更新支付状态失败,支付单状态不是【支付成功】状态");
|
ErrorCode ORDER_UPDATE_PAID_FAIL_PAY_ORDER_STATUS_NOT_SUCCESS = new ErrorCode(1_011_000_015, "交易订单更新支付状态失败,支付单状态不是【支付成功】状态");
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public enum TradeOrderOperateTypeEnum {
|
|||||||
SYSTEM_COMMENT(34, "到期未评价,系统自动评价"),
|
SYSTEM_COMMENT(34, "到期未评价,系统自动评价"),
|
||||||
MEMBER_CANCEL(40, "取消订单"),
|
MEMBER_CANCEL(40, "取消订单"),
|
||||||
SYSTEM_CANCEL(41, "到期未支付,系统自动取消订单"),
|
SYSTEM_CANCEL(41, "到期未支付,系统自动取消订单"),
|
||||||
|
ADMIN_CANCEL(42, "管理员取消订单"),
|
||||||
// 42 预留:管理员取消订单
|
// 42 预留:管理员取消订单
|
||||||
ADMIN_CANCEL_AFTER_SALE(43, "订单全部售后,管理员自动取消订单"),
|
ADMIN_CANCEL_AFTER_SALE(43, "订单全部售后,管理员自动取消订单"),
|
||||||
MEMBER_DELETE(49, "删除订单"),
|
MEMBER_DELETE(49, "删除订单"),
|
||||||
|
|||||||
@@ -17,11 +17,15 @@ import java.util.Arrays;
|
|||||||
@Getter
|
@Getter
|
||||||
public enum TradeOrderStatusEnum implements ArrayValuable<Integer> {
|
public enum TradeOrderStatusEnum implements ArrayValuable<Integer> {
|
||||||
|
|
||||||
UNPAID(0, "待支付"),
|
WAITPAID(10, "等待付款"),
|
||||||
UNDELIVERED(10, "待发货"),
|
WAITCONFIRM(20, "等待确定"),
|
||||||
DELIVERED(20, "已发货"),
|
WAITSERVE(30, "等待服务"),
|
||||||
COMPLETED(30, "已完成"),
|
WAITACCEPT(40, "等待验收"),
|
||||||
CANCELED(40, "已取消");
|
COMPLETED(50, "已完成"),
|
||||||
|
CANCELED(60, "已取消"),
|
||||||
|
DELIVERED(70, "已退款"),
|
||||||
|
WAITDELIVERED(80, "待发货"),
|
||||||
|
;
|
||||||
|
|
||||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(TradeOrderStatusEnum::getStatus).toArray(Integer[]::new);
|
public static final Integer[] ARRAYS = Arrays.stream(values()).map(TradeOrderStatusEnum::getStatus).toArray(Integer[]::new);
|
||||||
|
|
||||||
@@ -49,7 +53,16 @@ public enum TradeOrderStatusEnum implements ArrayValuable<Integer> {
|
|||||||
* @return 是否
|
* @return 是否
|
||||||
*/
|
*/
|
||||||
public static boolean isUnpaid(Integer status) {
|
public static boolean isUnpaid(Integer status) {
|
||||||
return ObjectUtil.equal(UNPAID.getStatus(), status);
|
return ObjectUtil.equal(WAITPAID.getStatus(), status);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 判断指定状态,是否正处于【待验收】状态
|
||||||
|
*
|
||||||
|
* @param status 指定状态
|
||||||
|
* @return 是否
|
||||||
|
*/
|
||||||
|
public static boolean isWaitAccept(Integer status) {
|
||||||
|
return ObjectUtil.equal(WAITACCEPT.getStatus(), status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,7 +72,7 @@ public enum TradeOrderStatusEnum implements ArrayValuable<Integer> {
|
|||||||
* @return 是否
|
* @return 是否
|
||||||
*/
|
*/
|
||||||
public static boolean isUndelivered(Integer status) {
|
public static boolean isUndelivered(Integer status) {
|
||||||
return ObjectUtil.equal(UNDELIVERED.getStatus(), status);
|
return ObjectUtil.equal(WAITDELIVERED.getStatus(), status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,7 +112,7 @@ public enum TradeOrderStatusEnum implements ArrayValuable<Integer> {
|
|||||||
* @return 是否
|
* @return 是否
|
||||||
*/
|
*/
|
||||||
public static boolean havePaid(Integer status) {
|
public static boolean havePaid(Integer status) {
|
||||||
return ObjectUtils.equalsAny(status, UNDELIVERED.getStatus(),
|
return ObjectUtils.equalsAny(status, WAITCONFIRM.getStatus(),
|
||||||
DELIVERED.getStatus(), COMPLETED.getStatus());
|
DELIVERED.getStatus(), COMPLETED.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ import java.io.Serializable;
|
|||||||
@Data
|
@Data
|
||||||
public class PageParam implements Serializable {
|
public class PageParam implements Serializable {
|
||||||
|
|
||||||
private static final Integer PAGE_NO = 1;
|
|
||||||
private static final Integer PAGE_SIZE = 10;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每页条数 - 不分页
|
* 每页条数 - 不分页
|
||||||
@@ -29,7 +28,7 @@ public class PageParam implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@NotNull(message = "页码不能为空")
|
@NotNull(message = "页码不能为空")
|
||||||
@Min(value = 1, message = "页码最小值为 1")
|
@Min(value = 1, message = "页码最小值为 1")
|
||||||
private Integer pageNo = PAGE_NO;
|
private Integer pageNo = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每页条数,最大值为 100"
|
* 每页条数,最大值为 100"
|
||||||
@@ -37,6 +36,6 @@ public class PageParam implements Serializable {
|
|||||||
@NotNull(message = "每页条数不能为空")
|
@NotNull(message = "每页条数不能为空")
|
||||||
@Min(value = 1, message = "每页条数最小值为 1")
|
@Min(value = 1, message = "每页条数最小值为 1")
|
||||||
@Max(value = 100, message = "每页条数最大值为 100")
|
@Max(value = 100, message = "每页条数最大值为 100")
|
||||||
private Integer pageSize = PAGE_SIZE;
|
private Integer pageSize = 10;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,6 +196,15 @@ public class LocalDateTimeUtils {
|
|||||||
return LocalDateTimeUtil.beginOfDay(LocalDateTime.now().minusDays(1));
|
return LocalDateTimeUtil.beginOfDay(LocalDateTime.now().minusDays(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取day 天后的日期
|
||||||
|
*
|
||||||
|
* @return 昨天
|
||||||
|
*/
|
||||||
|
public static LocalDateTime getPlusDay(Integer day) {
|
||||||
|
return LocalDateTimeUtil.beginOfDay(LocalDateTime.now().plusDays(day));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取本月的开始时间
|
* 获取本月的开始时间
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.tashow.cloud.common.util.json.databind;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
|
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||||
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基于字符串的 LocalDateTime 序列化器
|
||||||
|
*
|
||||||
|
* @author 老五
|
||||||
|
*/
|
||||||
|
public class StringLocalDateTimeSerializer extends JsonSerializer<LocalDateTime> {
|
||||||
|
|
||||||
|
public static final StringLocalDateTimeSerializer INSTANCE = new StringLocalDateTimeSerializer();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(LocalDateTime value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
|
||||||
|
// 将 LocalDateTime 对象,转换为 Long 时间戳
|
||||||
|
gen.writeString(LocalDateTimeUtil.format(value, DatePattern.NORM_DATETIME_FORMATTER) );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -29,7 +29,7 @@ import java.util.List;
|
|||||||
* 1. {@link BaseMapper} 为 MyBatis Plus 的基础接口,提供基础的 CRUD 能力
|
* 1. {@link BaseMapper} 为 MyBatis Plus 的基础接口,提供基础的 CRUD 能力
|
||||||
* 2. {@link MPJBaseMapper} 为 MyBatis Plus Join 的基础接口,提供连表 Join 能力
|
* 2. {@link MPJBaseMapper} 为 MyBatis Plus Join 的基础接口,提供连表 Join 能力
|
||||||
*/
|
*/
|
||||||
public interface BaseMapperX<T> extends MPJBaseMapper<T> {
|
public interface BaseMapperX<T> extends MPJBaseMapper<T>,BaseMapper<T> {
|
||||||
|
|
||||||
default PageResult<T> selectPage(SortablePageParam pageParam, @Param("ew") Wrapper<T> queryWrapper) {
|
default PageResult<T> selectPage(SortablePageParam pageParam, @Param("ew") Wrapper<T> queryWrapper) {
|
||||||
return selectPage(pageParam, pageParam.getSortingFields(), queryWrapper);
|
return selectPage(pageParam, pageParam.getSortingFields(), queryWrapper);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class EnvEnvironmentPostProcessor implements EnvironmentPostProcessor {
|
|||||||
environment.getSystemProperties().put(hostNameKey, EnvUtils.getHostName());
|
environment.getSystemProperties().put(hostNameKey, EnvUtils.getHostName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1.1 如果没有 yudao.env.tag 配置项,则不进行配置项的修改
|
// 1.1 如果没有 tashow.env.tag 配置项,则不进行配置项的修改
|
||||||
String tag = EnvUtils.getTag(environment);
|
String tag = EnvUtils.getTag(environment);
|
||||||
if (StrUtil.isEmpty(tag)) {
|
if (StrUtil.isEmpty(tag)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public class WebSecurityConfigurerAdapter {
|
|||||||
.requestMatchers(HttpMethod.DELETE, permitAllUrls.get(HttpMethod.DELETE).toArray(new String[0])).permitAll()
|
.requestMatchers(HttpMethod.DELETE, permitAllUrls.get(HttpMethod.DELETE).toArray(new String[0])).permitAll()
|
||||||
.requestMatchers(HttpMethod.HEAD, permitAllUrls.get(HttpMethod.HEAD).toArray(new String[0])).permitAll()
|
.requestMatchers(HttpMethod.HEAD, permitAllUrls.get(HttpMethod.HEAD).toArray(new String[0])).permitAll()
|
||||||
.requestMatchers(HttpMethod.PATCH, permitAllUrls.get(HttpMethod.PATCH).toArray(new String[0])).permitAll()
|
.requestMatchers(HttpMethod.PATCH, permitAllUrls.get(HttpMethod.PATCH).toArray(new String[0])).permitAll()
|
||||||
// 1.3 基于 yudao.security.permit-all-urls 无需认证
|
// 1.3 基于 tashow.security.permit-all-urls 无需认证
|
||||||
.requestMatchers(securityProperties.getPermitAllUrls().toArray(new String[0])).permitAll()
|
.requestMatchers(securityProperties.getPermitAllUrls().toArray(new String[0])).permitAll()
|
||||||
)
|
)
|
||||||
// ②:每个项目的自定义规则
|
// ②:每个项目的自定义规则
|
||||||
|
|||||||
@@ -27,6 +27,15 @@
|
|||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xingfudeshi</groupId>
|
||||||
|
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Web 相关 -->
|
<!-- Web 相关 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|||||||
@@ -61,7 +61,6 @@
|
|||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<!-- 设置构建的 jar 包名 -->
|
<!-- 设置构建的 jar 包名 -->
|
||||||
<finalName>${project.artifactId}</finalName>
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ public class GatewayServerApplication {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// 启动 Spring Boot 应用
|
// 启动 Spring Boot 应用
|
||||||
SpringApplication.run(GatewayServerApplication.class, args);
|
SpringApplication.run(GatewayServerApplication.class, args);
|
||||||
|
System.out.println("网关启动成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
spring:
|
spring:
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
server-addr: localhost:8848 # Nacos 服务器地址
|
server-addr: 43.139.42.137:8848 # Nacos 服务器地址
|
||||||
username: # Nacos 账号
|
username: nacos # Nacos 账号
|
||||||
password: # Nacos 密码
|
password: nacos # Nacos 密码
|
||||||
discovery: # 【配置中心】配置项
|
discovery: # 【配置中心】配置项
|
||||||
namespace: dev # 命名空间。这里使用 dev 开发环境
|
namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||||
|
|||||||
@@ -15,9 +15,10 @@
|
|||||||
<module>tashow-module-infra</module>
|
<module>tashow-module-infra</module>
|
||||||
<module>tashow-module-app</module>
|
<module>tashow-module-app</module>
|
||||||
<module>tashow-module-product</module>
|
<module>tashow-module-product</module>
|
||||||
|
<module>tashow-module-ai</module>
|
||||||
<module>tashow-module-pay</module>
|
<module>tashow-module-pay</module>
|
||||||
<module>tashow-module-trade</module>
|
<module>tashow-module-trade</module>
|
||||||
<module>tashow-module-member</module>
|
<module>tashow-module-user</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
96
tashow-module/tashow-module-ai/pom.xml
Normal file
96
tashow-module/tashow-module-ai/pom.xml
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-module</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>tashow-module-ai</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- Registry 注册中心相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Config 配置中心相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--文件管理-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-infra-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- RPC 远程调用相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-framework-rpc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-data-mybatis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-framework-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-framework-env</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-framework-websocket</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-data-excel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-framework-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- 监控相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-framework-monitor</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<!-- 设置构建的 jar 包名 -->
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<!-- 打包 -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>${spring.boot.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.tashow.cloud.ai;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用服务启动类
|
||||||
|
*/
|
||||||
|
@SpringBootApplication
|
||||||
|
public class AiServerApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(AiServerApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin.aisample;
|
||||||
|
|
||||||
|
import com.tashow.cloud.ai.controller.admin.aisample.vo.*;
|
||||||
|
import com.tashow.cloud.ai.dal.dataobject.aisample.AiSampleDO;
|
||||||
|
import com.tashow.cloud.ai.service.aisample.AiSampleService;
|
||||||
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
|
import com.tashow.cloud.common.util.object.BeanUtils;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.annotation.security.PermitAll;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 样本库")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/ai/sample")
|
||||||
|
@Validated
|
||||||
|
public class AiSampleController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AiSampleService aiSampleService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建样本库-上传文件")
|
||||||
|
@PermitAll
|
||||||
|
// @PreAuthorize("@ss.hasPermission('ai:sample:create')")
|
||||||
|
public CommonResult<List<AiSampleFileRespVO>> createAiSample(FileUploadReqVO uploadReqVO) {
|
||||||
|
return success(aiSampleService.createAiSample(uploadReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/updates")
|
||||||
|
@Operation(summary = "更新样本库")
|
||||||
|
// @PreAuthorize("@ss.hasPermission('ai:sample:update')")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<Boolean> updateAiSample(@Valid @RequestBody List<AiSampleSaveReqVO> updateReqVO) {
|
||||||
|
aiSampleService.updateAiSamples(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/relate")
|
||||||
|
@Operation(summary = "添加关联标签")
|
||||||
|
// @PreAuthorize("@ss.hasPermission('ai:sample:update')")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<Boolean> relate(@Valid @RequestBody AiSampleRelateTagVO relateTagVO) {
|
||||||
|
aiSampleService.relate(relateTagVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/deleteRelate")
|
||||||
|
@Operation(summary = "删除关联标签")
|
||||||
|
// @PreAuthorize("@ss.hasPermission('ai:sample:delete')")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<Boolean> deleteRelate(@Valid @RequestBody AiSampleRelateTagVO relateTagVO) {
|
||||||
|
aiSampleService.deleteRelate(relateTagVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除样本库")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
// @PreAuthorize("@ss.hasPermission('ai:sample:delete')")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<Boolean> deleteAiSample(@RequestParam("id") String ids) {
|
||||||
|
aiSampleService.deleteAiSample(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得样本库")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
// @PreAuthorize("@ss.hasPermission('ai:sample:query')")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<AiSampleRespVO> getAiSample(@RequestParam("id") Long id) {
|
||||||
|
AiSampleDO aiSample = aiSampleService.getAiSample(id);
|
||||||
|
return success(BeanUtils.toBean(aiSample, AiSampleRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得样本库分页")
|
||||||
|
// @PreAuthorize("@ss.hasPermission('ai:sample:query')")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<PageResult<AiSampleRespVO>> getAiSamplePage(@Valid AiSamplePageReqVO pageReqVO) {
|
||||||
|
PageResult<AiSampleDO> pageResult = aiSampleService.getAiSamplePage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, AiSampleRespVO.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin.aisample;
|
||||||
|
|
||||||
|
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSampleTagListRespVO;
|
||||||
|
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSampleTagPageReqVO;
|
||||||
|
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSampleTagSaveReqVO;
|
||||||
|
import com.tashow.cloud.ai.dal.dataobject.aisample.AiSampleTagDO;
|
||||||
|
import com.tashow.cloud.ai.service.aisample.AiSampleTagService;
|
||||||
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
|
import com.tashow.cloud.common.util.object.BeanUtils;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.annotation.security.PermitAll;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 样本标签库")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/ai/sampleTag")
|
||||||
|
@Validated
|
||||||
|
public class AiSampleTagController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AiSampleTagService aiSampleTagService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建样本标签库")
|
||||||
|
// @PreAuthorize("@ss.hasPermission('ai:sampleTag:create')")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<Long> createAiSampleTag(@Valid @RequestBody AiSampleTagSaveReqVO createReqVO) {
|
||||||
|
return success(aiSampleTagService.createAiSampleTag(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新样本标签库")
|
||||||
|
// @PreAuthorize("@ss.hasPermission('ai:sampleTag:update')")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<Boolean> updateAiSampleTag(@Valid @RequestBody AiSampleTagSaveReqVO updateReqVO) {
|
||||||
|
aiSampleTagService.updateAiSampleTag(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除样本标签库")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
// @PreAuthorize("@ss.hasPermission('ai:sampleTag:delete')")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<Boolean> deleteAiSampleTag(@RequestParam("id") Long id) {
|
||||||
|
aiSampleTagService.deleteAiSampleTag(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "获得样本标签库列表")
|
||||||
|
// @PreAuthorize("@ss.hasPermission('ai:sampleTag:query')")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<List<AiSampleTagListRespVO>> getAiSampleTagList() {
|
||||||
|
return success(BeanUtils.toBean(aiSampleTagService.getAiSampleTagList(), AiSampleTagListRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得样本标签库分页")
|
||||||
|
// @PreAuthorize("@ss.hasPermission('ai:sampleTag:query')")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<PageResult<AiSampleTagDO>> getAiSampleTagPage(@Valid AiSampleTagPageReqVO pageReqVO) {
|
||||||
|
PageResult<AiSampleTagDO> pageResult = aiSampleTagService.getAiSampleTagPage(pageReqVO);
|
||||||
|
return success(pageResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin.aisample;
|
||||||
|
|
||||||
|
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSampleTagGroupRespVO;
|
||||||
|
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSampleTagGroupSaveReqVO;
|
||||||
|
import com.tashow.cloud.ai.dal.dataobject.aisample.AiSampleTagGroupDO;
|
||||||
|
import com.tashow.cloud.ai.service.aisample.AiSampleTagGroupService;
|
||||||
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
|
import com.tashow.cloud.common.util.object.BeanUtils;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.annotation.security.PermitAll;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 样本标签分组库")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/ai/sampleTagGroup")
|
||||||
|
@Validated
|
||||||
|
public class AiSampleTagGroupController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AiSampleTagGroupService aiSampleTagGroupService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建样本标签分组库")
|
||||||
|
// @PreAuthorize("@ss.hasPermission('ai:sampleTagGroup:create')")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<Long> createAiSampleTagGroup(@Valid @RequestBody AiSampleTagGroupSaveReqVO createReqVO) {
|
||||||
|
return success(aiSampleTagGroupService.createAiSampleTagGroup(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新样本标签分组库")
|
||||||
|
// @PreAuthorize("@ss.hasPermission('ai:sampleTagGroup:update')")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<Boolean> updateAiSampleTagGroup(@Valid @RequestBody AiSampleTagGroupSaveReqVO updateReqVO) {
|
||||||
|
aiSampleTagGroupService.updateAiSampleTagGroup(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除样本标签分组库")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
// @PreAuthorize("@ss.hasPermission('ai:sampleTagGroup:delete')")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<Boolean> deleteAiSampleTagGroup(@RequestParam("id") Long id) {
|
||||||
|
aiSampleTagGroupService.deleteAiSampleTagGroup(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "获得样本标签分组库列表")
|
||||||
|
// @PreAuthorize("@ss.hasPermission('ai:sampleTagGroup:query')")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<List<AiSampleTagGroupRespVO>> getAiSampleTagGroupPage() {
|
||||||
|
List<AiSampleTagGroupDO> aiSampleTagGroupList = aiSampleTagGroupService.getAiSampleTagGroupList();
|
||||||
|
return success(BeanUtils.toBean(aiSampleTagGroupList, AiSampleTagGroupRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin.aisample.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 样本库 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class AiSampleFileRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "文件地址")
|
||||||
|
private String fileUrl;
|
||||||
|
|
||||||
|
@Schema(description = "文件名称")
|
||||||
|
private String fileName;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin.aisample.vo;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 样本库分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class AiSamplePageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "标签ids", example = "25839")
|
||||||
|
private String tagIds;
|
||||||
|
|
||||||
|
@Schema(description = "样本名称", example = "张三")
|
||||||
|
private String sampleName;
|
||||||
|
|
||||||
|
@Schema(description = "样本格式", example = "1")
|
||||||
|
private String sampleMineType;
|
||||||
|
|
||||||
|
@Schema(description = "排序", example = "正序:asc,倒序:desc")
|
||||||
|
private String sort;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin.aisample.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 关联 Request VO")
|
||||||
|
@Data
|
||||||
|
public class AiSampleRelateTagVO {
|
||||||
|
|
||||||
|
@Schema(description = "标签id")
|
||||||
|
private List<Long> tagId;
|
||||||
|
|
||||||
|
@Schema(description = "样本ids")
|
||||||
|
private List<Long> sampleIds;
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin.aisample.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.tashow.cloud.ai.dal.dataobject.aisample.AiSampleTagDO;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 样本库 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class AiSampleRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "7701")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "标签列表")
|
||||||
|
private List<AiSampleTagDO> tags;
|
||||||
|
|
||||||
|
@Schema(description = "样本文件地址")
|
||||||
|
private String sampleFilePath;
|
||||||
|
|
||||||
|
@Schema(description = "样本名称", example = "张三")
|
||||||
|
private String sampleName;
|
||||||
|
|
||||||
|
@Schema(description = "样本时长")
|
||||||
|
private String sampleTime;
|
||||||
|
|
||||||
|
@Schema(description = "样本格式", example = "1")
|
||||||
|
private String sampleMineType;
|
||||||
|
|
||||||
|
@Schema(description = "样本大小")
|
||||||
|
private String sampleSize;
|
||||||
|
|
||||||
|
@Schema(description = "样本注释", example = "随便")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
@Schema(description = "修改时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin.aisample.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 样本库新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class AiSampleSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "7701")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "样本名称", example = "张三")
|
||||||
|
private String sampleName;
|
||||||
|
|
||||||
|
@Schema(description = "样本注释", example = "随便")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin.aisample.vo;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 样本标签分组库分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class AiSampleTagGroupPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "分组名称", example = "张三")
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin.aisample.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 样本标签分组库 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class AiSampleTagGroupRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "18784")
|
||||||
|
@ExcelProperty("主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "分组名称", example = "张三")
|
||||||
|
@ExcelProperty("分组名称")
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin.aisample.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 样本标签分组库新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class AiSampleTagGroupSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "18784")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "分组名称", example = "张三")
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin.aisample.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 样本标签库 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class AiSampleTagListRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "标签id")
|
||||||
|
private Long id;
|
||||||
|
@Schema(description = "标签名称")
|
||||||
|
private String tagName;
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin.aisample.vo;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 样本标签库分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class AiSampleTagPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "分组id")
|
||||||
|
private Long groupId;
|
||||||
|
@Schema(description = "标签名称", example = "张三")
|
||||||
|
private String tagName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin.aisample.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.tashow.cloud.ai.dal.dataobject.aisample.AiSampleTagDO;
|
||||||
|
import com.tashow.cloud.ai.dal.dataobject.aisample.AiSampleTagGroupDO;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 样本标签库 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class AiSampleTagRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "标签列表")
|
||||||
|
List<AiSampleTagDO> tags;
|
||||||
|
@Schema(description = "分组列表")
|
||||||
|
List<AiSampleTagGroupDO> tagGroupDOS;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin.aisample.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 样本标签库新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class AiSampleTagSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32538")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "分组ids")
|
||||||
|
private List<Long> groupIds;
|
||||||
|
|
||||||
|
@Schema(description = "标签名称", example = "张三")
|
||||||
|
private String tagName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin.aisample.vo;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
/** 管理后台 - 上传文件 Request VO */
|
||||||
|
@Data
|
||||||
|
public class FileUploadReqVO {
|
||||||
|
|
||||||
|
/** 文件附件 */
|
||||||
|
@NotNull(message = "文件附件不能为空")
|
||||||
|
private MultipartFile[] files;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.admin;
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.app.dialog;
|
||||||
|
|
||||||
|
|
||||||
|
import com.tashow.cloud.ai.controller.app.dialog.vo.DialogResp;
|
||||||
|
import com.tashow.cloud.ai.controller.app.dialog.vo.TranslateReqVo;
|
||||||
|
import com.tashow.cloud.ai.controller.app.dialog.vo.TranslateRespVo;
|
||||||
|
import com.tashow.cloud.ai.service.dialog.AiDialogService;
|
||||||
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
|
import com.tashow.cloud.common.pojo.PageParam;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.annotation.security.PermitAll;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 翻译
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/ai/dialog")
|
||||||
|
@Validated
|
||||||
|
@Slf4j
|
||||||
|
public class DialogController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AiDialogService aiDialogService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取对话消息列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/getDialog")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<DialogResp> msList(PageParam pageParam) {
|
||||||
|
//获取当前登录用户
|
||||||
|
Long userId = 1L;
|
||||||
|
return success(aiDialogService.getDialog(userId,pageParam));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 翻译
|
||||||
|
*/
|
||||||
|
@PostMapping("/translate")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<TranslateRespVo> translate(@Validated TranslateReqVo fileReqVo) {
|
||||||
|
return success(aiDialogService.translate(fileReqVo));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.app.dialog.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.tashow.cloud.common.util.json.databind.StringLocalDateTimeSerializer;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ai-对话消息 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Schema(description = "api - 对话 Response VO")
|
||||||
|
@Data
|
||||||
|
public class AiDialogMessageRespVo {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 对话id
|
||||||
|
*/
|
||||||
|
private Long dialogId;
|
||||||
|
/**
|
||||||
|
* 内容
|
||||||
|
*/
|
||||||
|
private String contentText;
|
||||||
|
/**
|
||||||
|
* 文件时长
|
||||||
|
*/
|
||||||
|
private Long contentDuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文本类型(1text,2image,3file,4audio)
|
||||||
|
*/
|
||||||
|
private Integer contentType;
|
||||||
|
/**
|
||||||
|
* 对话中的顺序
|
||||||
|
*/
|
||||||
|
private Integer messageOrder;
|
||||||
|
/**
|
||||||
|
* 消息状态 1正常 0删除
|
||||||
|
*/
|
||||||
|
private Integer messageStatus;
|
||||||
|
/**
|
||||||
|
* 宠物id
|
||||||
|
*/
|
||||||
|
private Long petId;
|
||||||
|
/**
|
||||||
|
* 宠物名称
|
||||||
|
*/
|
||||||
|
private String petName;
|
||||||
|
/**
|
||||||
|
* 宠物头像
|
||||||
|
*/
|
||||||
|
private String petAvatar;
|
||||||
|
/**
|
||||||
|
* 宠物类型
|
||||||
|
*/
|
||||||
|
private String petType;
|
||||||
|
/**
|
||||||
|
* 翻译结果
|
||||||
|
*/
|
||||||
|
private String transResult;
|
||||||
|
/**
|
||||||
|
* 翻译结果
|
||||||
|
*/
|
||||||
|
private Integer transStatus;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
//发送时间
|
||||||
|
@JsonSerialize(using = StringLocalDateTimeSerializer.class)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
private Integer emotion;
|
||||||
|
private String terminal;
|
||||||
|
private String fileType;
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.app.dialog.vo;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "api - 对话 Response VO")
|
||||||
|
@Data
|
||||||
|
public class DialogResp {
|
||||||
|
|
||||||
|
@Schema(description = "对话id")
|
||||||
|
private Long dialogId;
|
||||||
|
@Schema(description = "对话标题")
|
||||||
|
private String title;
|
||||||
|
@Schema(description = "对话状态")
|
||||||
|
private String dialogStatus;
|
||||||
|
@Schema(description = "对话消息内容")
|
||||||
|
private PageResult<AiDialogMessageRespVo> messages;
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.app.dialog.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 翻译接口请求vo
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TranslateReqVo {
|
||||||
|
|
||||||
|
//对话id
|
||||||
|
private Long dialogId;
|
||||||
|
//消息id
|
||||||
|
private Long msgId;
|
||||||
|
|
||||||
|
private String terminal;
|
||||||
|
|
||||||
|
/** 文件附件 */
|
||||||
|
private MultipartFile file;
|
||||||
|
|
||||||
|
//文件时长
|
||||||
|
private Long contentDuration;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.app.dialog.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.tashow.cloud.common.util.json.databind.StringLocalDateTimeSerializer;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 翻译接口结果vo
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TranslateRespVo {
|
||||||
|
|
||||||
|
//消息id
|
||||||
|
private Long id;
|
||||||
|
//对话id
|
||||||
|
private Long dialogId;
|
||||||
|
//消息顺序
|
||||||
|
private Integer messageOrder;
|
||||||
|
//消息类型(1text,2file)
|
||||||
|
private Integer contentType;
|
||||||
|
//消息内容 若消息类型是file 则为文件地址
|
||||||
|
private String contentText;
|
||||||
|
//消息内容 若消息类型是file 则为文件地址
|
||||||
|
private String fileType;
|
||||||
|
//宠物类型
|
||||||
|
private String petType;
|
||||||
|
//宠物名称
|
||||||
|
private String petName;
|
||||||
|
//宠物头像
|
||||||
|
private String petAvatar;
|
||||||
|
//宠物id
|
||||||
|
private Long petId;
|
||||||
|
//翻译状态
|
||||||
|
private Integer transStatus;
|
||||||
|
//翻译结果
|
||||||
|
private String transResult;
|
||||||
|
//文件时长
|
||||||
|
private Long contentDuration;
|
||||||
|
private String terminal;
|
||||||
|
//发送时间
|
||||||
|
@JsonSerialize(using = StringLocalDateTimeSerializer.class)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
package com.tashow.cloud.ai.controller.app;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
package com.tashow.cloud.ai.controller;
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.tashow.cloud.ai.dal.dataobject.aisample;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样本库 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("tz_ai_sample")
|
||||||
|
@KeySequence("tz_ai_sample_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AiSampleDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<AiSampleTagDO> tags;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样本文件id
|
||||||
|
*/
|
||||||
|
private String sampleFilePath;
|
||||||
|
/**
|
||||||
|
* 样本名称
|
||||||
|
*/
|
||||||
|
private String sampleName;
|
||||||
|
/**
|
||||||
|
* 样本时长
|
||||||
|
*/
|
||||||
|
private String sampleTime;
|
||||||
|
/**
|
||||||
|
* 样本格式
|
||||||
|
*/
|
||||||
|
private String sampleMineType;
|
||||||
|
/**
|
||||||
|
* 样本大小
|
||||||
|
*/
|
||||||
|
private Long sampleSize;
|
||||||
|
/**
|
||||||
|
* 样本注释
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.tashow.cloud.ai.dal.dataobject.aisample;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样本标签库 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("tz_ai_sample_tag")
|
||||||
|
@KeySequence("tz_ai_sample_tag_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AiSampleTagDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签名称
|
||||||
|
*/
|
||||||
|
private String tagName;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.tashow.cloud.ai.dal.dataobject.aisample;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样本标签分组库 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("tz_ai_sample_tag_group")
|
||||||
|
@KeySequence("tz_ai_sample_tag_group_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AiSampleTagGroupDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 分组名称
|
||||||
|
*/
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.tashow.cloud.ai.dal.dataobject.aisample;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样本标签-分组关联 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("tz_ai_sample_tag_group_relate")
|
||||||
|
@KeySequence("tz_ai_sample_tag_group_relate_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AiSampleTagGroupRelateDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 样本标签id
|
||||||
|
*/
|
||||||
|
private Long sampleTagId;
|
||||||
|
/**
|
||||||
|
* 样本标签分组id
|
||||||
|
*/
|
||||||
|
private Long sampleTagGroupId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.tashow.cloud.ai.dal.dataobject.aisample;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样本-标签关联 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("tz_ai_sample_tag_relate")
|
||||||
|
@KeySequence("tz_ai_sample_tag_relate_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AiSampleTagRelateDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 样本id
|
||||||
|
*/
|
||||||
|
private Long sampleId;
|
||||||
|
/**
|
||||||
|
* 样本标签id
|
||||||
|
*/
|
||||||
|
private Long sampleTagId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.tashow.cloud.ai.dal.dataobject.dialog;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ai-对话 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("tz_ai_dialog")
|
||||||
|
@KeySequence("tz_ai_dialog_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AiDialogDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 对话标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 对话状态(1active, 2archived, 3deleted)
|
||||||
|
*/
|
||||||
|
private Integer dialogStatus;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package com.tashow.cloud.ai.dal.dataobject.dialog;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ai-对话消息 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("tz_ai_dialog_message")
|
||||||
|
@KeySequence("tz_ai_dialog_message_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AiDialogMessageDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 对话id
|
||||||
|
*/
|
||||||
|
private Long dialogId;
|
||||||
|
/**
|
||||||
|
* 内容
|
||||||
|
*/
|
||||||
|
private String contentText;
|
||||||
|
/**
|
||||||
|
* 文件名
|
||||||
|
*/
|
||||||
|
private String fileName;
|
||||||
|
/**
|
||||||
|
* 文件类型
|
||||||
|
*/
|
||||||
|
private String fileType;
|
||||||
|
/**
|
||||||
|
* 文件时长
|
||||||
|
*/
|
||||||
|
private Long contentDuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文本类型(1text,2image,3file,4audio)
|
||||||
|
*/
|
||||||
|
private Integer contentType;
|
||||||
|
/**
|
||||||
|
* 对话中的顺序
|
||||||
|
*/
|
||||||
|
private Integer messageOrder;
|
||||||
|
/**
|
||||||
|
* 消息状态 1正常 0删除
|
||||||
|
*/
|
||||||
|
private Integer messageStatus;
|
||||||
|
/**
|
||||||
|
* 宠物id
|
||||||
|
*/
|
||||||
|
private Long petId;
|
||||||
|
/**
|
||||||
|
* 宠物名称
|
||||||
|
*/
|
||||||
|
private String petName;
|
||||||
|
/**
|
||||||
|
* 宠物头像
|
||||||
|
*/
|
||||||
|
private String petAvatar;
|
||||||
|
/**
|
||||||
|
* 宠物类型
|
||||||
|
*/
|
||||||
|
private String petType;
|
||||||
|
/**
|
||||||
|
* 原始结果
|
||||||
|
*/
|
||||||
|
private String sourceResult;
|
||||||
|
/**
|
||||||
|
* 翻译结果
|
||||||
|
*/
|
||||||
|
private String transResult;
|
||||||
|
/**
|
||||||
|
* 翻译结果
|
||||||
|
*/
|
||||||
|
private Integer transStatus;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
private Integer emotion;
|
||||||
|
private String terminal;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
package com.tashow.cloud.ai.dal.dataobject;
|
||||||
|
// 数据库对象
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.tashow.cloud.ai.dal.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum EmotionEnums {
|
||||||
|
|
||||||
|
XF(1,"兴奋/玩耍","兴奋"),
|
||||||
|
PJ(2,"平静/放松","平静"),
|
||||||
|
je(3,"乞求/饥饿/口渴","饥饿"),
|
||||||
|
yk(4,"愉快/满足","愉快"),
|
||||||
|
tt(5,"疼痛/沮丧","疼痛"),
|
||||||
|
kj(6,"恐惧/不安","恐惧"),
|
||||||
|
hq(7,"问候/好奇","好奇"),
|
||||||
|
ng(8,"难过/焦虑","难过"),
|
||||||
|
fn(9,"愤怒/警告","愤怒"),
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer code;
|
||||||
|
private String name;
|
||||||
|
private String aiName;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.tashow.cloud.ai.dal.mysql.aisample;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSamplePageReqVO;
|
||||||
|
import com.tashow.cloud.ai.dal.dataobject.aisample.AiSampleDO;
|
||||||
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
|
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样本库 Mapper
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface AiSampleMapper extends BaseMapperX<AiSampleDO> {
|
||||||
|
|
||||||
|
default PageResult<AiSampleDO> selectPage(AiSamplePageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<AiSampleDO>()
|
||||||
|
.likeIfPresent(AiSampleDO::getSampleName, reqVO.getSampleName())
|
||||||
|
.orderByDesc(AiSampleDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Select("<script>" +
|
||||||
|
"SELECT t.id, t.sample_file_path sampleFilePath,t.sample_name sampleName,t.sample_time sampleTime" +
|
||||||
|
",sample_mine_type sampleMineType ,sample_size sampleSize, remark,creator,updater,create_time createTime" +
|
||||||
|
",update_time updateTime,deleted,tenant_id tenantId " +
|
||||||
|
"FROM tz_ai_sample t " +
|
||||||
|
"INNER JOIN tz_ai_sample_tag_relate r ON t.id = r.sample_id " +
|
||||||
|
"<where>" +
|
||||||
|
" <if test=\"pageReqVO.tagIds != null and pageReqVO.tagIds != ''\">" +
|
||||||
|
" AND FIND_IN_SET(r.sample_tag_id,${pageReqVO.tagIds}) " +
|
||||||
|
" </if>" +
|
||||||
|
" <if test=\"pageReqVO.sampleName != null and pageReqVO.sampleName != ''\">" +
|
||||||
|
" AND t.sample_name LIKE CONCAT('%',#{pageReqVO.sampleName},'%')" +
|
||||||
|
" </if>" +
|
||||||
|
"</where>" +
|
||||||
|
"ORDER BY t.id DESC" +
|
||||||
|
"</script>")
|
||||||
|
IPage<AiSampleDO> getAiSamplePage(Page<AiSampleDO> objectPage, AiSamplePageReqVO pageReqVO);
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.tashow.cloud.ai.dal.mysql.aisample;
|
||||||
|
|
||||||
|
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSampleTagGroupPageReqVO;
|
||||||
|
import com.tashow.cloud.ai.dal.dataobject.aisample.AiSampleTagGroupDO;
|
||||||
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
|
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样本标签分组库 Mapper
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface AiSampleTagGroupMapper extends BaseMapperX<AiSampleTagGroupDO> {
|
||||||
|
|
||||||
|
default PageResult<AiSampleTagGroupDO> selectPage(AiSampleTagGroupPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<AiSampleTagGroupDO>()
|
||||||
|
.likeIfPresent(AiSampleTagGroupDO::getGroupName, reqVO.getGroupName())
|
||||||
|
.betweenIfPresent(AiSampleTagGroupDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(AiSampleTagGroupDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.tashow.cloud.ai.dal.mysql.aisample;
|
||||||
|
|
||||||
|
import com.tashow.cloud.ai.dal.dataobject.aisample.AiSampleTagGroupRelateDO;
|
||||||
|
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样本标签-分组关联 Mapper
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface AiSampleTagGroupRelateMapper extends BaseMapperX<AiSampleTagGroupRelateDO> {
|
||||||
|
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user