更换用户和商铺id为雪花id
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.xiaowang.yuminailcore.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
@@ -14,10 +16,16 @@ import lombok.EqualsAndHashCode;
|
||||
* @date 2026-02-13
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("t_shop")
|
||||
public class ShopDO extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 店铺唯一主键ID(雪花ID)
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 店铺名称
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.xiaowang.yuminailcore.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
@@ -14,10 +16,16 @@ import lombok.EqualsAndHashCode;
|
||||
* @date 2026-02-13
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("t_user")
|
||||
public class UserDO extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 用户唯一主键ID(雪花ID)
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 所属店铺ID,关联店铺表主键(0表示无所属店铺)
|
||||
*/
|
||||
|
||||
@@ -190,7 +190,7 @@ create index idx_title
|
||||
-- 店铺信息表
|
||||
create table t_shop
|
||||
(
|
||||
id bigint unsigned auto_increment comment '店铺唯一主键ID'
|
||||
id bigint unsigned comment '店铺唯一主键ID(雪花ID)'
|
||||
primary key comment '店铺主键索引',
|
||||
shop_name varchar(100) not null comment '店铺名称',
|
||||
description text null comment '店铺描述',
|
||||
@@ -230,7 +230,7 @@ create table t_tag
|
||||
-- 系统用户信息表
|
||||
create table t_user
|
||||
(
|
||||
id bigint unsigned auto_increment comment '用户唯一主键ID(雪花ID)'
|
||||
id bigint unsigned comment '用户唯一主键ID(雪花ID)'
|
||||
primary key comment '用户主键索引',
|
||||
shop_id bigint unsigned default 0 null comment '所属店铺ID,关联店铺表主键(0表示无所属店铺)',
|
||||
nickname varchar(50) not null comment '用户昵称',
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
-- 创建数据库
|
||||
CREATE DATABASE IF NOT EXISTS yuminail DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
USE yuminail;
|
||||
|
||||
-- 商品收藏表
|
||||
create table t_wishlist
|
||||
(
|
||||
id bigint unsigned auto_increment comment '收藏记录唯一主键ID'
|
||||
primary key comment '商品收藏主键索引',
|
||||
user_id bigint unsigned not null comment '关联用户表主键',
|
||||
product_id bigint unsigned not null comment '关联商品表主键',
|
||||
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删除,1-已删除',
|
||||
constraint uk_user_product
|
||||
unique (user_id, product_id) comment '用户-商品唯一索引'
|
||||
) comment '商品收藏表';
|
||||
|
||||
create index idx_user_id
|
||||
on t_wishlist (user_id) comment '按用户查询收藏的索引';
|
||||
|
||||
create index idx_product_id
|
||||
on t_wishlist (product_id) comment '按商品查询收藏的索引';
|
||||
Reference in New Issue
Block a user