初始化v1
This commit is contained in:
5
target/classes/application-dev.yml
Normal file
5
target/classes/application-dev.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/nl_shop?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
47
target/classes/application.yml
Normal file
47
target/classes/application.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
server:
|
||||
port: 14001
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: nl-shop
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/z_wb_nc_shop?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: root
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password: redis_pBjaRs
|
||||
timeout: 3000ms
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 8
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
servlet:
|
||||
multipart:
|
||||
enabled: true
|
||||
max-file-size: 10MB
|
||||
max-request-size: 10MB
|
||||
thymeleaf:
|
||||
prefix: classpath:/templates/
|
||||
suffix: .html
|
||||
mode: HTML
|
||||
encoding: UTF-8
|
||||
cache: false
|
||||
|
||||
mybatis:
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
type-aliases-package: com.nlshop.entity
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
pagehelper:
|
||||
helper-dialect: mysql
|
||||
reasonable: true
|
||||
support-methods-arguments: true
|
||||
|
||||
file:
|
||||
upload-path: ${user.dir}/src/main/resources/static/upload
|
||||
BIN
target/classes/com/nlshop/NlShopApplication.class
Normal file
BIN
target/classes/com/nlshop/NlShopApplication.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/config/StartupUrlPrinter.class
Normal file
BIN
target/classes/com/nlshop/config/StartupUrlPrinter.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/config/WebMvcConfig.class
Normal file
BIN
target/classes/com/nlshop/config/WebMvcConfig.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/com/nlshop/controller/user/CartController.class
Normal file
BIN
target/classes/com/nlshop/controller/user/CartController.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/classes/com/nlshop/controller/user/OrderController.class
Normal file
BIN
target/classes/com/nlshop/controller/user/OrderController.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/com/nlshop/controller/user/ReviewController.class
Normal file
BIN
target/classes/com/nlshop/controller/user/ReviewController.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/controller/user/UserController.class
Normal file
BIN
target/classes/com/nlshop/controller/user/UserController.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/dto/request/CartAddRequest.class
Normal file
BIN
target/classes/com/nlshop/dto/request/CartAddRequest.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/dto/request/LoginRequest.class
Normal file
BIN
target/classes/com/nlshop/dto/request/LoginRequest.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/classes/com/nlshop/dto/request/OrderCreateRequest.class
Normal file
BIN
target/classes/com/nlshop/dto/request/OrderCreateRequest.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/dto/request/PaymentRequest.class
Normal file
BIN
target/classes/com/nlshop/dto/request/PaymentRequest.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/dto/request/UserRegisterRequest.class
Normal file
BIN
target/classes/com/nlshop/dto/request/UserRegisterRequest.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/dto/response/ApiResponse.class
Normal file
BIN
target/classes/com/nlshop/dto/response/ApiResponse.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/dto/response/LoginResponse.class
Normal file
BIN
target/classes/com/nlshop/dto/response/LoginResponse.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/dto/response/OrderDetailResponse.class
Normal file
BIN
target/classes/com/nlshop/dto/response/OrderDetailResponse.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/dto/response/PageResponse.class
Normal file
BIN
target/classes/com/nlshop/dto/response/PageResponse.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/Announcement.class
Normal file
BIN
target/classes/com/nlshop/entity/Announcement.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/CartItem.class
Normal file
BIN
target/classes/com/nlshop/entity/CartItem.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/Inventory.class
Normal file
BIN
target/classes/com/nlshop/entity/Inventory.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/InventoryLog.class
Normal file
BIN
target/classes/com/nlshop/entity/InventoryLog.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/Merchant.class
Normal file
BIN
target/classes/com/nlshop/entity/Merchant.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/Message.class
Normal file
BIN
target/classes/com/nlshop/entity/Message.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/Order.class
Normal file
BIN
target/classes/com/nlshop/entity/Order.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/OrderItem.class
Normal file
BIN
target/classes/com/nlshop/entity/OrderItem.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/OrderTrack.class
Normal file
BIN
target/classes/com/nlshop/entity/OrderTrack.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/Product.class
Normal file
BIN
target/classes/com/nlshop/entity/Product.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/ProductCustom.class
Normal file
BIN
target/classes/com/nlshop/entity/ProductCustom.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/ProductSpec.class
Normal file
BIN
target/classes/com/nlshop/entity/ProductSpec.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/ProductTopping.class
Normal file
BIN
target/classes/com/nlshop/entity/ProductTopping.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/Review.class
Normal file
BIN
target/classes/com/nlshop/entity/Review.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/User.class
Normal file
BIN
target/classes/com/nlshop/entity/User.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/UserAddress.class
Normal file
BIN
target/classes/com/nlshop/entity/UserAddress.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/UserBehavior.class
Normal file
BIN
target/classes/com/nlshop/entity/UserBehavior.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/entity/UserSimilarity.class
Normal file
BIN
target/classes/com/nlshop/entity/UserSimilarity.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/exception/BusinessException.class
Normal file
BIN
target/classes/com/nlshop/exception/BusinessException.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/exception/GlobalExceptionHandler.class
Normal file
BIN
target/classes/com/nlshop/exception/GlobalExceptionHandler.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/interceptor/AuthInterceptor.class
Normal file
BIN
target/classes/com/nlshop/interceptor/AuthInterceptor.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/AnnouncementMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/AnnouncementMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/CartMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/CartMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/InventoryLogMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/InventoryLogMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/InventoryMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/InventoryMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/MerchantMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/MerchantMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/MessageMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/MessageMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/OrderItemMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/OrderItemMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/OrderMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/OrderMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/OrderTrackMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/OrderTrackMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/ProductCustomMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/ProductCustomMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/ProductMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/ProductMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/ProductSpecMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/ProductSpecMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/ProductToppingMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/ProductToppingMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/ReviewMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/ReviewMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/UserAddressMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/UserAddressMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/UserBehaviorMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/UserBehaviorMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/UserMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/UserMapper.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/mapper/UserSimilarityMapper.class
Normal file
BIN
target/classes/com/nlshop/mapper/UserSimilarityMapper.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/com/nlshop/service/merchant/MerchantService.class
Normal file
BIN
target/classes/com/nlshop/service/merchant/MerchantService.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/service/merchant/MessageService.class
Normal file
BIN
target/classes/com/nlshop/service/merchant/MessageService.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/com/nlshop/service/merchant/ReviewService.class
Normal file
BIN
target/classes/com/nlshop/service/merchant/ReviewService.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/com/nlshop/service/user/CartService.class
Normal file
BIN
target/classes/com/nlshop/service/user/CartService.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/service/user/MessageService.class
Normal file
BIN
target/classes/com/nlshop/service/user/MessageService.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/service/user/OrderService$1.class
Normal file
BIN
target/classes/com/nlshop/service/user/OrderService$1.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/service/user/OrderService$2.class
Normal file
BIN
target/classes/com/nlshop/service/user/OrderService$2.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/service/user/OrderService.class
Normal file
BIN
target/classes/com/nlshop/service/user/OrderService.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/service/user/ProductService.class
Normal file
BIN
target/classes/com/nlshop/service/user/ProductService.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/service/user/RecommendService.class
Normal file
BIN
target/classes/com/nlshop/service/user/RecommendService.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/service/user/UserService.class
Normal file
BIN
target/classes/com/nlshop/service/user/UserService.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/util/FileUploadUtil.class
Normal file
BIN
target/classes/com/nlshop/util/FileUploadUtil.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/util/OrderNoUtil.class
Normal file
BIN
target/classes/com/nlshop/util/OrderNoUtil.class
Normal file
Binary file not shown.
BIN
target/classes/com/nlshop/util/PasswordUtil.class
Normal file
BIN
target/classes/com/nlshop/util/PasswordUtil.class
Normal file
Binary file not shown.
248
target/classes/db/schema.sql
Normal file
248
target/classes/db/schema.sql
Normal file
@@ -0,0 +1,248 @@
|
||||
-- 奶茶店管理系统数据库表结构
|
||||
|
||||
-- 用户表
|
||||
CREATE TABLE IF NOT EXISTS `user` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`username` VARCHAR(50) UNIQUE NOT NULL COMMENT '用户名',
|
||||
`password` VARCHAR(255) NOT NULL COMMENT '密码(加密)',
|
||||
`name` VARCHAR(50) COMMENT '姓名',
|
||||
`gender` TINYINT COMMENT '性别:0-女,1-男',
|
||||
`phone` VARCHAR(20) COMMENT '手机号',
|
||||
`email` VARCHAR(100) COMMENT '邮箱',
|
||||
`avatar` VARCHAR(255) COMMENT '头像路径',
|
||||
`address` VARCHAR(255) COMMENT '默认地址',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表';
|
||||
|
||||
-- 用户地址表
|
||||
CREATE TABLE IF NOT EXISTS `user_address` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`user_id` BIGINT NOT NULL COMMENT '用户ID',
|
||||
`address` VARCHAR(255) NOT NULL COMMENT '详细地址',
|
||||
`contact_name` VARCHAR(50) COMMENT '联系人姓名',
|
||||
`contact_phone` VARCHAR(20) COMMENT '联系人电话',
|
||||
`is_default` TINYINT DEFAULT 0 COMMENT '是否默认:0-否,1-是',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户地址表';
|
||||
|
||||
-- 商家表
|
||||
CREATE TABLE IF NOT EXISTS `merchant` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`username` VARCHAR(50) UNIQUE NOT NULL COMMENT '用户名',
|
||||
`password` VARCHAR(255) NOT NULL COMMENT '密码(加密)',
|
||||
`store_name` VARCHAR(100) NOT NULL COMMENT '门店名称',
|
||||
`address` VARCHAR(255) COMMENT '门店地址',
|
||||
`phone` VARCHAR(20) COMMENT '联系电话',
|
||||
`email` VARCHAR(100) COMMENT '邮箱',
|
||||
`manager_name` VARCHAR(50) COMMENT '负责人姓名',
|
||||
`avatar` VARCHAR(255) COMMENT '头像路径',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
`update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商家表';
|
||||
|
||||
-- 商品表
|
||||
CREATE TABLE IF NOT EXISTS `product` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`merchant_id` BIGINT NOT NULL COMMENT '商家ID',
|
||||
`name` VARCHAR(100) NOT NULL COMMENT '商品名称',
|
||||
`category` VARCHAR(50) COMMENT '分类',
|
||||
`description` TEXT COMMENT '商品描述',
|
||||
`base_price` DECIMAL(10,2) NOT NULL COMMENT '基础价格',
|
||||
`image` VARCHAR(255) COMMENT '商品图片',
|
||||
`status` TINYINT DEFAULT 1 COMMENT '状态:0-下架,1-上架',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (`merchant_id`) REFERENCES `merchant`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品表';
|
||||
|
||||
-- 商品规格表
|
||||
CREATE TABLE IF NOT EXISTS `product_spec` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`product_id` BIGINT NOT NULL COMMENT '商品ID',
|
||||
`spec_name` VARCHAR(50) NOT NULL COMMENT '规格名称(大杯/中杯/小杯)',
|
||||
`price_adjust` DECIMAL(10,2) DEFAULT 0 COMMENT '价格调整(相对于基础价格)',
|
||||
FOREIGN KEY (`product_id`) REFERENCES `product`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品规格表';
|
||||
|
||||
-- 配料表
|
||||
CREATE TABLE IF NOT EXISTS `product_topping` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`product_id` BIGINT NOT NULL COMMENT '商品ID',
|
||||
`topping_name` VARCHAR(50) NOT NULL COMMENT '配料名称',
|
||||
`price` DECIMAL(10,2) DEFAULT 0 COMMENT '配料价格',
|
||||
FOREIGN KEY (`product_id`) REFERENCES `product`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配料表';
|
||||
|
||||
-- 商品定制选项表
|
||||
CREATE TABLE IF NOT EXISTS `product_custom` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`product_id` BIGINT NOT NULL COMMENT '商品ID',
|
||||
`option_type` VARCHAR(20) NOT NULL COMMENT '选项类型:sweetness-甜度,ice-冰度',
|
||||
`option_value` VARCHAR(50) NOT NULL COMMENT '选项值',
|
||||
`price_adjust` DECIMAL(10,2) DEFAULT 0 COMMENT '价格调整',
|
||||
FOREIGN KEY (`product_id`) REFERENCES `product`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品定制选项表';
|
||||
|
||||
-- 购物车表
|
||||
CREATE TABLE IF NOT EXISTS `cart` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`user_id` BIGINT NOT NULL COMMENT '用户ID',
|
||||
`product_id` BIGINT NOT NULL COMMENT '商品ID',
|
||||
`spec_id` BIGINT COMMENT '规格ID',
|
||||
`quantity` INT DEFAULT 1 COMMENT '数量',
|
||||
`custom_sweetness` VARCHAR(20) COMMENT '甜度定制',
|
||||
`custom_ice` VARCHAR(20) COMMENT '冰度定制',
|
||||
`toppings` TEXT COMMENT '配料JSON',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`product_id`) REFERENCES `product`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='购物车表';
|
||||
|
||||
-- 订单表
|
||||
CREATE TABLE IF NOT EXISTS `order` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`order_no` VARCHAR(50) UNIQUE NOT NULL COMMENT '订单号',
|
||||
`user_id` BIGINT NOT NULL COMMENT '用户ID',
|
||||
`merchant_id` BIGINT NOT NULL COMMENT '商家ID',
|
||||
`total_amount` DECIMAL(10,2) NOT NULL COMMENT '订单总金额',
|
||||
`payment_method` VARCHAR(20) COMMENT '支付方式:wechat/alipay',
|
||||
`payment_status` TINYINT DEFAULT 0 COMMENT '支付状态:0-未支付,1-已支付',
|
||||
`order_status` VARCHAR(20) DEFAULT 'PENDING_PAY' COMMENT '订单状态:PENDING_PAY-待支付,MAKING-制作中,READY-待取餐,COMPLETED-已完成,CANCELLED-已取消',
|
||||
`address` VARCHAR(255) NOT NULL COMMENT '收货地址',
|
||||
`contact_phone` VARCHAR(20) NOT NULL COMMENT '联系电话',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`pay_time` DATETIME COMMENT '支付时间',
|
||||
`complete_time` DATETIME COMMENT '完成时间',
|
||||
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`),
|
||||
FOREIGN KEY (`merchant_id`) REFERENCES `merchant`(`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单表';
|
||||
|
||||
-- 订单明细表
|
||||
CREATE TABLE IF NOT EXISTS `order_item` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`order_id` BIGINT NOT NULL COMMENT '订单ID',
|
||||
`product_id` BIGINT NOT NULL COMMENT '商品ID',
|
||||
`product_name` VARCHAR(100) NOT NULL COMMENT '商品名称',
|
||||
`spec_name` VARCHAR(50) COMMENT '规格名称',
|
||||
`quantity` INT NOT NULL COMMENT '数量',
|
||||
`price` DECIMAL(10,2) NOT NULL COMMENT '单价',
|
||||
`custom_sweetness` VARCHAR(20) COMMENT '甜度',
|
||||
`custom_ice` VARCHAR(20) COMMENT '冰度',
|
||||
`toppings` TEXT COMMENT '配料JSON',
|
||||
`subtotal` DECIMAL(10,2) NOT NULL COMMENT '小计',
|
||||
FOREIGN KEY (`order_id`) REFERENCES `order`(`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`product_id`) REFERENCES `product`(`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单明细表';
|
||||
|
||||
-- 订单跟踪表
|
||||
CREATE TABLE IF NOT EXISTS `order_track` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`order_id` BIGINT NOT NULL COMMENT '订单ID',
|
||||
`status` VARCHAR(20) NOT NULL COMMENT '状态',
|
||||
`description` VARCHAR(255) COMMENT '描述',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (`order_id`) REFERENCES `order`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单跟踪表';
|
||||
|
||||
-- 公告表
|
||||
CREATE TABLE IF NOT EXISTS `announcement` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`merchant_id` BIGINT NOT NULL COMMENT '商家ID',
|
||||
`title` VARCHAR(200) NOT NULL COMMENT '标题',
|
||||
`content` TEXT COMMENT '内容',
|
||||
`type` VARCHAR(20) DEFAULT 'NOTICE' COMMENT '类型:ACTIVITY-活动,NOTICE-通知',
|
||||
`status` TINYINT DEFAULT 1 COMMENT '状态:0-下架,1-发布',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (`merchant_id`) REFERENCES `merchant`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='公告表';
|
||||
|
||||
-- 留言反馈表
|
||||
CREATE TABLE IF NOT EXISTS `message` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`user_id` BIGINT NOT NULL COMMENT '用户ID',
|
||||
`merchant_id` BIGINT NOT NULL COMMENT '商家ID',
|
||||
`order_id` BIGINT COMMENT '订单ID',
|
||||
`content` TEXT NOT NULL COMMENT '留言内容',
|
||||
`reply` TEXT COMMENT '回复内容',
|
||||
`status` TINYINT DEFAULT 0 COMMENT '状态:0-未回复,1-已回复',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
`reply_time` DATETIME COMMENT '回复时间',
|
||||
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`),
|
||||
FOREIGN KEY (`merchant_id`) REFERENCES `merchant`(`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='留言反馈表';
|
||||
|
||||
-- 评价表
|
||||
CREATE TABLE IF NOT EXISTS `review` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`user_id` BIGINT NOT NULL COMMENT '用户ID',
|
||||
`order_id` BIGINT NOT NULL COMMENT '订单ID',
|
||||
`product_id` BIGINT NOT NULL COMMENT '商品ID',
|
||||
`rating` TINYINT NOT NULL COMMENT '评分:1-5',
|
||||
`content` TEXT COMMENT '评价内容',
|
||||
`reply` TEXT COMMENT '商家回复',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`),
|
||||
FOREIGN KEY (`order_id`) REFERENCES `order`(`id`),
|
||||
FOREIGN KEY (`product_id`) REFERENCES `product`(`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='评价表';
|
||||
|
||||
-- 库存表
|
||||
CREATE TABLE IF NOT EXISTS `inventory` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`merchant_id` BIGINT NOT NULL COMMENT '商家ID',
|
||||
`material_name` VARCHAR(100) NOT NULL COMMENT '原料名称',
|
||||
`quantity` DECIMAL(10,2) NOT NULL COMMENT '数量',
|
||||
`unit` VARCHAR(20) COMMENT '单位',
|
||||
`min_threshold` DECIMAL(10,2) DEFAULT 0 COMMENT '最低库存阈值',
|
||||
`last_in_time` DATETIME COMMENT '最后入库时间',
|
||||
`last_out_time` DATETIME COMMENT '最后出库时间',
|
||||
FOREIGN KEY (`merchant_id`) REFERENCES `merchant`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库存表';
|
||||
|
||||
-- 库存操作日志表
|
||||
CREATE TABLE IF NOT EXISTS `inventory_log` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`inventory_id` BIGINT NOT NULL COMMENT '库存ID',
|
||||
`operation_type` VARCHAR(20) NOT NULL COMMENT '操作类型:IN-入库,OUT-出库',
|
||||
`quantity` DECIMAL(10,2) NOT NULL COMMENT '操作数量',
|
||||
`operator` VARCHAR(50) COMMENT '操作人',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (`inventory_id`) REFERENCES `inventory`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库存操作日志表';
|
||||
|
||||
-- 用户行为表(用于协同过滤)
|
||||
CREATE TABLE IF NOT EXISTS `user_behavior` (
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
`user_id` BIGINT NOT NULL COMMENT '用户ID',
|
||||
`product_id` BIGINT NOT NULL COMMENT '商品ID',
|
||||
`behavior_type` VARCHAR(20) NOT NULL COMMENT '行为类型:VIEW-浏览,PURCHASE-购买,RATING-评分',
|
||||
`score` DECIMAL(5,2) DEFAULT 0 COMMENT '评分(0-5)',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`product_id`) REFERENCES `product`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户行为表';
|
||||
|
||||
-- 用户相似度缓存表(可选)
|
||||
CREATE TABLE IF NOT EXISTS `user_similarity` (
|
||||
`user1_id` BIGINT NOT NULL COMMENT '用户1ID',
|
||||
`user2_id` BIGINT NOT NULL COMMENT '用户2ID',
|
||||
`similarity_score` DECIMAL(10,6) NOT NULL COMMENT '相似度分数',
|
||||
`update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`user1_id`, `user2_id`),
|
||||
FOREIGN KEY (`user1_id`) REFERENCES `user`(`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`user2_id`) REFERENCES `user`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户相似度缓存表';
|
||||
|
||||
-- 创建索引
|
||||
CREATE INDEX idx_user_username ON `user`(`username`);
|
||||
CREATE INDEX idx_merchant_username ON `merchant`(`username`);
|
||||
CREATE INDEX idx_product_merchant ON `product`(`merchant_id`);
|
||||
CREATE INDEX idx_product_status ON `product`(`status`);
|
||||
CREATE INDEX idx_cart_user ON `cart`(`user_id`);
|
||||
CREATE INDEX idx_order_user ON `order`(`user_id`);
|
||||
CREATE INDEX idx_order_merchant ON `order`(`merchant_id`);
|
||||
CREATE INDEX idx_order_status ON `order`(`order_status`);
|
||||
CREATE INDEX idx_order_no ON `order`(`order_no`);
|
||||
CREATE INDEX idx_user_behavior_user ON `user_behavior`(`user_id`);
|
||||
CREATE INDEX idx_user_behavior_product ON `user_behavior`(`product_id`);
|
||||
45
target/classes/mapper/AnnouncementMapper.xml
Normal file
45
target/classes/mapper/AnnouncementMapper.xml
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nlshop.mapper.AnnouncementMapper">
|
||||
<resultMap id="BaseResultMap" type="com.nlshop.entity.Announcement">
|
||||
<id column="id" property="id"/>
|
||||
<result column="merchant_id" property="merchantId"/>
|
||||
<result column="title" property="title"/>
|
||||
<result column="content" property="content"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert" parameterType="com.nlshop.entity.Announcement" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO announcement (merchant_id, title, content, type, status)
|
||||
VALUES (#{merchantId}, #{title}, #{content}, #{type}, #{status})
|
||||
</insert>
|
||||
|
||||
<select id="selectByMerchantId" resultMap="BaseResultMap">
|
||||
SELECT * FROM announcement WHERE merchant_id = #{merchantId} ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectPublished" resultMap="BaseResultMap">
|
||||
SELECT * FROM announcement WHERE status = 1 ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
SELECT * FROM announcement WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<update id="update" parameterType="com.nlshop.entity.Announcement">
|
||||
UPDATE announcement
|
||||
<set>
|
||||
<if test="title != null">title = #{title},</if>
|
||||
<if test="content != null">content = #{content},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE FROM announcement WHERE id = #{id}
|
||||
</delete>
|
||||
</mapper>
|
||||
95
target/classes/mapper/CartMapper.xml
Normal file
95
target/classes/mapper/CartMapper.xml
Normal file
@@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nlshop.mapper.CartMapper">
|
||||
<resultMap id="BaseResultMap" type="com.nlshop.entity.CartItem">
|
||||
<id column="id" property="id"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="product_id" property="productId"/>
|
||||
<result column="spec_id" property="specId"/>
|
||||
<result column="quantity" property="quantity"/>
|
||||
<result column="custom_sweetness" property="customSweetness"/>
|
||||
<result column="custom_ice" property="customIce"/>
|
||||
<result column="toppings" property="toppings"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<association property="product" javaType="com.nlshop.entity.Product">
|
||||
<id column="p_id" property="id"/>
|
||||
<result column="p_name" property="name"/>
|
||||
<result column="p_image" property="image"/>
|
||||
<result column="p_base_price" property="basePrice"/>
|
||||
<result column="p_merchant_id" property="merchantId"/>
|
||||
</association>
|
||||
<association property="spec" javaType="com.nlshop.entity.ProductSpec">
|
||||
<id column="s_id" property="id"/>
|
||||
<result column="s_spec_name" property="specName"/>
|
||||
<result column="s_price_adjust" property="priceAdjust"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert" parameterType="com.nlshop.entity.CartItem" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO cart (user_id, product_id, spec_id, quantity, custom_sweetness, custom_ice, toppings)
|
||||
VALUES (#{userId}, #{productId}, #{specId}, #{quantity}, #{customSweetness}, #{customIce}, #{toppings})
|
||||
</insert>
|
||||
|
||||
<select id="selectByUserId" resultMap="BaseResultMap">
|
||||
SELECT c.*,
|
||||
p.id as p_id, p.name as p_name, p.image as p_image, p.base_price as p_base_price, p.merchant_id as p_merchant_id,
|
||||
s.id as s_id, s.spec_name as s_spec_name, s.price_adjust as s_price_adjust
|
||||
FROM cart c
|
||||
LEFT JOIN product p ON c.product_id = p.id
|
||||
LEFT JOIN product_spec s ON c.spec_id = s.id
|
||||
WHERE c.user_id = #{userId}
|
||||
ORDER BY c.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
SELECT c.*,
|
||||
p.id as p_id, p.name as p_name, p.image as p_image, p.base_price as p_base_price, p.merchant_id as p_merchant_id,
|
||||
s.id as s_id, s.spec_name as s_spec_name, s.price_adjust as s_price_adjust
|
||||
FROM cart c
|
||||
LEFT JOIN product p ON c.product_id = p.id
|
||||
LEFT JOIN product_spec s ON c.spec_id = s.id
|
||||
WHERE c.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectByUserAndProduct" resultMap="BaseResultMap">
|
||||
SELECT * FROM cart
|
||||
WHERE user_id = #{userId} AND product_id = #{productId}
|
||||
AND (spec_id = #{specId} OR (#{specId} IS NULL AND spec_id IS NULL))
|
||||
AND (custom_sweetness = #{customSweetness} OR (#{customSweetness} IS NULL AND custom_sweetness IS NULL))
|
||||
AND (custom_ice = #{customIce} OR (#{customIce} IS NULL AND custom_ice IS NULL))
|
||||
AND (toppings = #{toppings} OR (#{toppings} IS NULL AND toppings IS NULL))
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<update id="update" parameterType="com.nlshop.entity.CartItem">
|
||||
UPDATE cart
|
||||
<set>
|
||||
<if test="quantity != null">quantity = #{quantity},</if>
|
||||
<if test="customSweetness != null">custom_sweetness = #{customSweetness},</if>
|
||||
<if test="customIce != null">custom_ice = #{customIce},</if>
|
||||
<if test="toppings != null">toppings = #{toppings},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateQuantity">
|
||||
UPDATE cart SET quantity = #{quantity} WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE FROM cart WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByUserId">
|
||||
DELETE FROM cart WHERE user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBatch">
|
||||
DELETE FROM cart
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
AND user_id = #{userId}
|
||||
</delete>
|
||||
</mapper>
|
||||
21
target/classes/mapper/InventoryLogMapper.xml
Normal file
21
target/classes/mapper/InventoryLogMapper.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nlshop.mapper.InventoryLogMapper">
|
||||
<resultMap id="BaseResultMap" type="com.nlshop.entity.InventoryLog">
|
||||
<id column="id" property="id"/>
|
||||
<result column="inventory_id" property="inventoryId"/>
|
||||
<result column="operation_type" property="operationType"/>
|
||||
<result column="quantity" property="quantity"/>
|
||||
<result column="operator" property="operator"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert" parameterType="com.nlshop.entity.InventoryLog" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO inventory_log (inventory_id, operation_type, quantity, operator)
|
||||
VALUES (#{inventoryId}, #{operationType}, #{quantity}, #{operator})
|
||||
</insert>
|
||||
|
||||
<select id="selectByInventoryId" resultMap="BaseResultMap">
|
||||
SELECT * FROM inventory_log WHERE inventory_id = #{inventoryId} ORDER BY create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
55
target/classes/mapper/InventoryMapper.xml
Normal file
55
target/classes/mapper/InventoryMapper.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nlshop.mapper.InventoryMapper">
|
||||
<resultMap id="BaseResultMap" type="com.nlshop.entity.Inventory">
|
||||
<id column="id" property="id"/>
|
||||
<result column="merchant_id" property="merchantId"/>
|
||||
<result column="material_name" property="materialName"/>
|
||||
<result column="quantity" property="quantity"/>
|
||||
<result column="unit" property="unit"/>
|
||||
<result column="min_threshold" property="minThreshold"/>
|
||||
<result column="last_in_time" property="lastInTime"/>
|
||||
<result column="last_out_time" property="lastOutTime"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert" parameterType="com.nlshop.entity.Inventory" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO inventory (merchant_id, material_name, quantity, unit, min_threshold)
|
||||
VALUES (#{merchantId}, #{materialName}, #{quantity}, #{unit}, #{minThreshold})
|
||||
</insert>
|
||||
|
||||
<select id="selectByMerchantId" resultMap="BaseResultMap">
|
||||
SELECT * FROM inventory WHERE merchant_id = #{merchantId} ORDER BY material_name
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
SELECT * FROM inventory WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectByMerchantAndMaterial" resultMap="BaseResultMap">
|
||||
SELECT * FROM inventory
|
||||
WHERE merchant_id = #{merchantId} AND material_name = #{materialName}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="selectLowStock" resultMap="BaseResultMap">
|
||||
SELECT * FROM inventory
|
||||
WHERE merchant_id = #{merchantId} AND quantity <= min_threshold
|
||||
ORDER BY quantity ASC
|
||||
</select>
|
||||
|
||||
<update id="update" parameterType="com.nlshop.entity.Inventory">
|
||||
UPDATE inventory
|
||||
<set>
|
||||
<if test="quantity != null">quantity = #{quantity},</if>
|
||||
<if test="unit != null">unit = #{unit},</if>
|
||||
<if test="minThreshold != null">min_threshold = #{minThreshold},</if>
|
||||
<if test="lastInTime != null">last_in_time = #{lastInTime},</if>
|
||||
<if test="lastOutTime != null">last_out_time = #{lastOutTime},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE FROM inventory WHERE id = #{id}
|
||||
</delete>
|
||||
</mapper>
|
||||
43
target/classes/mapper/MerchantMapper.xml
Normal file
43
target/classes/mapper/MerchantMapper.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nlshop.mapper.MerchantMapper">
|
||||
<resultMap id="BaseResultMap" type="com.nlshop.entity.Merchant">
|
||||
<id column="id" property="id"/>
|
||||
<result column="username" property="username"/>
|
||||
<result column="password" property="password"/>
|
||||
<result column="store_name" property="storeName"/>
|
||||
<result column="address" property="address"/>
|
||||
<result column="phone" property="phone"/>
|
||||
<result column="email" property="email"/>
|
||||
<result column="manager_name" property="managerName"/>
|
||||
<result column="avatar" property="avatar"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert" parameterType="com.nlshop.entity.Merchant" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO merchant (username, password, store_name, address, phone, email, manager_name, avatar)
|
||||
VALUES (#{username}, #{password}, #{storeName}, #{address}, #{phone}, #{email}, #{managerName}, #{avatar})
|
||||
</insert>
|
||||
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
SELECT * FROM merchant WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectByUsername" resultMap="BaseResultMap">
|
||||
SELECT * FROM merchant WHERE username = #{username}
|
||||
</select>
|
||||
|
||||
<update id="update" parameterType="com.nlshop.entity.Merchant">
|
||||
UPDATE merchant
|
||||
<set>
|
||||
<if test="storeName != null">store_name = #{storeName},</if>
|
||||
<if test="address != null">address = #{address},</if>
|
||||
<if test="phone != null">phone = #{phone},</if>
|
||||
<if test="email != null">email = #{email},</if>
|
||||
<if test="managerName != null">manager_name = #{managerName},</if>
|
||||
<if test="avatar != null">avatar = #{avatar},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
42
target/classes/mapper/MessageMapper.xml
Normal file
42
target/classes/mapper/MessageMapper.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nlshop.mapper.MessageMapper">
|
||||
<resultMap id="BaseResultMap" type="com.nlshop.entity.Message">
|
||||
<id column="id" property="id"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="merchant_id" property="merchantId"/>
|
||||
<result column="order_id" property="orderId"/>
|
||||
<result column="content" property="content"/>
|
||||
<result column="reply" property="reply"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="reply_time" property="replyTime"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert" parameterType="com.nlshop.entity.Message" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO message (user_id, merchant_id, order_id, content, status)
|
||||
VALUES (#{userId}, #{merchantId}, #{orderId}, #{content}, #{status})
|
||||
</insert>
|
||||
|
||||
<select id="selectByUserId" resultMap="BaseResultMap">
|
||||
SELECT * FROM message WHERE user_id = #{userId} ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectByMerchantId" resultMap="BaseResultMap">
|
||||
SELECT * FROM message WHERE merchant_id = #{merchantId} ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
SELECT * FROM message WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<update id="update" parameterType="com.nlshop.entity.Message">
|
||||
UPDATE message
|
||||
<set>
|
||||
<if test="reply != null">reply = #{reply},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="replyTime != null">reply_time = #{replyTime},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
32
target/classes/mapper/OrderItemMapper.xml
Normal file
32
target/classes/mapper/OrderItemMapper.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nlshop.mapper.OrderItemMapper">
|
||||
<resultMap id="BaseResultMap" type="com.nlshop.entity.OrderItem">
|
||||
<id column="id" property="id"/>
|
||||
<result column="order_id" property="orderId"/>
|
||||
<result column="product_id" property="productId"/>
|
||||
<result column="product_name" property="productName"/>
|
||||
<result column="spec_name" property="specName"/>
|
||||
<result column="quantity" property="quantity"/>
|
||||
<result column="price" property="price"/>
|
||||
<result column="custom_sweetness" property="customSweetness"/>
|
||||
<result column="custom_ice" property="customIce"/>
|
||||
<result column="toppings" property="toppings"/>
|
||||
<result column="subtotal" property="subtotal"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert" parameterType="com.nlshop.entity.OrderItem" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO order_item (order_id, product_id, product_name, spec_name, quantity, price,
|
||||
custom_sweetness, custom_ice, toppings, subtotal)
|
||||
VALUES (#{orderId}, #{productId}, #{productName}, #{specName}, #{quantity}, #{price},
|
||||
#{customSweetness}, #{customIce}, #{toppings}, #{subtotal})
|
||||
</insert>
|
||||
|
||||
<select id="selectByOrderId" resultMap="BaseResultMap">
|
||||
SELECT * FROM order_item WHERE order_id = #{orderId}
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
SELECT * FROM order_item WHERE id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user