mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 05:49:20 +08:00
feat: 增加和完善电商模块接口
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ import top.xyquan.ecomdmbbackend.modules.ec.service.OrderService;
|
||||
/**
|
||||
* 订单管理控制器
|
||||
*/
|
||||
@Tag(name = "订单管理", description = "订单的增删改查接口")
|
||||
@Tag(name = "电商-订单管理", description = "订单的增删改查接口")
|
||||
@RestController
|
||||
@RequestMapping("/ec/order")
|
||||
public class OrderController {
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import top.xyquan.ecomdmbbackend.common.response.ApiResponse;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.order.CreateOrderStatusDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.order.UpdateOrderStatusDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.vo.OrderStatusVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.service.OrderStatusService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单状态控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/ec/order-status")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "电商-订单状态管理", description = "订单状态相关接口")
|
||||
public class OrderStatusController {
|
||||
|
||||
private final OrderStatusService orderStatusService;
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "创建订单状态", description = "创建新的订单状态")
|
||||
public ApiResponse<Long> createOrderStatus(@Valid @RequestBody CreateOrderStatusDTO dto) {
|
||||
Long id = orderStatusService.createOrderStatus(dto);
|
||||
return ApiResponse.success(id);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "更新订单状态", description = "更新订单状态信息")
|
||||
public ApiResponse<Void> updateOrderStatus(@Valid @RequestBody UpdateOrderStatusDTO dto) {
|
||||
orderStatusService.updateOrderStatus(dto);
|
||||
return ApiResponse.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@Operation(summary = "删除订单状态", description = "删除指定的订单状态")
|
||||
public ApiResponse<Void> deleteOrderStatus(
|
||||
@Parameter(description = "状态ID", required = true) @PathVariable Long id) {
|
||||
orderStatusService.deleteOrderStatus(id);
|
||||
return ApiResponse.success();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@Operation(summary = "查询订单状态详情", description = "根据ID查询订单状态详情")
|
||||
public ApiResponse<OrderStatusVO> getOrderStatusById(
|
||||
@Parameter(description = "状态ID", required = true) @PathVariable Long id) {
|
||||
OrderStatusVO vo = orderStatusService.getOrderStatusById(id);
|
||||
return ApiResponse.success(vo);
|
||||
}
|
||||
|
||||
@GetMapping("/active")
|
||||
@Operation(summary = "查询启用的订单状态列表", description = "查询所有启用的订单状态")
|
||||
public ApiResponse<List<OrderStatusVO>> getActiveOrderStatusList() {
|
||||
List<OrderStatusVO> list = orderStatusService.getActiveOrderStatusList();
|
||||
return ApiResponse.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
@Operation(summary = "查询所有订单状态列表", description = "查询所有订单状态(包括禁用的)")
|
||||
public ApiResponse<List<OrderStatusVO>> getAllOrderStatusList() {
|
||||
List<OrderStatusVO> list = orderStatusService.getAllOrderStatusList();
|
||||
return ApiResponse.success(list);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -18,7 +18,7 @@ import top.xyquan.ecomdmbbackend.modules.ec.service.ProductService;
|
||||
/**
|
||||
* 商品管理控制器
|
||||
*/
|
||||
@Tag(name = "商品管理", description = "商品的增删改查接口")
|
||||
@Tag(name = "电商-商品管理", description = "商品的增删改查接口")
|
||||
@RestController
|
||||
@RequestMapping("/ec/product")
|
||||
public class ProductController {
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import top.xyquan.ecomdmbbackend.common.response.ApiResponse;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.product.CreateProductSpecDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.product.ProductSpecFilterDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.product.UpdateProductSpecDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.vo.ProductSpecVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.service.ProductSpecService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品规格控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/ec/product-spec")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "电商-商品规格管理", description = "商品规格相关接口")
|
||||
public class ProductSpecController {
|
||||
|
||||
private final ProductSpecService productSpecService;
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "创建商品规格", description = "创建新的商品规格")
|
||||
public ApiResponse<Long> createProductSpec(@Valid @RequestBody CreateProductSpecDTO dto) {
|
||||
Long id = productSpecService.createProductSpec(dto);
|
||||
return ApiResponse.success(id);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "更新商品规格", description = "更新商品规格信息")
|
||||
public ApiResponse<Void> updateProductSpec(@Valid @RequestBody UpdateProductSpecDTO dto) {
|
||||
productSpecService.updateProductSpec(dto);
|
||||
return ApiResponse.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@Operation(summary = "删除商品规格", description = "删除指定的商品规格")
|
||||
public ApiResponse<Void> deleteProductSpec(
|
||||
@Parameter(description = "规格ID", required = true) @PathVariable Long id) {
|
||||
productSpecService.deleteProductSpec(id);
|
||||
return ApiResponse.success();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@Operation(summary = "查询商品规格详情", description = "根据ID查询商品规格详情")
|
||||
public ApiResponse<ProductSpecVO> getProductSpecById(
|
||||
@Parameter(description = "规格ID", required = true) @PathVariable Long id) {
|
||||
ProductSpecVO vo = productSpecService.getProductSpecById(id);
|
||||
return ApiResponse.success(vo);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "分页查询商品规格", description = "分页查询商品规格列表")
|
||||
public ApiResponse<IPage<ProductSpecVO>> getProductSpecPage(
|
||||
@Parameter(description = "页码", example = "1") @RequestParam(defaultValue = "1") Long current,
|
||||
@Parameter(description = "每页大小", example = "10") @RequestParam(defaultValue = "10") Long size,
|
||||
ProductSpecFilterDTO filter) {
|
||||
Page<ProductSpecVO> page = new Page<>(current, size);
|
||||
IPage<ProductSpecVO> result = productSpecService.getProductSpecPage(page, filter);
|
||||
return ApiResponse.success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/product/{productId}")
|
||||
@Operation(summary = "查询商品规格列表", description = "根据商品ID查询规格列表")
|
||||
public ApiResponse<List<ProductSpecVO>> getProductSpecsByProductId(
|
||||
@Parameter(description = "商品ID", required = true) @PathVariable Long productId) {
|
||||
List<ProductSpecVO> list = productSpecService.getProductSpecsByProductId(productId);
|
||||
return ApiResponse.success(list);
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import top.xyquan.ecomdmbbackend.common.response.ApiResponse;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion.CreatePromotionFeeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion.PromotionFeeFilterDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion.UpdatePromotionFeeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.vo.PromotionFeeVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.service.PromotionFeeService;
|
||||
|
||||
/**
|
||||
* 推广费记录控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/ec/promotion-fee")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "电商-推广费记录管理", description = "推广费记录相关接口")
|
||||
public class PromotionFeeController {
|
||||
|
||||
private final PromotionFeeService promotionFeeService;
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "创建推广费记录", description = "创建新的推广费记录")
|
||||
public ApiResponse<Long> createPromotionFee(@Valid @RequestBody CreatePromotionFeeDTO dto) {
|
||||
Long id = promotionFeeService.createPromotionFee(dto);
|
||||
return ApiResponse.success(id);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "更新推广费记录", description = "更新推广费记录信息")
|
||||
public ApiResponse<Void> updatePromotionFee(@Valid @RequestBody UpdatePromotionFeeDTO dto) {
|
||||
promotionFeeService.updatePromotionFee(dto);
|
||||
return ApiResponse.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@Operation(summary = "删除推广费记录", description = "删除指定的推广费记录")
|
||||
public ApiResponse<Void> deletePromotionFee(
|
||||
@Parameter(description = "记录ID", required = true) @PathVariable Long id) {
|
||||
promotionFeeService.deletePromotionFee(id);
|
||||
return ApiResponse.success();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@Operation(summary = "查询推广费记录详情", description = "根据ID查询推广费记录详情")
|
||||
public ApiResponse<PromotionFeeVO> getPromotionFeeById(
|
||||
@Parameter(description = "记录ID", required = true) @PathVariable Long id) {
|
||||
PromotionFeeVO vo = promotionFeeService.getPromotionFeeById(id);
|
||||
return ApiResponse.success(vo);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "分页查询推广费记录", description = "分页查询推广费记录列表")
|
||||
public ApiResponse<IPage<PromotionFeeVO>> getPromotionFeePage(
|
||||
@Parameter(description = "页码", example = "1") @RequestParam(defaultValue = "1") Long current,
|
||||
@Parameter(description = "每页大小", example = "10") @RequestParam(defaultValue = "10") Long size,
|
||||
PromotionFeeFilterDTO filter) {
|
||||
Page<PromotionFeeVO> page = new Page<>(current, size);
|
||||
IPage<PromotionFeeVO> result = promotionFeeService.getPromotionFeePage(page, filter);
|
||||
return ApiResponse.success(result);
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import top.xyquan.ecomdmbbackend.common.response.ApiResponse;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion.CreatePromotionFeeTypeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion.UpdatePromotionFeeTypeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.vo.PromotionFeeTypeVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.service.PromotionFeeTypeService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 推广费类型控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/ec/promotion-fee-type")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "电商-推广费类型管理", description = "推广费类型相关接口")
|
||||
public class PromotionFeeTypeController {
|
||||
|
||||
private final PromotionFeeTypeService promotionFeeTypeService;
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "创建推广费类型", description = "创建新的推广费类型")
|
||||
public ApiResponse<Long> createPromotionFeeType(@Valid @RequestBody CreatePromotionFeeTypeDTO dto) {
|
||||
Long id = promotionFeeTypeService.createPromotionFeeType(dto);
|
||||
return ApiResponse.success(id);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "更新推广费类型", description = "更新推广费类型信息")
|
||||
public ApiResponse<Void> updatePromotionFeeType(@Valid @RequestBody UpdatePromotionFeeTypeDTO dto) {
|
||||
promotionFeeTypeService.updatePromotionFeeType(dto);
|
||||
return ApiResponse.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@Operation(summary = "删除推广费类型", description = "删除指定的推广费类型")
|
||||
public ApiResponse<Void> deletePromotionFeeType(
|
||||
@Parameter(description = "类型ID", required = true) @PathVariable Long id) {
|
||||
promotionFeeTypeService.deletePromotionFeeType(id);
|
||||
return ApiResponse.success();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@Operation(summary = "查询推广费类型详情", description = "根据ID查询推广费类型详情")
|
||||
public ApiResponse<PromotionFeeTypeVO> getPromotionFeeTypeById(
|
||||
@Parameter(description = "类型ID", required = true) @PathVariable Long id) {
|
||||
PromotionFeeTypeVO vo = promotionFeeTypeService.getPromotionFeeTypeById(id);
|
||||
return ApiResponse.success(vo);
|
||||
}
|
||||
|
||||
@GetMapping("/active")
|
||||
@Operation(summary = "查询启用的推广费类型列表", description = "查询所有启用的推广费类型")
|
||||
public ApiResponse<List<PromotionFeeTypeVO>> getActivePromotionFeeTypeList() {
|
||||
List<PromotionFeeTypeVO> list = promotionFeeTypeService.getActivePromotionFeeTypeList();
|
||||
return ApiResponse.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
@Operation(summary = "查询所有推广费类型列表", description = "查询所有推广费类型(包括禁用的)")
|
||||
public ApiResponse<List<PromotionFeeTypeVO>> getAllPromotionFeeTypeList() {
|
||||
List<PromotionFeeTypeVO> list = promotionFeeTypeService.getAllPromotionFeeTypeList();
|
||||
return ApiResponse.success(list);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -18,7 +18,7 @@ import top.xyquan.ecomdmbbackend.modules.ec.service.ShopService;
|
||||
/**
|
||||
* 店铺管理控制器
|
||||
*/
|
||||
@Tag(name = "店铺管理", description = "店铺的增删改查接口")
|
||||
@Tag(name = "电商-店铺管理", description = "店铺的增删改查接口")
|
||||
@RestController
|
||||
@RequestMapping("/ec/shop")
|
||||
public class ShopController {
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.po.OrderStatusPO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单状态Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderStatusMapper extends BaseMapper<OrderStatusPO> {
|
||||
|
||||
/**
|
||||
* 查询启用的订单状态列表
|
||||
*/
|
||||
List<OrderStatusPO> selectActiveStatusList();
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.po.ProductSpecPO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.product.ProductSpecFilterDTO;
|
||||
|
||||
/**
|
||||
* 商品规格Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProductSpecMapper extends BaseMapper<ProductSpecPO> {
|
||||
|
||||
/**
|
||||
* 分页查询商品规格
|
||||
*/
|
||||
IPage<ProductSpecPO> selectPageWithFilter(Page<ProductSpecPO> page, @Param("filter") ProductSpecFilterDTO filter);
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.po.PromotionFeePO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion.PromotionFeeFilterDTO;
|
||||
|
||||
/**
|
||||
* 推广费记录Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface PromotionFeeMapper extends BaseMapper<PromotionFeePO> {
|
||||
|
||||
/**
|
||||
* 分页查询推广费记录
|
||||
*/
|
||||
IPage<PromotionFeePO> selectPageWithFilter(Page<PromotionFeePO> page, @Param("filter") PromotionFeeFilterDTO filter);
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.po.PromotionFeeTypePO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 推广费类型Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface PromotionFeeTypeMapper extends BaseMapper<PromotionFeeTypePO> {
|
||||
|
||||
/**
|
||||
* 查询启用的推广费类型列表
|
||||
*/
|
||||
List<PromotionFeeTypePO> selectActiveTypeList();
|
||||
}
|
||||
+14
-16
@@ -2,7 +2,6 @@ package top.xyquan.ecomdmbbackend.modules.ec.model.dto.order;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
@@ -26,31 +25,30 @@ public class CreateOrderDTO {
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
* 平台订单号
|
||||
*/
|
||||
@Schema(description = "订单号", example = "ORDER202401010001", required = true)
|
||||
@NotBlank(message = "订单号不能为空")
|
||||
private String orderNo;
|
||||
@Schema(description = "平台订单号", example = "TB202401010001")
|
||||
private String platformOrderNo;
|
||||
|
||||
/**
|
||||
* 订单状态 0待发货 1已完成 2已取消
|
||||
* 订单状态ID
|
||||
*/
|
||||
@Schema(description = "订单状态", example = "0", allowableValues = {"0", "1", "2"})
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 订单金额
|
||||
*/
|
||||
@Schema(description = "订单金额", example = "9999.00", required = true)
|
||||
@NotNull(message = "订单金额不能为空")
|
||||
private BigDecimal totalAmount;
|
||||
@Schema(description = "订单状态ID", example = "1")
|
||||
private Long statusId;
|
||||
|
||||
/**
|
||||
* 商家实收金额
|
||||
*/
|
||||
@Schema(description = "商家实收金额", example = "9999.00")
|
||||
@Schema(description = "商家实收金额", example = "9999.00", required = true)
|
||||
@NotNull(message = "商家实收金额不能为空")
|
||||
private BigDecimal receivedAmount;
|
||||
|
||||
/**
|
||||
* 运费
|
||||
*/
|
||||
@Schema(description = "运费", example = "10.00")
|
||||
private BigDecimal shippingFee;
|
||||
|
||||
/**
|
||||
* 下单时间
|
||||
*/
|
||||
|
||||
+26
@@ -22,6 +22,12 @@ public class CreateOrderItemDTO {
|
||||
@NotNull(message = "商品ID不能为空")
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 商品规格ID
|
||||
*/
|
||||
@Schema(description = "商品规格ID", example = "1")
|
||||
private Long productSpecId;
|
||||
|
||||
/**
|
||||
* 商品名称(冗余存储)
|
||||
*/
|
||||
@@ -29,6 +35,12 @@ public class CreateOrderItemDTO {
|
||||
@NotBlank(message = "商品名称不能为空")
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 规格名称(冗余存储)
|
||||
*/
|
||||
@Schema(description = "规格名称", example = "128GB 深空黑色")
|
||||
private String specName;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@@ -44,10 +56,24 @@ public class CreateOrderItemDTO {
|
||||
@NotNull(message = "销售单价不能为空")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/**
|
||||
* 成本价(下单时快照)
|
||||
*/
|
||||
@Schema(description = "成本价", example = "8000.00", required = true)
|
||||
@NotNull(message = "成本价不能为空")
|
||||
private BigDecimal costPrice;
|
||||
|
||||
/**
|
||||
* 小计金额
|
||||
*/
|
||||
@Schema(description = "小计金额", example = "9999.00", required = true)
|
||||
@NotNull(message = "小计金额不能为空")
|
||||
private BigDecimal subtotal;
|
||||
|
||||
/**
|
||||
* 成本小计
|
||||
*/
|
||||
@Schema(description = "成本小计", example = "8000.00", required = true)
|
||||
@NotNull(message = "成本小计不能为空")
|
||||
private BigDecimal costTotal;
|
||||
}
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.dto.order;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 创建订单状态DTO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "创建订单状态DTO")
|
||||
public class CreateOrderStatusDTO {
|
||||
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
@Schema(description = "状态码", example = "0", required = true)
|
||||
@NotNull(message = "状态码不能为空")
|
||||
private Integer statusCode;
|
||||
|
||||
/**
|
||||
* 状态名称
|
||||
*/
|
||||
@Schema(description = "状态名称", example = "待发货", required = true)
|
||||
@NotBlank(message = "状态名称不能为空")
|
||||
private String statusName;
|
||||
|
||||
/**
|
||||
* 状态描述
|
||||
*/
|
||||
@Schema(description = "状态描述", example = "订单已创建,等待发货")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Schema(description = "排序", example = "1")
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
* 是否启用 0禁用 1启用
|
||||
*/
|
||||
@Schema(description = "是否启用", example = "1", allowableValues = {"0", "1"})
|
||||
private Integer isActive;
|
||||
}
|
||||
+12
-12
@@ -20,28 +20,28 @@ public class OrderFilterDTO {
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 订单号(模糊查询)
|
||||
* 平台订单号(模糊查询)
|
||||
*/
|
||||
@Schema(description = "订单号(模糊查询)", example = "ORDER2024")
|
||||
private String orderNo;
|
||||
@Schema(description = "平台订单号(模糊查询)", example = "TB2024")
|
||||
private String platformOrderNo;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
* 订单状态ID
|
||||
*/
|
||||
@Schema(description = "订单状态", example = "0", allowableValues = {"0", "1", "2"})
|
||||
private Integer status;
|
||||
@Schema(description = "订单状态ID", example = "1")
|
||||
private Long statusId;
|
||||
|
||||
/**
|
||||
* 订单金额范围-最小值
|
||||
* 实收金额范围-最小值
|
||||
*/
|
||||
@Schema(description = "订单金额范围-最小值", example = "100.00")
|
||||
private BigDecimal minTotalAmount;
|
||||
@Schema(description = "实收金额范围-最小值", example = "100.00")
|
||||
private BigDecimal minReceivedAmount;
|
||||
|
||||
/**
|
||||
* 订单金额范围-最大值
|
||||
* 实收金额范围-最大值
|
||||
*/
|
||||
@Schema(description = "订单金额范围-最大值", example = "10000.00")
|
||||
private BigDecimal maxTotalAmount;
|
||||
@Schema(description = "实收金额范围-最大值", example = "10000.00")
|
||||
private BigDecimal maxReceivedAmount;
|
||||
|
||||
/**
|
||||
* 下单时间范围-开始时间
|
||||
|
||||
+14
-16
@@ -1,7 +1,6 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.dto.order;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -23,31 +22,30 @@ public class UpdateOrderDTO {
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
* 平台订单号
|
||||
*/
|
||||
@Schema(description = "订单号", example = "ORDER202401010001", required = true)
|
||||
@NotBlank(message = "订单号不能为空")
|
||||
private String orderNo;
|
||||
@Schema(description = "平台订单号", example = "TB202401010001")
|
||||
private String platformOrderNo;
|
||||
|
||||
/**
|
||||
* 订单状态 0待发货 1已完成 2已取消
|
||||
* 订单状态ID
|
||||
*/
|
||||
@Schema(description = "订单状态", example = "0", allowableValues = {"0", "1", "2"})
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 订单金额
|
||||
*/
|
||||
@Schema(description = "订单金额", example = "9999.00", required = true)
|
||||
@NotNull(message = "订单金额不能为空")
|
||||
private BigDecimal totalAmount;
|
||||
@Schema(description = "订单状态ID", example = "1")
|
||||
private Long statusId;
|
||||
|
||||
/**
|
||||
* 商家实收金额
|
||||
*/
|
||||
@Schema(description = "商家实收金额", example = "9999.00")
|
||||
@Schema(description = "商家实收金额", example = "9999.00", required = true)
|
||||
@NotNull(message = "商家实收金额不能为空")
|
||||
private BigDecimal receivedAmount;
|
||||
|
||||
/**
|
||||
* 运费
|
||||
*/
|
||||
@Schema(description = "运费", example = "10.00")
|
||||
private BigDecimal shippingFee;
|
||||
|
||||
/**
|
||||
* 下单时间
|
||||
*/
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.dto.order;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 更新订单状态DTO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "更新订单状态DTO")
|
||||
public class UpdateOrderStatusDTO {
|
||||
|
||||
/**
|
||||
* 状态ID
|
||||
*/
|
||||
@Schema(description = "状态ID", example = "1", required = true)
|
||||
@NotNull(message = "状态ID不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
@Schema(description = "状态码", example = "0", required = true)
|
||||
@NotNull(message = "状态码不能为空")
|
||||
private Integer statusCode;
|
||||
|
||||
/**
|
||||
* 状态名称
|
||||
*/
|
||||
@Schema(description = "状态名称", example = "待发货", required = true)
|
||||
@NotBlank(message = "状态名称不能为空")
|
||||
private String statusName;
|
||||
|
||||
/**
|
||||
* 状态描述
|
||||
*/
|
||||
@Schema(description = "状态描述", example = "订单已创建,等待发货")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Schema(description = "排序", example = "1")
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
* 是否启用 0禁用 1启用
|
||||
*/
|
||||
@Schema(description = "是否启用", example = "1", allowableValues = {"0", "1"})
|
||||
private Integer isActive;
|
||||
}
|
||||
-22
@@ -2,11 +2,8 @@ package top.xyquan.ecomdmbbackend.modules.ec.model.dto.product;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 创建商品DTO
|
||||
*/
|
||||
@@ -21,28 +18,9 @@ public class CreateProductDTO {
|
||||
@NotBlank(message = "商品名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
@Schema(description = "商品编码", example = "IPHONE15PRO001")
|
||||
private String specCode;
|
||||
|
||||
/**
|
||||
* 商品SKU
|
||||
*/
|
||||
@Schema(description = "商品SKU", example = "IPHONE15PRO-128G-BLUE")
|
||||
private String skuCode;
|
||||
|
||||
/**
|
||||
* 主图URL
|
||||
*/
|
||||
@Schema(description = "主图URL", example = "https://example.com/product.jpg")
|
||||
private String mainImage;
|
||||
|
||||
/**
|
||||
* 成本价
|
||||
*/
|
||||
@Schema(description = "成本价", example = "8000.00", required = true)
|
||||
@NotNull(message = "成本价不能为空")
|
||||
private BigDecimal costPrice;
|
||||
}
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.dto.product;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 创建商品规格DTO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "创建商品规格DTO")
|
||||
public class CreateProductSpecDTO {
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
@Schema(description = "商品ID", example = "1", required = true)
|
||||
@NotNull(message = "商品ID不能为空")
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 规格名称
|
||||
*/
|
||||
@Schema(description = "规格名称", example = "128GB 深空黑色", required = true)
|
||||
@NotBlank(message = "规格名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规格编码
|
||||
*/
|
||||
@Schema(description = "规格编码", example = "IPHONE15PRO-128G-BLACK")
|
||||
private String specCode;
|
||||
|
||||
/**
|
||||
* 成本价
|
||||
*/
|
||||
@Schema(description = "成本价", example = "8000.00", required = true)
|
||||
@NotNull(message = "成本价不能为空")
|
||||
private BigDecimal costPrice;
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.dto.product;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 商品规格筛选DTO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "商品规格筛选DTO")
|
||||
public class ProductSpecFilterDTO {
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
@Schema(description = "商品ID", example = "1")
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 规格名称
|
||||
*/
|
||||
@Schema(description = "规格名称", example = "128GB")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规格编码
|
||||
*/
|
||||
@Schema(description = "规格编码", example = "IPHONE15PRO-128G")
|
||||
private String specCode;
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.dto.product;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 更新商品规格DTO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "更新商品规格DTO")
|
||||
public class UpdateProductSpecDTO {
|
||||
|
||||
/**
|
||||
* 规格ID
|
||||
*/
|
||||
@Schema(description = "规格ID", example = "1", required = true)
|
||||
@NotNull(message = "规格ID不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 规格名称
|
||||
*/
|
||||
@Schema(description = "规格名称", example = "128GB 深空黑色", required = true)
|
||||
@NotBlank(message = "规格名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规格编码
|
||||
*/
|
||||
@Schema(description = "规格编码", example = "IPHONE15PRO-128G-BLACK")
|
||||
private String specCode;
|
||||
|
||||
/**
|
||||
* 成本价
|
||||
*/
|
||||
@Schema(description = "成本价", example = "8000.00", required = true)
|
||||
@NotNull(message = "成本价不能为空")
|
||||
private BigDecimal costPrice;
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 创建推广费记录DTO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "创建推广费记录DTO")
|
||||
public class CreatePromotionFeeDTO {
|
||||
|
||||
/**
|
||||
* 店铺ID
|
||||
*/
|
||||
@Schema(description = "店铺ID", example = "1", required = true)
|
||||
@NotNull(message = "店铺ID不能为空")
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 推广费类型ID
|
||||
*/
|
||||
@Schema(description = "推广费类型ID", example = "1", required = true)
|
||||
@NotNull(message = "推广费类型ID不能为空")
|
||||
private Long feeTypeId;
|
||||
|
||||
/**
|
||||
* 推广费名称
|
||||
*/
|
||||
@Schema(description = "推广费名称", example = "直通车推广", required = true)
|
||||
@NotBlank(message = "推广费名称不能为空")
|
||||
private String feeName;
|
||||
|
||||
/**
|
||||
* 平台(淘宝、京东、拼多多等)
|
||||
*/
|
||||
@Schema(description = "平台", example = "淘宝")
|
||||
private String platform;
|
||||
|
||||
/**
|
||||
* 推广活动名称
|
||||
*/
|
||||
@Schema(description = "推广活动名称", example = "双十一大促")
|
||||
private String campaignName;
|
||||
|
||||
/**
|
||||
* 推广费金额
|
||||
*/
|
||||
@Schema(description = "推广费金额", example = "1000.00", required = true)
|
||||
@NotNull(message = "推广费金额不能为空")
|
||||
private BigDecimal feeAmount;
|
||||
|
||||
/**
|
||||
* 基础金额(用于按比例计算)
|
||||
*/
|
||||
@Schema(description = "基础金额", example = "10000.00")
|
||||
private BigDecimal baseAmount;
|
||||
|
||||
/**
|
||||
* 费率(用于按比例计算)
|
||||
*/
|
||||
@Schema(description = "费率", example = "0.05")
|
||||
private BigDecimal feeRate;
|
||||
|
||||
/**
|
||||
* 点击次数
|
||||
*/
|
||||
@Schema(description = "点击次数", example = "1000")
|
||||
private Integer clickCount;
|
||||
|
||||
/**
|
||||
* 展示次数
|
||||
*/
|
||||
@Schema(description = "展示次数", example = "10000")
|
||||
private Integer impressionCount;
|
||||
|
||||
/**
|
||||
* 转化次数
|
||||
*/
|
||||
@Schema(description = "转化次数", example = "50")
|
||||
private Integer conversionCount;
|
||||
|
||||
/**
|
||||
* 推广费发生日期
|
||||
*/
|
||||
@Schema(description = "推广费发生日期", example = "2024-01-01", required = true)
|
||||
@NotNull(message = "推广费发生日期不能为空")
|
||||
private LocalDate feeDate;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注", example = "双十一期间推广费用")
|
||||
private String remark;
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 创建推广费类型DTO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "创建推广费类型DTO")
|
||||
public class CreatePromotionFeeTypeDTO {
|
||||
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
@Schema(description = "类型编码", example = "DIRECT_TRAFFIC", required = true)
|
||||
@NotBlank(message = "类型编码不能为空")
|
||||
private String typeCode;
|
||||
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
@Schema(description = "类型名称", example = "直通车", required = true)
|
||||
@NotBlank(message = "类型名称不能为空")
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 类型描述
|
||||
*/
|
||||
@Schema(description = "类型描述", example = "淘宝直通车推广费用")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 计算方式 1固定金额 2按比例 3按点击 4按展示
|
||||
*/
|
||||
@Schema(description = "计算方式", example = "1", allowableValues = {"1", "2", "3", "4"})
|
||||
private Integer calculationMethod;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Schema(description = "排序", example = "1")
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
* 是否启用 0禁用 1启用
|
||||
*/
|
||||
@Schema(description = "是否启用", example = "1", allowableValues = {"0", "1"})
|
||||
private Integer isActive;
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 推广费记录筛选DTO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "推广费记录筛选DTO")
|
||||
public class PromotionFeeFilterDTO {
|
||||
|
||||
/**
|
||||
* 店铺ID
|
||||
*/
|
||||
@Schema(description = "店铺ID", example = "1")
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 推广费类型ID
|
||||
*/
|
||||
@Schema(description = "推广费类型ID", example = "1")
|
||||
private Long feeTypeId;
|
||||
|
||||
/**
|
||||
* 平台
|
||||
*/
|
||||
@Schema(description = "平台", example = "淘宝")
|
||||
private String platform;
|
||||
|
||||
/**
|
||||
* 推广费发生日期开始
|
||||
*/
|
||||
@Schema(description = "推广费发生日期开始", example = "2024-01-01")
|
||||
private LocalDate feeDateStart;
|
||||
|
||||
/**
|
||||
* 推广费发生日期结束
|
||||
*/
|
||||
@Schema(description = "推广费发生日期结束", example = "2024-01-31")
|
||||
private LocalDate feeDateEnd;
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 更新推广费记录DTO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "更新推广费记录DTO")
|
||||
public class UpdatePromotionFeeDTO {
|
||||
|
||||
/**
|
||||
* 推广费记录ID
|
||||
*/
|
||||
@Schema(description = "推广费记录ID", example = "1", required = true)
|
||||
@NotNull(message = "推广费记录ID不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 店铺ID
|
||||
*/
|
||||
@Schema(description = "店铺ID", example = "1", required = true)
|
||||
@NotNull(message = "店铺ID不能为空")
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 推广费类型ID
|
||||
*/
|
||||
@Schema(description = "推广费类型ID", example = "1", required = true)
|
||||
@NotNull(message = "推广费类型ID不能为空")
|
||||
private Long feeTypeId;
|
||||
|
||||
/**
|
||||
* 推广费名称
|
||||
*/
|
||||
@Schema(description = "推广费名称", example = "直通车推广", required = true)
|
||||
@NotBlank(message = "推广费名称不能为空")
|
||||
private String feeName;
|
||||
|
||||
/**
|
||||
* 平台(淘宝、京东、拼多多等)
|
||||
*/
|
||||
@Schema(description = "平台", example = "淘宝")
|
||||
private String platform;
|
||||
|
||||
/**
|
||||
* 推广活动名称
|
||||
*/
|
||||
@Schema(description = "推广活动名称", example = "双十一大促")
|
||||
private String campaignName;
|
||||
|
||||
/**
|
||||
* 推广费金额
|
||||
*/
|
||||
@Schema(description = "推广费金额", example = "1000.00", required = true)
|
||||
@NotNull(message = "推广费金额不能为空")
|
||||
private BigDecimal feeAmount;
|
||||
|
||||
/**
|
||||
* 基础金额(用于按比例计算)
|
||||
*/
|
||||
@Schema(description = "基础金额", example = "10000.00")
|
||||
private BigDecimal baseAmount;
|
||||
|
||||
/**
|
||||
* 费率(用于按比例计算)
|
||||
*/
|
||||
@Schema(description = "费率", example = "0.05")
|
||||
private BigDecimal feeRate;
|
||||
|
||||
/**
|
||||
* 点击次数
|
||||
*/
|
||||
@Schema(description = "点击次数", example = "1000")
|
||||
private Integer clickCount;
|
||||
|
||||
/**
|
||||
* 展示次数
|
||||
*/
|
||||
@Schema(description = "展示次数", example = "10000")
|
||||
private Integer impressionCount;
|
||||
|
||||
/**
|
||||
* 转化次数
|
||||
*/
|
||||
@Schema(description = "转化次数", example = "50")
|
||||
private Integer conversionCount;
|
||||
|
||||
/**
|
||||
* 推广费发生日期
|
||||
*/
|
||||
@Schema(description = "推广费发生日期", example = "2024-01-01", required = true)
|
||||
@NotNull(message = "推广费发生日期不能为空")
|
||||
private LocalDate feeDate;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注", example = "双十一期间推广费用")
|
||||
private String remark;
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 更新推广费类型DTO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "更新推广费类型DTO")
|
||||
public class UpdatePromotionFeeTypeDTO {
|
||||
|
||||
/**
|
||||
* 推广费类型ID
|
||||
*/
|
||||
@Schema(description = "推广费类型ID", example = "1", required = true)
|
||||
@NotNull(message = "推广费类型ID不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
@Schema(description = "类型编码", example = "DIRECT_TRAFFIC", required = true)
|
||||
@NotBlank(message = "类型编码不能为空")
|
||||
private String typeCode;
|
||||
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
@Schema(description = "类型名称", example = "直通车", required = true)
|
||||
@NotBlank(message = "类型名称不能为空")
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 类型描述
|
||||
*/
|
||||
@Schema(description = "类型描述", example = "淘宝直通车推广费用")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 计算方式 1固定金额 2按比例 3按点击 4按展示
|
||||
*/
|
||||
@Schema(description = "计算方式", example = "1", allowableValues = {"1", "2", "3", "4"})
|
||||
private Integer calculationMethod;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Schema(description = "排序", example = "1")
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
* 是否启用 0禁用 1启用
|
||||
*/
|
||||
@Schema(description = "是否启用", example = "1", allowableValues = {"0", "1"})
|
||||
private Integer isActive;
|
||||
}
|
||||
+24
@@ -33,12 +33,24 @@ public class OrderItemPO {
|
||||
@TableField("product_id")
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 商品规格ID
|
||||
*/
|
||||
@TableField("product_spec_id")
|
||||
private Long productSpecId;
|
||||
|
||||
/**
|
||||
* 商品名称(冗余存储)
|
||||
*/
|
||||
@TableField("product_name")
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 规格名称(冗余存储)
|
||||
*/
|
||||
@TableField("spec_name")
|
||||
private String specName;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@@ -51,12 +63,24 @@ public class OrderItemPO {
|
||||
@TableField("unit_price")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/**
|
||||
* 成本价(下单时快照)
|
||||
*/
|
||||
@TableField("cost_price")
|
||||
private BigDecimal costPrice;
|
||||
|
||||
/**
|
||||
* 小计金额
|
||||
*/
|
||||
@TableField("subtotal")
|
||||
private BigDecimal subtotal;
|
||||
|
||||
/**
|
||||
* 成本小计
|
||||
*/
|
||||
@TableField("cost_total")
|
||||
private BigDecimal costTotal;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
+12
-12
@@ -34,22 +34,16 @@ public class OrderPO {
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
* 平台订单号
|
||||
*/
|
||||
@TableField("order_no")
|
||||
private String orderNo;
|
||||
@TableField("platform_order_no")
|
||||
private String platformOrderNo;
|
||||
|
||||
/**
|
||||
* 订单状态 0待发货 1已完成 2已取消
|
||||
* 订单状态ID
|
||||
*/
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 订单金额
|
||||
*/
|
||||
@TableField("total_amount")
|
||||
private BigDecimal totalAmount;
|
||||
@TableField("status_id")
|
||||
private Long statusId;
|
||||
|
||||
/**
|
||||
* 商家实收金额
|
||||
@@ -57,6 +51,12 @@ public class OrderPO {
|
||||
@TableField("received_amount")
|
||||
private BigDecimal receivedAmount;
|
||||
|
||||
/**
|
||||
* 运费
|
||||
*/
|
||||
@TableField("shipping_fee")
|
||||
private BigDecimal shippingFee;
|
||||
|
||||
/**
|
||||
* 下单时间
|
||||
*/
|
||||
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 电商-订单状态实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("ec_order_status")
|
||||
public class OrderStatusPO {
|
||||
|
||||
/**
|
||||
* 状态ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
@TableField("status_code")
|
||||
private Integer statusCode;
|
||||
|
||||
/**
|
||||
* 状态名称
|
||||
*/
|
||||
@TableField("status_name")
|
||||
private String statusName;
|
||||
|
||||
/**
|
||||
* 状态描述
|
||||
*/
|
||||
@TableField("description")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
* 是否启用 0禁用 1启用
|
||||
*/
|
||||
@TableField("is_active")
|
||||
private Integer isActive;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@TableField("delete_time")
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
@TableField("create_by")
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 更新人ID
|
||||
*/
|
||||
@TableField("update_by")
|
||||
private Long updateBy;
|
||||
|
||||
/**
|
||||
* 删除人ID
|
||||
*/
|
||||
@TableField("delete_by")
|
||||
private Long deleteBy;
|
||||
}
|
||||
-19
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@@ -33,30 +32,12 @@ public class ProductPO {
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
@TableField("spec_code")
|
||||
private String specCode;
|
||||
|
||||
/**
|
||||
* 商品SKU
|
||||
*/
|
||||
@TableField("sku_code")
|
||||
private String skuCode;
|
||||
|
||||
/**
|
||||
* 主图URL
|
||||
*/
|
||||
@TableField("main_image")
|
||||
private String mainImage;
|
||||
|
||||
/**
|
||||
* 成本价
|
||||
*/
|
||||
@TableField("cost_price")
|
||||
private BigDecimal costPrice;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 电商-商品规格实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("ec_product_spec")
|
||||
public class ProductSpecPO {
|
||||
|
||||
/**
|
||||
* 规格ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 公司ID
|
||||
*/
|
||||
@TableField("company_id")
|
||||
private Long companyId;
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
@TableField("product_id")
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 规格名称
|
||||
*/
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规格编码
|
||||
*/
|
||||
@TableField("spec_code")
|
||||
private String specCode;
|
||||
|
||||
/**
|
||||
* 成本价
|
||||
*/
|
||||
@TableField("cost_price")
|
||||
private BigDecimal costPrice;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@TableField("delete_time")
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
@TableField("create_by")
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 更新人ID
|
||||
*/
|
||||
@TableField("update_by")
|
||||
private Long updateBy;
|
||||
|
||||
/**
|
||||
* 删除人ID
|
||||
*/
|
||||
@TableField("delete_by")
|
||||
private Long deleteBy;
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 电商-推广费记录实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("ec_promotion_fee")
|
||||
public class PromotionFeePO {
|
||||
|
||||
/**
|
||||
* 推广费记录ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 公司ID
|
||||
*/
|
||||
@TableField("company_id")
|
||||
private Long companyId;
|
||||
|
||||
/**
|
||||
* 店铺ID
|
||||
*/
|
||||
@TableField("shop_id")
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 推广费类型ID
|
||||
*/
|
||||
@TableField("fee_type_id")
|
||||
private Long feeTypeId;
|
||||
|
||||
/**
|
||||
* 推广费名称
|
||||
*/
|
||||
@TableField("fee_name")
|
||||
private String feeName;
|
||||
|
||||
/**
|
||||
* 平台(淘宝、京东、拼多多等)
|
||||
*/
|
||||
@TableField("platform")
|
||||
private String platform;
|
||||
|
||||
/**
|
||||
* 推广活动名称
|
||||
*/
|
||||
@TableField("campaign_name")
|
||||
private String campaignName;
|
||||
|
||||
/**
|
||||
* 推广费金额
|
||||
*/
|
||||
@TableField("fee_amount")
|
||||
private BigDecimal feeAmount;
|
||||
|
||||
/**
|
||||
* 基础金额(用于按比例计算)
|
||||
*/
|
||||
@TableField("base_amount")
|
||||
private BigDecimal baseAmount;
|
||||
|
||||
/**
|
||||
* 费率(用于按比例计算)
|
||||
*/
|
||||
@TableField("fee_rate")
|
||||
private BigDecimal feeRate;
|
||||
|
||||
/**
|
||||
* 点击次数
|
||||
*/
|
||||
@TableField("click_count")
|
||||
private Integer clickCount;
|
||||
|
||||
/**
|
||||
* 展示次数
|
||||
*/
|
||||
@TableField("impression_count")
|
||||
private Integer impressionCount;
|
||||
|
||||
/**
|
||||
* 转化次数
|
||||
*/
|
||||
@TableField("conversion_count")
|
||||
private Integer conversionCount;
|
||||
|
||||
/**
|
||||
* 推广费发生日期
|
||||
*/
|
||||
@TableField("fee_date")
|
||||
private LocalDate feeDate;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField("remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@TableField("delete_time")
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
@TableField("create_by")
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 更新人ID
|
||||
*/
|
||||
@TableField("update_by")
|
||||
private Long updateBy;
|
||||
|
||||
/**
|
||||
* 删除人ID
|
||||
*/
|
||||
@TableField("delete_by")
|
||||
private Long deleteBy;
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 电商-推广费类型实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("ec_promotion_fee_type")
|
||||
public class PromotionFeeTypePO {
|
||||
|
||||
/**
|
||||
* 推广费类型ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
@TableField("type_code")
|
||||
private String typeCode;
|
||||
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
@TableField("type_name")
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 类型描述
|
||||
*/
|
||||
@TableField("description")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 计算方式 1固定金额 2按比例 3按点击 4按展示
|
||||
*/
|
||||
@TableField("calculation_method")
|
||||
private Integer calculationMethod;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
* 是否启用 0禁用 1启用
|
||||
*/
|
||||
@TableField("is_active")
|
||||
private Integer isActive;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@TableField("delete_time")
|
||||
private LocalDateTime deleteTime;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
@TableField("create_by")
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 更新人ID
|
||||
*/
|
||||
@TableField("update_by")
|
||||
private Long updateBy;
|
||||
|
||||
/**
|
||||
* 删除人ID
|
||||
*/
|
||||
@TableField("delete_by")
|
||||
private Long deleteBy;
|
||||
}
|
||||
+24
@@ -31,12 +31,24 @@ public class OrderItemVO {
|
||||
@Schema(description = "商品ID", example = "1")
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 商品规格ID
|
||||
*/
|
||||
@Schema(description = "商品规格ID", example = "1")
|
||||
private Long productSpecId;
|
||||
|
||||
/**
|
||||
* 商品名称(冗余存储)
|
||||
*/
|
||||
@Schema(description = "商品名称", example = "iPhone 15 Pro")
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 规格名称(冗余存储)
|
||||
*/
|
||||
@Schema(description = "规格名称", example = "128GB 深空黑色")
|
||||
private String specName;
|
||||
|
||||
/**
|
||||
* 商品主图
|
||||
*/
|
||||
@@ -55,12 +67,24 @@ public class OrderItemVO {
|
||||
@Schema(description = "销售单价", example = "9999.00")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/**
|
||||
* 成本价(下单时快照)
|
||||
*/
|
||||
@Schema(description = "成本价", example = "8000.00")
|
||||
private BigDecimal costPrice;
|
||||
|
||||
/**
|
||||
* 小计金额
|
||||
*/
|
||||
@Schema(description = "小计金额", example = "9999.00")
|
||||
private BigDecimal subtotal;
|
||||
|
||||
/**
|
||||
* 成本小计
|
||||
*/
|
||||
@Schema(description = "成本小计", example = "8000.00")
|
||||
private BigDecimal costTotal;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 订单状态VO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "订单状态VO")
|
||||
public class OrderStatusVO {
|
||||
|
||||
/**
|
||||
* 状态ID
|
||||
*/
|
||||
@Schema(description = "状态ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
@Schema(description = "状态码", example = "0")
|
||||
private Integer statusCode;
|
||||
|
||||
/**
|
||||
* 状态名称
|
||||
*/
|
||||
@Schema(description = "状态名称", example = "待发货")
|
||||
private String statusName;
|
||||
|
||||
/**
|
||||
* 状态描述
|
||||
*/
|
||||
@Schema(description = "状态描述", example = "订单已创建,等待发货")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Schema(description = "排序", example = "1")
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
* 是否启用 0禁用 1启用
|
||||
*/
|
||||
@Schema(description = "是否启用", example = "1")
|
||||
private Integer isActive;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", example = "2024-01-01T10:00:00")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", example = "2024-01-01T10:00:00")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
@Schema(description = "创建人ID", example = "1")
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 更新人ID
|
||||
*/
|
||||
@Schema(description = "更新人ID", example = "1")
|
||||
private Long updateBy;
|
||||
}
|
||||
+15
-15
@@ -39,28 +39,22 @@ public class OrderVO {
|
||||
private String shopName;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
* 平台订单号
|
||||
*/
|
||||
@Schema(description = "订单号", example = "ORDER202401010001")
|
||||
private String orderNo;
|
||||
@Schema(description = "平台订单号", example = "TB202401010001")
|
||||
private String platformOrderNo;
|
||||
|
||||
/**
|
||||
* 订单状态 0待发货 1已完成 2已取消
|
||||
* 订单状态ID
|
||||
*/
|
||||
@Schema(description = "订单状态", example = "0", allowableValues = {"0", "1", "2"})
|
||||
private Integer status;
|
||||
@Schema(description = "订单状态ID", example = "1")
|
||||
private Long statusId;
|
||||
|
||||
/**
|
||||
* 订单状态描述
|
||||
* 订单状态名称
|
||||
*/
|
||||
@Schema(description = "订单状态描述", example = "待发货")
|
||||
private String statusDesc;
|
||||
|
||||
/**
|
||||
* 订单金额
|
||||
*/
|
||||
@Schema(description = "订单金额", example = "9999.00")
|
||||
private BigDecimal totalAmount;
|
||||
@Schema(description = "订单状态名称", example = "待发货")
|
||||
private String statusName;
|
||||
|
||||
/**
|
||||
* 商家实收金额
|
||||
@@ -68,6 +62,12 @@ public class OrderVO {
|
||||
@Schema(description = "商家实收金额", example = "9999.00")
|
||||
private BigDecimal receivedAmount;
|
||||
|
||||
/**
|
||||
* 运费
|
||||
*/
|
||||
@Schema(description = "运费", example = "10.00")
|
||||
private BigDecimal shippingFee;
|
||||
|
||||
/**
|
||||
* 下单时间
|
||||
*/
|
||||
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 商品规格VO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "商品规格VO")
|
||||
public class ProductSpecVO {
|
||||
|
||||
/**
|
||||
* 规格ID
|
||||
*/
|
||||
@Schema(description = "规格ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 公司ID
|
||||
*/
|
||||
@Schema(description = "公司ID", example = "1")
|
||||
private Long companyId;
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
@Schema(description = "商品ID", example = "1")
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@Schema(description = "商品名称", example = "iPhone 15 Pro")
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 规格名称
|
||||
*/
|
||||
@Schema(description = "规格名称", example = "128GB 深空黑色")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规格编码
|
||||
*/
|
||||
@Schema(description = "规格编码", example = "IPHONE15PRO-128G-BLACK")
|
||||
private String specCode;
|
||||
|
||||
/**
|
||||
* 成本价
|
||||
*/
|
||||
@Schema(description = "成本价", example = "8000.00")
|
||||
private BigDecimal costPrice;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", example = "2024-01-01T10:00:00")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", example = "2024-01-01T10:00:00")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
@Schema(description = "创建人ID", example = "1")
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 更新人ID
|
||||
*/
|
||||
@Schema(description = "更新人ID", example = "1")
|
||||
private Long updateBy;
|
||||
}
|
||||
-19
@@ -3,7 +3,6 @@ package top.xyquan.ecomdmbbackend.modules.ec.model.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@@ -31,30 +30,12 @@ public class ProductVO {
|
||||
@Schema(description = "商品名称", example = "iPhone 15 Pro")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
@Schema(description = "商品编码", example = "IPHONE15PRO001")
|
||||
private String specCode;
|
||||
|
||||
/**
|
||||
* 商品SKU
|
||||
*/
|
||||
@Schema(description = "商品SKU", example = "IPHONE15PRO-128G-BLUE")
|
||||
private String skuCode;
|
||||
|
||||
/**
|
||||
* 主图URL
|
||||
*/
|
||||
@Schema(description = "主图URL", example = "https://example.com/product.jpg")
|
||||
private String mainImage;
|
||||
|
||||
/**
|
||||
* 成本价
|
||||
*/
|
||||
@Schema(description = "成本价", example = "8000.00")
|
||||
private BigDecimal costPrice;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 推广费类型VO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "推广费类型VO")
|
||||
public class PromotionFeeTypeVO {
|
||||
|
||||
/**
|
||||
* 推广费类型ID
|
||||
*/
|
||||
@Schema(description = "推广费类型ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
@Schema(description = "类型编码", example = "DIRECT_TRAFFIC")
|
||||
private String typeCode;
|
||||
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
@Schema(description = "类型名称", example = "直通车")
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 类型描述
|
||||
*/
|
||||
@Schema(description = "类型描述", example = "淘宝直通车推广费用")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 计算方式 1固定金额 2按比例 3按点击 4按展示
|
||||
*/
|
||||
@Schema(description = "计算方式", example = "1")
|
||||
private Integer calculationMethod;
|
||||
|
||||
/**
|
||||
* 计算方式描述
|
||||
*/
|
||||
@Schema(description = "计算方式描述", example = "按点击")
|
||||
private String calculationMethodDesc;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Schema(description = "排序", example = "1")
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
* 是否启用 0禁用 1启用
|
||||
*/
|
||||
@Schema(description = "是否启用", example = "1")
|
||||
private Integer isActive;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", example = "2024-01-01T10:00:00")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", example = "2024-01-01T10:00:00")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
@Schema(description = "创建人ID", example = "1")
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 更新人ID
|
||||
*/
|
||||
@Schema(description = "更新人ID", example = "1")
|
||||
private Long updateBy;
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 推广费记录VO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "推广费记录VO")
|
||||
public class PromotionFeeVO {
|
||||
|
||||
/**
|
||||
* 推广费记录ID
|
||||
*/
|
||||
@Schema(description = "推广费记录ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 公司ID
|
||||
*/
|
||||
@Schema(description = "公司ID", example = "1")
|
||||
private Long companyId;
|
||||
|
||||
/**
|
||||
* 店铺ID
|
||||
*/
|
||||
@Schema(description = "店铺ID", example = "1")
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 店铺名称
|
||||
*/
|
||||
@Schema(description = "店铺名称", example = "旗舰店")
|
||||
private String shopName;
|
||||
|
||||
/**
|
||||
* 推广费类型ID
|
||||
*/
|
||||
@Schema(description = "推广费类型ID", example = "1")
|
||||
private Long feeTypeId;
|
||||
|
||||
/**
|
||||
* 推广费类型名称
|
||||
*/
|
||||
@Schema(description = "推广费类型名称", example = "直通车")
|
||||
private String feeTypeName;
|
||||
|
||||
/**
|
||||
* 推广费名称
|
||||
*/
|
||||
@Schema(description = "推广费名称", example = "直通车推广")
|
||||
private String feeName;
|
||||
|
||||
/**
|
||||
* 平台(淘宝、京东、拼多多等)
|
||||
*/
|
||||
@Schema(description = "平台", example = "淘宝")
|
||||
private String platform;
|
||||
|
||||
/**
|
||||
* 推广活动名称
|
||||
*/
|
||||
@Schema(description = "推广活动名称", example = "双十一大促")
|
||||
private String campaignName;
|
||||
|
||||
/**
|
||||
* 推广费金额
|
||||
*/
|
||||
@Schema(description = "推广费金额", example = "1000.00")
|
||||
private BigDecimal feeAmount;
|
||||
|
||||
/**
|
||||
* 基础金额(用于按比例计算)
|
||||
*/
|
||||
@Schema(description = "基础金额", example = "10000.00")
|
||||
private BigDecimal baseAmount;
|
||||
|
||||
/**
|
||||
* 费率(用于按比例计算)
|
||||
*/
|
||||
@Schema(description = "费率", example = "0.05")
|
||||
private BigDecimal feeRate;
|
||||
|
||||
/**
|
||||
* 点击次数
|
||||
*/
|
||||
@Schema(description = "点击次数", example = "1000")
|
||||
private Integer clickCount;
|
||||
|
||||
/**
|
||||
* 展示次数
|
||||
*/
|
||||
@Schema(description = "展示次数", example = "10000")
|
||||
private Integer impressionCount;
|
||||
|
||||
/**
|
||||
* 转化次数
|
||||
*/
|
||||
@Schema(description = "转化次数", example = "50")
|
||||
private Integer conversionCount;
|
||||
|
||||
/**
|
||||
* 推广费发生日期
|
||||
*/
|
||||
@Schema(description = "推广费发生日期", example = "2024-01-01")
|
||||
private LocalDate feeDate;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注", example = "双十一期间推广费用")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", example = "2024-01-01T10:00:00")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", example = "2024-01-01T10:00:00")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
@Schema(description = "创建人ID", example = "1")
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 更新人ID
|
||||
*/
|
||||
@Schema(description = "更新人ID", example = "1")
|
||||
private Long updateBy;
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.service;
|
||||
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.order.CreateOrderStatusDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.order.UpdateOrderStatusDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.vo.OrderStatusVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单状态服务接口
|
||||
*/
|
||||
public interface OrderStatusService {
|
||||
|
||||
/**
|
||||
* 创建订单状态
|
||||
*/
|
||||
Long createOrderStatus(CreateOrderStatusDTO dto);
|
||||
|
||||
/**
|
||||
* 更新订单状态
|
||||
*/
|
||||
void updateOrderStatus(UpdateOrderStatusDTO dto);
|
||||
|
||||
/**
|
||||
* 删除订单状态
|
||||
*/
|
||||
void deleteOrderStatus(Long id);
|
||||
|
||||
/**
|
||||
* 根据ID查询订单状态
|
||||
*/
|
||||
OrderStatusVO getOrderStatusById(Long id);
|
||||
|
||||
/**
|
||||
* 查询启用的订单状态列表
|
||||
*/
|
||||
List<OrderStatusVO> getActiveOrderStatusList();
|
||||
|
||||
/**
|
||||
* 查询所有订单状态列表
|
||||
*/
|
||||
List<OrderStatusVO> getAllOrderStatusList();
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.product.CreateProductSpecDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.product.ProductSpecFilterDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.product.UpdateProductSpecDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.vo.ProductSpecVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品规格服务接口
|
||||
*/
|
||||
public interface ProductSpecService {
|
||||
|
||||
/**
|
||||
* 创建商品规格
|
||||
*/
|
||||
Long createProductSpec(CreateProductSpecDTO dto);
|
||||
|
||||
/**
|
||||
* 更新商品规格
|
||||
*/
|
||||
void updateProductSpec(UpdateProductSpecDTO dto);
|
||||
|
||||
/**
|
||||
* 删除商品规格
|
||||
*/
|
||||
void deleteProductSpec(Long id);
|
||||
|
||||
/**
|
||||
* 根据ID查询商品规格
|
||||
*/
|
||||
ProductSpecVO getProductSpecById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询商品规格
|
||||
*/
|
||||
IPage<ProductSpecVO> getProductSpecPage(Page<ProductSpecVO> page, ProductSpecFilterDTO filter);
|
||||
|
||||
/**
|
||||
* 根据商品ID查询规格列表
|
||||
*/
|
||||
List<ProductSpecVO> getProductSpecsByProductId(Long productId);
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion.CreatePromotionFeeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion.PromotionFeeFilterDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion.UpdatePromotionFeeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.vo.PromotionFeeVO;
|
||||
|
||||
/**
|
||||
* 推广费记录服务接口
|
||||
*/
|
||||
public interface PromotionFeeService {
|
||||
|
||||
/**
|
||||
* 创建推广费记录
|
||||
*/
|
||||
Long createPromotionFee(CreatePromotionFeeDTO dto);
|
||||
|
||||
/**
|
||||
* 更新推广费记录
|
||||
*/
|
||||
void updatePromotionFee(UpdatePromotionFeeDTO dto);
|
||||
|
||||
/**
|
||||
* 删除推广费记录
|
||||
*/
|
||||
void deletePromotionFee(Long id);
|
||||
|
||||
/**
|
||||
* 根据ID查询推广费记录
|
||||
*/
|
||||
PromotionFeeVO getPromotionFeeById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询推广费记录
|
||||
*/
|
||||
IPage<PromotionFeeVO> getPromotionFeePage(Page<PromotionFeeVO> page, PromotionFeeFilterDTO filter);
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.service;
|
||||
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion.CreatePromotionFeeTypeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion.UpdatePromotionFeeTypeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.vo.PromotionFeeTypeVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 推广费类型服务接口
|
||||
*/
|
||||
public interface PromotionFeeTypeService {
|
||||
|
||||
/**
|
||||
* 创建推广费类型
|
||||
*/
|
||||
Long createPromotionFeeType(CreatePromotionFeeTypeDTO dto);
|
||||
|
||||
/**
|
||||
* 更新推广费类型
|
||||
*/
|
||||
void updatePromotionFeeType(UpdatePromotionFeeTypeDTO dto);
|
||||
|
||||
/**
|
||||
* 删除推广费类型
|
||||
*/
|
||||
void deletePromotionFeeType(Long id);
|
||||
|
||||
/**
|
||||
* 根据ID查询推广费类型
|
||||
*/
|
||||
PromotionFeeTypeVO getPromotionFeeTypeById(Long id);
|
||||
|
||||
/**
|
||||
* 查询启用的推广费类型列表
|
||||
*/
|
||||
List<PromotionFeeTypeVO> getActivePromotionFeeTypeList();
|
||||
|
||||
/**
|
||||
* 查询所有推广费类型列表
|
||||
*/
|
||||
List<PromotionFeeTypeVO> getAllPromotionFeeTypeList();
|
||||
}
|
||||
+35
-47
@@ -57,13 +57,15 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderPO> implemen
|
||||
throw new BusinessException("店铺不存在");
|
||||
}
|
||||
|
||||
// 验证订单号是否重复
|
||||
LambdaQueryWrapper<OrderPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(OrderPO::getOrderNo, createOrderDTO.getOrderNo())
|
||||
.eq(OrderPO::getCompanyId, companyId)
|
||||
.isNull(OrderPO::getDeleteTime);
|
||||
if (this.count(wrapper) > 0) {
|
||||
throw new BusinessException("订单号已存在");
|
||||
// 验证平台订单号是否重复(如果提供了的话)
|
||||
if (createOrderDTO.getPlatformOrderNo() != null && !createOrderDTO.getPlatformOrderNo().trim().isEmpty()) {
|
||||
LambdaQueryWrapper<OrderPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(OrderPO::getPlatformOrderNo, createOrderDTO.getPlatformOrderNo())
|
||||
.eq(OrderPO::getCompanyId, companyId)
|
||||
.isNull(OrderPO::getDeleteTime);
|
||||
if (this.count(wrapper) > 0) {
|
||||
throw new BusinessException("平台订单号已存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 创建订单
|
||||
@@ -74,11 +76,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderPO> implemen
|
||||
order.setCompanyId(companyId);
|
||||
|
||||
// 设置默认值
|
||||
if (order.getStatus() == null) {
|
||||
order.setStatus(0); // 默认待发货
|
||||
if (order.getStatusId() == null) {
|
||||
// 默认使用状态码为0的订单状态(待发货)
|
||||
order.setStatusId(1L); // 假设状态ID为1对应待发货状态
|
||||
}
|
||||
if (order.getReceivedAmount() == null) {
|
||||
order.setReceivedAmount(order.getTotalAmount());
|
||||
if (order.getShippingFee() == null) {
|
||||
order.setShippingFee(java.math.BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
// 设置创建人ID
|
||||
@@ -118,14 +121,16 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderPO> implemen
|
||||
throw new BusinessException("店铺不存在");
|
||||
}
|
||||
|
||||
// 验证订单号是否重复(排除当前订单)
|
||||
LambdaQueryWrapper<OrderPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(OrderPO::getOrderNo, updateOrderDTO.getOrderNo())
|
||||
.eq(OrderPO::getCompanyId, companyId)
|
||||
.ne(OrderPO::getId, id)
|
||||
.isNull(OrderPO::getDeleteTime);
|
||||
if (this.count(wrapper) > 0) {
|
||||
throw new BusinessException("订单号已存在");
|
||||
// 验证平台订单号是否重复(排除当前订单)
|
||||
if (updateOrderDTO.getPlatformOrderNo() != null && !updateOrderDTO.getPlatformOrderNo().trim().isEmpty()) {
|
||||
LambdaQueryWrapper<OrderPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(OrderPO::getPlatformOrderNo, updateOrderDTO.getPlatformOrderNo())
|
||||
.eq(OrderPO::getCompanyId, companyId)
|
||||
.ne(OrderPO::getId, id)
|
||||
.isNull(OrderPO::getDeleteTime);
|
||||
if (this.count(wrapper) > 0) {
|
||||
throw new BusinessException("平台订单号已存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 更新订单
|
||||
@@ -195,17 +200,17 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderPO> implemen
|
||||
if (filter.getShopId() != null) {
|
||||
wrapper.eq(OrderPO::getShopId, filter.getShopId());
|
||||
}
|
||||
if (filter.getOrderNo() != null && !filter.getOrderNo().trim().isEmpty()) {
|
||||
wrapper.like(OrderPO::getOrderNo, filter.getOrderNo());
|
||||
if (filter.getPlatformOrderNo() != null && !filter.getPlatformOrderNo().trim().isEmpty()) {
|
||||
wrapper.like(OrderPO::getPlatformOrderNo, filter.getPlatformOrderNo());
|
||||
}
|
||||
if (filter.getStatus() != null) {
|
||||
wrapper.eq(OrderPO::getStatus, filter.getStatus());
|
||||
if (filter.getStatusId() != null) {
|
||||
wrapper.eq(OrderPO::getStatusId, filter.getStatusId());
|
||||
}
|
||||
if (filter.getMinTotalAmount() != null) {
|
||||
wrapper.ge(OrderPO::getTotalAmount, filter.getMinTotalAmount());
|
||||
if (filter.getMinReceivedAmount() != null) {
|
||||
wrapper.ge(OrderPO::getReceivedAmount, filter.getMinReceivedAmount());
|
||||
}
|
||||
if (filter.getMaxTotalAmount() != null) {
|
||||
wrapper.le(OrderPO::getTotalAmount, filter.getMaxTotalAmount());
|
||||
if (filter.getMaxReceivedAmount() != null) {
|
||||
wrapper.le(OrderPO::getReceivedAmount, filter.getMaxReceivedAmount());
|
||||
}
|
||||
if (filter.getStartOrderDate() != null) {
|
||||
wrapper.ge(OrderPO::getOrderDate, filter.getStartOrderDate());
|
||||
@@ -269,8 +274,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderPO> implemen
|
||||
OrderVO orderVO = new OrderVO();
|
||||
BeanUtils.copyProperties(order, orderVO);
|
||||
|
||||
// 设置状态描述
|
||||
orderVO.setStatusDesc(getStatusDesc(order.getStatus()));
|
||||
// 设置状态名称(这里需要根据statusId查询订单状态表获取状态名称)
|
||||
// 暂时设置为状态ID,实际应该查询订单状态表
|
||||
orderVO.setStatusName("状态ID: " + order.getStatusId());
|
||||
|
||||
// 设置店铺名称
|
||||
ShopPO shop = shopService.getById(order.getShopId());
|
||||
@@ -290,22 +296,4 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderPO> implemen
|
||||
return orderItemVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态描述
|
||||
*/
|
||||
private String getStatusDesc(Integer status) {
|
||||
if (status == null) {
|
||||
return "未知";
|
||||
}
|
||||
switch (status) {
|
||||
case 0:
|
||||
return "待发货";
|
||||
case 1:
|
||||
return "已完成";
|
||||
case 2:
|
||||
return "已取消";
|
||||
default:
|
||||
return "未知";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.mapper.OrderStatusMapper;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.order.CreateOrderStatusDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.order.UpdateOrderStatusDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.po.OrderStatusPO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.vo.OrderStatusVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.service.OrderStatusService;
|
||||
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 订单状态服务实现类
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class OrderStatusServiceImpl implements OrderStatusService {
|
||||
|
||||
private final OrderStatusMapper orderStatusMapper;
|
||||
private final CurrentUserContext currentUserContext;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createOrderStatus(CreateOrderStatusDTO dto) {
|
||||
OrderStatusPO po = new OrderStatusPO();
|
||||
BeanUtils.copyProperties(dto, po);
|
||||
po.setCreateBy(currentUserContext.getCurrentUserId());
|
||||
po.setUpdateBy(currentUserContext.getCurrentUserId());
|
||||
|
||||
orderStatusMapper.insert(po);
|
||||
return po.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateOrderStatus(UpdateOrderStatusDTO dto) {
|
||||
OrderStatusPO po = new OrderStatusPO();
|
||||
BeanUtils.copyProperties(dto, po);
|
||||
po.setUpdateBy(currentUserContext.getCurrentUserId());
|
||||
|
||||
orderStatusMapper.updateById(po);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteOrderStatus(Long id) {
|
||||
OrderStatusPO po = new OrderStatusPO();
|
||||
po.setId(id);
|
||||
po.setDeleteBy(currentUserContext.getCurrentUserId());
|
||||
po.setDeleteTime(java.time.LocalDateTime.now());
|
||||
|
||||
orderStatusMapper.updateById(po);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderStatusVO getOrderStatusById(Long id) {
|
||||
OrderStatusPO po = orderStatusMapper.selectById(id);
|
||||
if (po == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
OrderStatusVO vo = new OrderStatusVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStatusVO> getActiveOrderStatusList() {
|
||||
List<OrderStatusPO> poList = orderStatusMapper.selectActiveStatusList();
|
||||
return poList.stream()
|
||||
.map(po -> {
|
||||
OrderStatusVO vo = new OrderStatusVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
return vo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStatusVO> getAllOrderStatusList() {
|
||||
LambdaQueryWrapper<OrderStatusPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(OrderStatusPO::getDeleteTime, null)
|
||||
.orderByAsc(OrderStatusPO::getSortOrder);
|
||||
|
||||
List<OrderStatusPO> poList = orderStatusMapper.selectList(wrapper);
|
||||
return poList.stream()
|
||||
.map(po -> {
|
||||
OrderStatusVO vo = new OrderStatusVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
return vo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
-33
@@ -50,16 +50,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductPO> im
|
||||
throw new BusinessException("商品名称已存在");
|
||||
}
|
||||
|
||||
// 验证SKU是否重复
|
||||
if (createProductDTO.getSkuCode() != null && !createProductDTO.getSkuCode().trim().isEmpty()) {
|
||||
LambdaQueryWrapper<ProductPO> skuWrapper = new LambdaQueryWrapper<>();
|
||||
skuWrapper.eq(ProductPO::getSkuCode, createProductDTO.getSkuCode())
|
||||
.eq(ProductPO::getCompanyId, companyId)
|
||||
.isNull(ProductPO::getDeleteTime);
|
||||
if (this.count(skuWrapper) > 0) {
|
||||
throw new BusinessException("商品SKU已存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 创建商品
|
||||
ProductPO product = new ProductPO();
|
||||
@@ -100,17 +90,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductPO> im
|
||||
throw new BusinessException("商品名称已存在");
|
||||
}
|
||||
|
||||
// 验证SKU是否重复(排除当前商品)
|
||||
if (updateProductDTO.getSkuCode() != null && !updateProductDTO.getSkuCode().trim().isEmpty()) {
|
||||
LambdaQueryWrapper<ProductPO> skuWrapper = new LambdaQueryWrapper<>();
|
||||
skuWrapper.eq(ProductPO::getSkuCode, updateProductDTO.getSkuCode())
|
||||
.eq(ProductPO::getCompanyId, companyId)
|
||||
.ne(ProductPO::getId, id)
|
||||
.isNull(ProductPO::getDeleteTime);
|
||||
if (this.count(skuWrapper) > 0) {
|
||||
throw new BusinessException("商品SKU已存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 更新商品
|
||||
ProductPO product = new ProductPO();
|
||||
@@ -168,18 +147,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductPO> im
|
||||
if (filter.getName() != null && !filter.getName().trim().isEmpty()) {
|
||||
wrapper.like(ProductPO::getName, filter.getName());
|
||||
}
|
||||
if (filter.getSpecCode() != null && !filter.getSpecCode().trim().isEmpty()) {
|
||||
wrapper.like(ProductPO::getSpecCode, filter.getSpecCode());
|
||||
}
|
||||
if (filter.getSkuCode() != null && !filter.getSkuCode().trim().isEmpty()) {
|
||||
wrapper.like(ProductPO::getSkuCode, filter.getSkuCode());
|
||||
}
|
||||
if (filter.getMinCostPrice() != null) {
|
||||
wrapper.ge(ProductPO::getCostPrice, filter.getMinCostPrice());
|
||||
}
|
||||
if (filter.getMaxCostPrice() != null) {
|
||||
wrapper.le(ProductPO::getCostPrice, filter.getMaxCostPrice());
|
||||
}
|
||||
}
|
||||
|
||||
// 排序
|
||||
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.mapper.ProductSpecMapper;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.product.CreateProductSpecDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.product.ProductSpecFilterDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.product.UpdateProductSpecDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.po.ProductSpecPO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.vo.ProductSpecVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.service.ProductSpecService;
|
||||
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 商品规格服务实现类
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ProductSpecServiceImpl implements ProductSpecService {
|
||||
|
||||
private final ProductSpecMapper productSpecMapper;
|
||||
private final CurrentUserContext currentUserContext;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createProductSpec(CreateProductSpecDTO dto) {
|
||||
ProductSpecPO po = new ProductSpecPO();
|
||||
BeanUtils.copyProperties(dto, po);
|
||||
po.setCompanyId(currentUserContext.getCurrentCompanyId());
|
||||
po.setCreateBy(currentUserContext.getCurrentUserId());
|
||||
po.setUpdateBy(currentUserContext.getCurrentUserId());
|
||||
|
||||
productSpecMapper.insert(po);
|
||||
return po.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateProductSpec(UpdateProductSpecDTO dto) {
|
||||
ProductSpecPO po = new ProductSpecPO();
|
||||
BeanUtils.copyProperties(dto, po);
|
||||
po.setUpdateBy(currentUserContext.getCurrentUserId());
|
||||
|
||||
productSpecMapper.updateById(po);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteProductSpec(Long id) {
|
||||
ProductSpecPO po = new ProductSpecPO();
|
||||
po.setId(id);
|
||||
po.setDeleteBy(currentUserContext.getCurrentUserId());
|
||||
po.setDeleteTime(java.time.LocalDateTime.now());
|
||||
|
||||
productSpecMapper.updateById(po);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductSpecVO getProductSpecById(Long id) {
|
||||
ProductSpecPO po = productSpecMapper.selectById(id);
|
||||
if (po == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ProductSpecVO vo = new ProductSpecVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<ProductSpecVO> getProductSpecPage(Page<ProductSpecVO> page, ProductSpecFilterDTO filter) {
|
||||
Page<ProductSpecPO> poPage = new Page<>(page.getCurrent(), page.getSize());
|
||||
IPage<ProductSpecPO> poPageResult = productSpecMapper.selectPageWithFilter(poPage, filter);
|
||||
|
||||
Page<ProductSpecVO> voPage = new Page<>(poPageResult.getCurrent(), poPageResult.getSize(), poPageResult.getTotal());
|
||||
List<ProductSpecVO> voList = poPageResult.getRecords().stream()
|
||||
.map(po -> {
|
||||
ProductSpecVO vo = new ProductSpecVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
return vo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
voPage.setRecords(voList);
|
||||
|
||||
return voPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductSpecVO> getProductSpecsByProductId(Long productId) {
|
||||
LambdaQueryWrapper<ProductSpecPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ProductSpecPO::getProductId, productId)
|
||||
.eq(ProductSpecPO::getDeleteTime, null)
|
||||
.orderByAsc(ProductSpecPO::getId);
|
||||
|
||||
List<ProductSpecPO> poList = productSpecMapper.selectList(wrapper);
|
||||
return poList.stream()
|
||||
.map(po -> {
|
||||
ProductSpecVO vo = new ProductSpecVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
return vo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.mapper.PromotionFeeMapper;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion.CreatePromotionFeeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion.PromotionFeeFilterDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion.UpdatePromotionFeeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.po.PromotionFeePO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.vo.PromotionFeeVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.service.PromotionFeeService;
|
||||
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 推广费记录服务实现类
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PromotionFeeServiceImpl implements PromotionFeeService {
|
||||
|
||||
private final PromotionFeeMapper promotionFeeMapper;
|
||||
private final CurrentUserContext currentUserContext;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createPromotionFee(CreatePromotionFeeDTO dto) {
|
||||
PromotionFeePO po = new PromotionFeePO();
|
||||
BeanUtils.copyProperties(dto, po);
|
||||
po.setCompanyId(currentUserContext.getCurrentCompanyId());
|
||||
po.setCreateBy(currentUserContext.getCurrentUserId());
|
||||
po.setUpdateBy(currentUserContext.getCurrentUserId());
|
||||
|
||||
promotionFeeMapper.insert(po);
|
||||
return po.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updatePromotionFee(UpdatePromotionFeeDTO dto) {
|
||||
PromotionFeePO po = new PromotionFeePO();
|
||||
BeanUtils.copyProperties(dto, po);
|
||||
po.setUpdateBy(currentUserContext.getCurrentUserId());
|
||||
|
||||
promotionFeeMapper.updateById(po);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePromotionFee(Long id) {
|
||||
PromotionFeePO po = new PromotionFeePO();
|
||||
po.setId(id);
|
||||
po.setDeleteBy(currentUserContext.getCurrentUserId());
|
||||
po.setDeleteTime(java.time.LocalDateTime.now());
|
||||
|
||||
promotionFeeMapper.updateById(po);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PromotionFeeVO getPromotionFeeById(Long id) {
|
||||
PromotionFeePO po = promotionFeeMapper.selectById(id);
|
||||
if (po == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PromotionFeeVO vo = new PromotionFeeVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<PromotionFeeVO> getPromotionFeePage(Page<PromotionFeeVO> page, PromotionFeeFilterDTO filter) {
|
||||
Page<PromotionFeePO> poPage = new Page<>(page.getCurrent(), page.getSize());
|
||||
IPage<PromotionFeePO> poPageResult = promotionFeeMapper.selectPageWithFilter(poPage, filter);
|
||||
|
||||
Page<PromotionFeeVO> voPage = new Page<>(poPageResult.getCurrent(), poPageResult.getSize(), poPageResult.getTotal());
|
||||
List<PromotionFeeVO> voList = poPageResult.getRecords().stream()
|
||||
.map(po -> {
|
||||
PromotionFeeVO vo = new PromotionFeeVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
return vo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
voPage.setRecords(voList);
|
||||
|
||||
return voPage;
|
||||
}
|
||||
}
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.ec.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.mapper.PromotionFeeTypeMapper;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion.CreatePromotionFeeTypeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.dto.promotion.UpdatePromotionFeeTypeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.po.PromotionFeeTypePO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.vo.PromotionFeeTypeVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.service.PromotionFeeTypeService;
|
||||
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 推广费类型服务实现类
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PromotionFeeTypeServiceImpl implements PromotionFeeTypeService {
|
||||
|
||||
private final PromotionFeeTypeMapper promotionFeeTypeMapper;
|
||||
private final CurrentUserContext currentUserContext;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createPromotionFeeType(CreatePromotionFeeTypeDTO dto) {
|
||||
PromotionFeeTypePO po = new PromotionFeeTypePO();
|
||||
BeanUtils.copyProperties(dto, po);
|
||||
po.setCreateBy(currentUserContext.getCurrentUserId());
|
||||
po.setUpdateBy(currentUserContext.getCurrentUserId());
|
||||
|
||||
promotionFeeTypeMapper.insert(po);
|
||||
return po.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updatePromotionFeeType(UpdatePromotionFeeTypeDTO dto) {
|
||||
PromotionFeeTypePO po = new PromotionFeeTypePO();
|
||||
BeanUtils.copyProperties(dto, po);
|
||||
po.setUpdateBy(currentUserContext.getCurrentUserId());
|
||||
|
||||
promotionFeeTypeMapper.updateById(po);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePromotionFeeType(Long id) {
|
||||
PromotionFeeTypePO po = new PromotionFeeTypePO();
|
||||
po.setId(id);
|
||||
po.setDeleteBy(currentUserContext.getCurrentUserId());
|
||||
po.setDeleteTime(java.time.LocalDateTime.now());
|
||||
|
||||
promotionFeeTypeMapper.updateById(po);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PromotionFeeTypeVO getPromotionFeeTypeById(Long id) {
|
||||
PromotionFeeTypePO po = promotionFeeTypeMapper.selectById(id);
|
||||
if (po == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PromotionFeeTypeVO vo = new PromotionFeeTypeVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
|
||||
// 设置计算方式描述
|
||||
if (po.getCalculationMethod() != null) {
|
||||
switch (po.getCalculationMethod()) {
|
||||
case 1:
|
||||
vo.setCalculationMethodDesc("固定金额");
|
||||
break;
|
||||
case 2:
|
||||
vo.setCalculationMethodDesc("按比例");
|
||||
break;
|
||||
case 3:
|
||||
vo.setCalculationMethodDesc("按点击");
|
||||
break;
|
||||
case 4:
|
||||
vo.setCalculationMethodDesc("按展示");
|
||||
break;
|
||||
default:
|
||||
vo.setCalculationMethodDesc("未知");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PromotionFeeTypeVO> getActivePromotionFeeTypeList() {
|
||||
List<PromotionFeeTypePO> poList = promotionFeeTypeMapper.selectActiveTypeList();
|
||||
return poList.stream()
|
||||
.map(po -> {
|
||||
PromotionFeeTypeVO vo = new PromotionFeeTypeVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
|
||||
// 设置计算方式描述
|
||||
if (po.getCalculationMethod() != null) {
|
||||
switch (po.getCalculationMethod()) {
|
||||
case 1:
|
||||
vo.setCalculationMethodDesc("固定金额");
|
||||
break;
|
||||
case 2:
|
||||
vo.setCalculationMethodDesc("按比例");
|
||||
break;
|
||||
case 3:
|
||||
vo.setCalculationMethodDesc("按点击");
|
||||
break;
|
||||
case 4:
|
||||
vo.setCalculationMethodDesc("按展示");
|
||||
break;
|
||||
default:
|
||||
vo.setCalculationMethodDesc("未知");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return vo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PromotionFeeTypeVO> getAllPromotionFeeTypeList() {
|
||||
LambdaQueryWrapper<PromotionFeeTypePO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PromotionFeeTypePO::getDeleteTime, null)
|
||||
.orderByAsc(PromotionFeeTypePO::getSortOrder);
|
||||
|
||||
List<PromotionFeeTypePO> poList = promotionFeeTypeMapper.selectList(wrapper);
|
||||
return poList.stream()
|
||||
.map(po -> {
|
||||
PromotionFeeTypeVO vo = new PromotionFeeTypeVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
|
||||
// 设置计算方式描述
|
||||
if (po.getCalculationMethod() != null) {
|
||||
switch (po.getCalculationMethod()) {
|
||||
case 1:
|
||||
vo.setCalculationMethodDesc("固定金额");
|
||||
break;
|
||||
case 2:
|
||||
vo.setCalculationMethodDesc("按比例");
|
||||
break;
|
||||
case 3:
|
||||
vo.setCalculationMethodDesc("按点击");
|
||||
break;
|
||||
case 4:
|
||||
vo.setCalculationMethodDesc("按展示");
|
||||
break;
|
||||
default:
|
||||
vo.setCalculationMethodDesc("未知");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return vo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
-1
@@ -18,7 +18,6 @@ import top.xyquan.ecomdmbbackend.modules.ec.model.po.ShopPO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.model.vo.ShopVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ec.service.ShopService;
|
||||
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
|
||||
import top.xyquan.ecomdmbbackend.utils.SecurityUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
/**
|
||||
* 文件资源池管理控制器
|
||||
*/
|
||||
@Tag(name = "文件管理", description = "文件的增删改查接口")
|
||||
@Tag(name = "媒体-文件管理", description = "文件的增删改查接口")
|
||||
@RestController
|
||||
@RequestMapping("/media/file")
|
||||
public class MediaFileController {
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
/**
|
||||
* 图片资源池管理控制器
|
||||
*/
|
||||
@Tag(name = "图片管理", description = "图片的增删改查接口")
|
||||
@Tag(name = "媒体-图片管理", description = "图片的增删改查接口")
|
||||
@RestController
|
||||
@RequestMapping("/media/image")
|
||||
public class MediaImageController {
|
||||
|
||||
+6
-6
@@ -18,7 +18,7 @@ import top.xyquan.ecomdmbbackend.common.annotation.RequireRole;
|
||||
/**
|
||||
* 公司管理控制器
|
||||
*/
|
||||
@Tag(name = "公司管理", description = "公司的增删改查接口")
|
||||
@Tag(name = "组织-公司管理", description = "公司的增删改查接口")
|
||||
@RestController
|
||||
@RequestMapping("/company")
|
||||
public class CompanyController {
|
||||
@@ -31,15 +31,15 @@ public class CompanyController {
|
||||
|
||||
@Operation(summary = "创建公司", description = "创建新的公司")
|
||||
@PostMapping("/create")
|
||||
@RequireRole(description = "创建公司", allowUser = false)
|
||||
public ApiResponse<CompanyVO> createCompany(@Valid @RequestBody CreateCompanyDTO createCompanyDTO) {
|
||||
@RequireRole(description = "创建公司", allowCompany = false)
|
||||
public ApiResponse<CompanyVO> createCompany(@Valid @RequestBody CreateCompanyDTO createCompanyDTO) {
|
||||
CompanyVO companyVO = companyService.createCompany(createCompanyDTO);
|
||||
return ApiResponse.success(companyVO);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新公司", description = "更新现有公司信息")
|
||||
@PutMapping("/update/{id}")
|
||||
@RequireRole(description = "更新公司", allowUser = false)
|
||||
@RequireRole(description = "更新公司", allowCompany = false)
|
||||
public ApiResponse<CompanyVO> updateCompany(@Valid @RequestBody UpdateCompanyDTO updateCompanyDTO,
|
||||
@PathVariable Long id) {
|
||||
CompanyVO companyVO = companyService.updateCompany(updateCompanyDTO, id);
|
||||
@@ -48,7 +48,7 @@ public class CompanyController {
|
||||
|
||||
@Operation(summary = "删除公司", description = "删除指定公司")
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@RequireRole(description = "删除公司", allowUser = false)
|
||||
@RequireRole(description = "删除公司", allowCompany = false)
|
||||
public ApiResponse<Void> deleteCompany(
|
||||
@Parameter(description = "公司ID") @PathVariable Long id) {
|
||||
companyService.deleteCompany(id);
|
||||
@@ -57,7 +57,7 @@ public class CompanyController {
|
||||
|
||||
@Operation(summary = "分页查询公司列表", description = "分页查询公司列表,支持多种过滤条件")
|
||||
@PostMapping("/page")
|
||||
@RequireRole(description = "查询公司列表", allowUser = true)
|
||||
@RequireRole(description = "查询公司列表", allowCompany = false)
|
||||
public ApiResponse<PageResultVO<CompanyVO>> getCompanyPage(
|
||||
@Valid @RequestBody PageQueryDTO<CompanyFilterDTO> pageQuery) {
|
||||
PageResultVO<CompanyVO> pageResult = companyService.getCompanyPage(pageQuery);
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
/**
|
||||
* 公司菜单管理控制器
|
||||
*/
|
||||
@Tag(name = "公司菜单管理", description = "公司菜单的增删改查接口")
|
||||
@Tag(name = "组织-公司菜单管理", description = "公司菜单的增删改查接口")
|
||||
@RestController
|
||||
@RequestMapping("/company-menu")
|
||||
public class CompanyMenuController {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import top.xyquan.ecomdmbbackend.common.annotation.RequireRole;
|
||||
/**
|
||||
* 部门管理控制器
|
||||
*/
|
||||
@Tag(name = "部门管理", description = "部门的增删改查接口")
|
||||
@Tag(name = "组织-部门管理", description = "部门的增删改查接口")
|
||||
@RestController
|
||||
@RequestMapping("/department")
|
||||
public class DepartmentController {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import top.xyquan.ecomdmbbackend.common.annotation.RequireRole;
|
||||
/**
|
||||
* 岗位管理控制器
|
||||
*/
|
||||
@Tag(name = "岗位管理", description = "岗位的增删改查接口")
|
||||
@Tag(name = "组织-岗位管理", description = "岗位的增删改查接口")
|
||||
@RestController
|
||||
@RequestMapping("/position")
|
||||
public class PositionController {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import top.xyquan.ecomdmbbackend.modules.sub.service.PlanService;
|
||||
/**
|
||||
* 套餐管理控制器
|
||||
*/
|
||||
@Tag(name = "套餐管理", description = "套餐的增删改查接口")
|
||||
@Tag(name = "订阅-套餐管理", description = "套餐的增删改查接口")
|
||||
@RestController
|
||||
@RequestMapping("/plan")
|
||||
public class PlanController {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import top.xyquan.ecomdmbbackend.modules.sub.service.PlanPricingService;
|
||||
/**
|
||||
* 套餐定价管理控制器
|
||||
*/
|
||||
@Tag(name = "套餐定价管理", description = "套餐定价的增删改查接口")
|
||||
@Tag(name = "订阅-套餐定价管理", description = "套餐定价的增删改查接口")
|
||||
@RestController
|
||||
@RequestMapping("/plan-pricing")
|
||||
public class PlanPricingController {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import top.xyquan.ecomdmbbackend.modules.sub.service.SubscriptionService;
|
||||
/**
|
||||
* 订阅管理控制器
|
||||
*/
|
||||
@Tag(name = "订阅管理", description = "订阅的增删改查接口")
|
||||
@Tag(name = "订阅-订阅管理", description = "订阅的增删改查接口")
|
||||
@RestController
|
||||
@RequestMapping("/subscription")
|
||||
public class SubscriptionController {
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
/**
|
||||
* 认证控制器
|
||||
*/
|
||||
@Tag(name = "认证管理", description = "用户注册、登录等认证相关接口")
|
||||
@Tag(name = "系统-认证管理", description = "用户注册、登录等认证相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/auth")
|
||||
public class AuthController {
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
/**
|
||||
* 菜单管理控制器
|
||||
*/
|
||||
@Tag(name = "菜单管理", description = "菜单的增删改查接口")
|
||||
@Tag(name = "系统-菜单管理", description = "菜单的增删改查接口")
|
||||
@RestController
|
||||
@RequestMapping("/menu")
|
||||
public class MenuController {
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import java.util.List;
|
||||
/**
|
||||
* 权限管理控制器
|
||||
*/
|
||||
@Tag(name = "权限管理", description = "权限的增删改查接口")
|
||||
@Tag(name = "系统-权限管理", description = "权限的增删改查接口")
|
||||
@RestController
|
||||
@RequestMapping("/permission")
|
||||
public class PermissionController {
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import top.xyquan.ecomdmbbackend.modules.sys.service.UserService;
|
||||
/**
|
||||
* 用户管理控制器
|
||||
*/
|
||||
@Tag(name = "用户管理", description = "用户信息管理相关接口")
|
||||
@Tag(name = "系统-用户管理", description = "用户信息管理相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
-- 店铺表
|
||||
CREATE TABLE `ec_shop` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '店铺ID',
|
||||
`company_id` BIGINT UNSIGNED NOT NULL COMMENT '所属公司ID',
|
||||
`name` VARCHAR(200) NOT NULL COMMENT '店铺名称',
|
||||
`logo` varchar(255) DEFAULT NULL COMMENT 'logo URL',
|
||||
`platform` VARCHAR(50) DEFAULT NULL COMMENT '平台(如淘宝、京东、拼多多)',
|
||||
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`delete_time` TIMESTAMP NULL DEFAULT NULL COMMENT '删除时间',
|
||||
`create_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '更新人ID',
|
||||
`delete_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '删除人ID',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_company_id` (`company_id`),
|
||||
KEY `fk_ec_shop_creator` (`create_by`),
|
||||
KEY `fk_ec_shop_updater` (`update_by`),
|
||||
KEY `fk_ec_shop_deleter` (`delete_by`),
|
||||
CONSTRAINT `fk_ec_shop_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_shop_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_shop_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_shop_deleter` FOREIGN KEY (`delete_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='电商-店铺表';
|
||||
|
||||
-- 商品表
|
||||
CREATE TABLE `ec_product` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '商品ID',
|
||||
`company_id` BIGINT UNSIGNED NOT NULL COMMENT '公司ID',
|
||||
`name` VARCHAR(255) NOT NULL COMMENT '商品名称',
|
||||
`main_image` VARCHAR(500) DEFAULT NULL COMMENT '主图URL',
|
||||
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`delete_time` TIMESTAMP NULL DEFAULT NULL COMMENT '删除时间',
|
||||
`create_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '更新人ID',
|
||||
`delete_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '删除人ID',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_company_id` (`company_id`),
|
||||
KEY `fk_ec_product_creator` (`create_by`),
|
||||
KEY `fk_ec_product_updater` (`update_by`),
|
||||
KEY `fk_ec_product_deleter` (`delete_by`),
|
||||
CONSTRAINT `fk_ec_product_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_product_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_product_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_product_deleter` FOREIGN KEY (`delete_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='电商-商品表(含成本价)';
|
||||
|
||||
-- 商品规格表
|
||||
CREATE TABLE `ec_product_spec` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '规格ID',
|
||||
`company_id` BIGINT UNSIGNED NOT NULL COMMENT '公司ID',
|
||||
`product_id` BIGINT UNSIGNED NOT NULL COMMENT '商品ID',
|
||||
`name` VARCHAR(200) NOT NULL COMMENT '规格名称',
|
||||
`spec_code` VARCHAR(100) DEFAULT NULL COMMENT '规格编码',
|
||||
`cost_price` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '成本价',
|
||||
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`delete_time` TIMESTAMP NULL DEFAULT NULL COMMENT '删除时间',
|
||||
`create_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '更新人ID',
|
||||
`delete_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '删除人ID',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_company_id` (`company_id`),
|
||||
KEY `idx_product_id` (`product_id`),
|
||||
KEY `idx_spec_code` (`spec_code`),
|
||||
KEY `fk_ec_spec_creator` (`create_by`),
|
||||
KEY `fk_ec_spec_updater` (`update_by`),
|
||||
KEY `fk_ec_spec_deleter` (`delete_by`),
|
||||
CONSTRAINT `fk_ec_spec_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_spec_product` FOREIGN KEY (`product_id`) REFERENCES `ec_product` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_spec_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_spec_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_spec_deleter` FOREIGN KEY (`delete_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='电商-规格表';
|
||||
|
||||
-- 订单状态表
|
||||
CREATE TABLE `ec_order_status` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '状态ID',
|
||||
`status_code` TINYINT NOT NULL COMMENT '状态码',
|
||||
`status_name` VARCHAR(50) NOT NULL COMMENT '状态名称',
|
||||
`description` VARCHAR(200) DEFAULT NULL COMMENT '状态描述',
|
||||
`sort_order` INT NOT NULL DEFAULT 0 COMMENT '排序',
|
||||
`is_active` TINYINT NOT NULL DEFAULT 1 COMMENT '是否启用 0禁用 1启用',
|
||||
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`delete_time` TIMESTAMP NULL DEFAULT NULL COMMENT '删除时间',
|
||||
`create_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '更新人ID',
|
||||
`delete_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '删除人ID',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_status_code` (`status_code`),
|
||||
KEY `idx_sort_order` (`sort_order`),
|
||||
KEY `idx_is_active` (`is_active`),
|
||||
KEY `fk_ec_order_status_creator` (`create_by`),
|
||||
KEY `fk_ec_order_status_updater` (`update_by`),
|
||||
KEY `fk_ec_order_status_deleter` (`delete_by`),
|
||||
CONSTRAINT `fk_ec_order_status_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_order_status_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_order_status_deleter` FOREIGN KEY (`delete_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='电商-订单状态表';
|
||||
|
||||
-- 插入订单状态初始数据
|
||||
INSERT INTO `ec_order_status` (`status_code`, `status_name`, `description`, `sort_order`, `is_active`) VALUES
|
||||
(0, '待发货', '订单已创建,等待发货', 1, 1),
|
||||
(1, '已发货', '商品已发出,运输中', 2, 1),
|
||||
(2, '已完成', '订单已完成,交易成功', 3, 1),
|
||||
(3, '已取消', '订单已取消', 4, 1),
|
||||
(4, '退款中', '正在处理退款', 5, 1),
|
||||
(5, '已退款', '退款已完成', 6, 1);
|
||||
|
||||
-- 订单表
|
||||
CREATE TABLE `ec_order` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '订单ID',
|
||||
`company_id` BIGINT UNSIGNED NOT NULL COMMENT '公司ID',
|
||||
`shop_id` BIGINT UNSIGNED NOT NULL COMMENT '店铺ID',
|
||||
`platform_order_no` VARCHAR(100) DEFAULT NULL COMMENT '平台订单号',
|
||||
`status_id` BIGINT UNSIGNED NOT NULL COMMENT '订单状态ID',
|
||||
`received_amount` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '商家实收金额',
|
||||
`shipping_fee` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '运费',
|
||||
`order_date` TIMESTAMP NOT NULL COMMENT '下单时间',
|
||||
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`delete_time` TIMESTAMP NULL DEFAULT NULL COMMENT '删除时间',
|
||||
`create_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '更新人ID',
|
||||
`delete_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '删除人ID',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_company_shop_date` (`company_id`, `shop_id`, `order_date`),
|
||||
KEY `idx_status_id` (`status_id`),
|
||||
KEY `idx_platform_order_no` (`platform_order_no`),
|
||||
KEY `fk_ec_order_creator` (`create_by`),
|
||||
KEY `fk_ec_order_updater` (`update_by`),
|
||||
KEY `fk_ec_order_deleter` (`delete_by`),
|
||||
CONSTRAINT `fk_ec_order_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_order_shop` FOREIGN KEY (`shop_id`) REFERENCES `ec_shop` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_order_status` FOREIGN KEY (`status_id`) REFERENCES `ec_order_status` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_order_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_order_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_order_deleter` FOREIGN KEY (`delete_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='电商-订单表';
|
||||
|
||||
-- 订单明细表
|
||||
CREATE TABLE `ec_order_item` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '订单明细ID',
|
||||
`order_id` BIGINT UNSIGNED NOT NULL COMMENT '订单ID',
|
||||
`product_id` BIGINT UNSIGNED NOT NULL COMMENT '商品ID',
|
||||
`product_spec_id` BIGINT UNSIGNED DEFAULT NULL COMMENT '商品规格ID',
|
||||
`product_name` VARCHAR(255) NOT NULL COMMENT '商品名称(冗余存储)',
|
||||
`spec_name` VARCHAR(200) DEFAULT NULL COMMENT '规格名称(冗余存储)',
|
||||
`quantity` INT NOT NULL DEFAULT 1 COMMENT '数量',
|
||||
`unit_price` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '销售单价',
|
||||
`cost_price` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '成本价(下单时快照)',
|
||||
`subtotal` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '小计金额',
|
||||
`cost_total` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '成本小计',
|
||||
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`delete_time` TIMESTAMP NULL DEFAULT NULL COMMENT '删除时间',
|
||||
`create_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '更新人ID',
|
||||
`delete_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '删除人ID',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_order_id` (`order_id`),
|
||||
KEY `idx_product_id` (`product_id`),
|
||||
KEY `idx_product_spec_id` (`product_spec_id`),
|
||||
KEY `fk_ec_order_item_creator` (`create_by`),
|
||||
KEY `fk_ec_order_item_updater` (`update_by`),
|
||||
KEY `fk_ec_order_item_deleter` (`delete_by`),
|
||||
CONSTRAINT `fk_ec_order_item_order` FOREIGN KEY (`order_id`) REFERENCES `ec_order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_order_item_product` FOREIGN KEY (`product_id`) REFERENCES `ec_product` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_order_item_product_spec` FOREIGN KEY (`product_spec_id`) REFERENCES `ec_product_spec` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_order_item_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_order_item_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_order_item_deleter` FOREIGN KEY (`delete_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='电商-订单明细表';
|
||||
|
||||
-- 推广费类型表
|
||||
CREATE TABLE `ec_promotion_fee_type` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '推广费类型ID',
|
||||
`type_code` VARCHAR(50) NOT NULL COMMENT '类型编码',
|
||||
`type_name` VARCHAR(100) NOT NULL COMMENT '类型名称',
|
||||
`description` VARCHAR(200) DEFAULT NULL COMMENT '类型描述',
|
||||
`calculation_method` TINYINT NOT NULL DEFAULT 1 COMMENT '计算方式 1固定金额 2按比例 3按点击 4按展示',
|
||||
`sort_order` INT NOT NULL DEFAULT 0 COMMENT '排序',
|
||||
`is_active` TINYINT NOT NULL DEFAULT 1 COMMENT '是否启用 0禁用 1启用',
|
||||
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`delete_time` TIMESTAMP NULL DEFAULT NULL COMMENT '删除时间',
|
||||
`create_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '更新人ID',
|
||||
`delete_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '删除人ID',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_type_code` (`type_code`),
|
||||
KEY `idx_sort_order` (`sort_order`),
|
||||
KEY `idx_is_active` (`is_active`),
|
||||
KEY `fk_ec_promotion_fee_type_creator` (`create_by`),
|
||||
KEY `fk_ec_promotion_fee_type_updater` (`update_by`),
|
||||
KEY `fk_ec_promotion_fee_type_deleter` (`delete_by`),
|
||||
CONSTRAINT `fk_ec_promotion_fee_type_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_promotion_fee_type_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_promotion_fee_type_deleter` FOREIGN KEY (`delete_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='电商-推广费类型表';
|
||||
|
||||
-- 推广费记录表
|
||||
CREATE TABLE `ec_promotion_fee` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '推广费记录ID',
|
||||
`company_id` BIGINT UNSIGNED NOT NULL COMMENT '公司ID',
|
||||
`shop_id` BIGINT UNSIGNED NOT NULL COMMENT '店铺ID',
|
||||
`fee_type_id` BIGINT UNSIGNED NOT NULL COMMENT '推广费类型ID',
|
||||
`fee_name` VARCHAR(200) NOT NULL COMMENT '推广费名称',
|
||||
`platform` VARCHAR(50) DEFAULT NULL COMMENT '平台(淘宝、京东、拼多多等)',
|
||||
`campaign_name` VARCHAR(200) DEFAULT NULL COMMENT '推广活动名称',
|
||||
`fee_amount` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '推广费金额',
|
||||
`base_amount` DECIMAL(10,2) DEFAULT NULL COMMENT '基础金额(用于按比例计算)',
|
||||
`fee_rate` DECIMAL(5,4) DEFAULT NULL COMMENT '费率(用于按比例计算)',
|
||||
`click_count` INT DEFAULT NULL COMMENT '点击次数',
|
||||
`impression_count` INT DEFAULT NULL COMMENT '展示次数',
|
||||
`conversion_count` INT DEFAULT NULL COMMENT '转化次数',
|
||||
`fee_date` DATE NOT NULL COMMENT '推广费发生日期',
|
||||
`remark` VARCHAR(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`delete_time` TIMESTAMP NULL DEFAULT NULL COMMENT '删除时间',
|
||||
`create_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '更新人ID',
|
||||
`delete_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '删除人ID',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_company_id` (`company_id`),
|
||||
KEY `idx_shop_id` (`shop_id`),
|
||||
KEY `idx_fee_type_id` (`fee_type_id`),
|
||||
KEY `idx_fee_date` (`fee_date`),
|
||||
KEY `idx_platform` (`platform`),
|
||||
KEY `fk_ec_promotion_fee_creator` (`create_by`),
|
||||
KEY `fk_ec_promotion_fee_updater` (`update_by`),
|
||||
KEY `fk_ec_promotion_fee_deleter` (`delete_by`),
|
||||
CONSTRAINT `fk_ec_promotion_fee_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_promotion_fee_shop` FOREIGN KEY (`shop_id`) REFERENCES `ec_shop` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_promotion_fee_type` FOREIGN KEY (`fee_type_id`) REFERENCES `ec_promotion_fee_type` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_promotion_fee_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_promotion_fee_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_promotion_fee_deleter` FOREIGN KEY (`delete_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='电商-推广费记录表';
|
||||
|
||||
-- 插入推广费类型初始数据
|
||||
INSERT INTO `ec_promotion_fee_type` (`type_code`, `type_name`, `description`, `calculation_method`, `sort_order`, `is_active`) VALUES
|
||||
('DIRECT_TRAFFIC', '直通车', '淘宝直通车推广费用', 3, 1, 1),
|
||||
('DIAMOND_DISPLAY', '钻展', '钻石展位推广费用', 4, 2, 1),
|
||||
('SUPER_RECOMMEND', '超级推荐', '超级推荐推广费用', 3, 3, 1),
|
||||
('PLATFORM_COMMISSION', '平台佣金', '平台交易佣金', 2, 4, 1),
|
||||
('DISTRIBUTION_COMMISSION', '分销佣金', '分销商佣金', 2, 5, 1),
|
||||
('ACTIVITY_FEE', '活动费用', '平台活动参与费用', 1, 6, 1),
|
||||
('EXTERNAL_AD', '站外广告', '站外广告投放费用', 1, 7, 1),
|
||||
('LIVE_STREAMING', '直播推广', '直播推广费用', 1, 8, 1);
|
||||
@@ -0,0 +1,33 @@
|
||||
CREATE TABLE `media_file` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`company_id` bigint unsigned NOT NULL,
|
||||
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '文件URL',
|
||||
`filename` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '文件名',
|
||||
`file_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '文件类型,如 PDF/CAD/Excel',
|
||||
`tags` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '标签,逗号分隔',
|
||||
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '文件描述',
|
||||
`upload_by` bigint unsigned DEFAULT NULL COMMENT '上传人ID',
|
||||
`upload_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `fk_media_file_company` (`company_id`) USING BTREE,
|
||||
KEY `fk_media_file_uploader` (`upload_by`) USING BTREE,
|
||||
CONSTRAINT `fk_media_file_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_media_file_uploader` FOREIGN KEY (`upload_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='文件资源池表';
|
||||
|
||||
CREATE TABLE `media_image` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`company_id` bigint unsigned NOT NULL,
|
||||
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '图片URL',
|
||||
`filename` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '原始文件名',
|
||||
`type` enum('设计图','实物图','细节图','工艺图','其他') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '其他' COMMENT '图片分类',
|
||||
`tags` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '标签,逗号分隔如 spring,工艺图,客户A',
|
||||
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '图片说明',
|
||||
`upload_by` bigint unsigned DEFAULT NULL COMMENT '上传人ID',
|
||||
`upload_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '上传时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `fk_media_image_company` (`company_id`) USING BTREE,
|
||||
KEY `fk_media_image_uploader` (`upload_by`) USING BTREE,
|
||||
CONSTRAINT `fk_media_image_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_media_image_uploader` FOREIGN KEY (`upload_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='图片资源池表';
|
||||
@@ -0,0 +1,105 @@
|
||||
CREATE TABLE `org_company` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '公司 id',
|
||||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '公司名称',
|
||||
`expiration` datetime DEFAULT NULL COMMENT '订阅到期时间',
|
||||
`address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '公司地址',
|
||||
`contact_person` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '联系人',
|
||||
`contact_phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '联系电话',
|
||||
`email` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '邮箱',
|
||||
`logo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT 'logo',
|
||||
`status` int NOT NULL DEFAULT '1' COMMENT '状态 (0-禁用 1-正常)',
|
||||
`expire_time` timestamp NULL DEFAULT NULL COMMENT '订阅到期时间',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_by` bigint unsigned DEFAULT NULL COMMENT '创建人 id',
|
||||
`update_by` bigint unsigned DEFAULT NULL COMMENT '更新人 id',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `fk_org_company_creator` (`create_by`) USING BTREE,
|
||||
KEY `fk_org_company_updater` (`update_by`) USING BTREE,
|
||||
CONSTRAINT `fk_org_company_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_org_company_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统模块-公司表';
|
||||
|
||||
CREATE TABLE `org_company_menu` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '关联ID',
|
||||
`company_id` bigint unsigned NOT NULL COMMENT '公司ID',
|
||||
`parent_id` bigint unsigned DEFAULT NULL COMMENT '父级ID',
|
||||
`menu_id` bigint unsigned NOT NULL COMMENT '菜单ID',
|
||||
`status` tinyint NOT NULL DEFAULT '1' COMMENT '状态 (0-禁用 1-启用)',
|
||||
`custom_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '公司自定义菜单名称',
|
||||
`custom_title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '公司自定义菜单标题',
|
||||
`custom_icon` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '公司自定义菜单图标',
|
||||
`custom_order` int DEFAULT NULL COMMENT '公司自定义排序',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_by` bigint unsigned DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_by` bigint unsigned DEFAULT NULL COMMENT '更新人ID',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `fk_org_company_menu_parent` (`parent_id`) USING BTREE,
|
||||
KEY `fk_org_company_menu_company` (`company_id`) USING BTREE,
|
||||
KEY `fk_org_company_menu_menu` (`menu_id`) USING BTREE,
|
||||
KEY `fk_org_company_menu_creator` (`create_by`) USING BTREE,
|
||||
KEY `fk_org_company_menu_updater` (`update_by`) USING BTREE,
|
||||
CONSTRAINT `fk_org_company_menu_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_org_company_menu_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_org_company_menu_menu` FOREIGN KEY (`menu_id`) REFERENCES `sys_menu` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_org_company_menu_parent` FOREIGN KEY (`parent_id`) REFERENCES `org_company_menu` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_org_company_menu_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='公司菜单权限关联表';
|
||||
|
||||
CREATE TABLE `org_department` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '部门 id',
|
||||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '部门名称',
|
||||
`parent_id` bigint unsigned DEFAULT NULL COMMENT '部门父级 id',
|
||||
`company_id` bigint unsigned NOT NULL COMMENT '公司 id',
|
||||
`remark` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述',
|
||||
`status` int NOT NULL DEFAULT '1' COMMENT '状态',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_by` bigint unsigned DEFAULT NULL COMMENT '创建人',
|
||||
`update_by` bigint unsigned DEFAULT NULL COMMENT '更新人',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `fk_org_department_parent` (`parent_id`) USING BTREE,
|
||||
KEY `fk_org_department_company` (`company_id`) USING BTREE,
|
||||
KEY `fk_org_department_creator` (`create_by`) USING BTREE,
|
||||
KEY `fk_org_department_updater` (`update_by`) USING BTREE,
|
||||
CONSTRAINT `fk_org_department_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_org_department_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_org_department_parent` FOREIGN KEY (`parent_id`) REFERENCES `org_department` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_org_department_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统模块-部门表';
|
||||
|
||||
CREATE TABLE `org_position` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '岗位ID',
|
||||
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '岗位名称',
|
||||
`position_sign` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '岗位标识',
|
||||
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '岗位描述',
|
||||
`status` tinyint NOT NULL DEFAULT '1' COMMENT '状态:(1-启用,0-禁用)',
|
||||
`company_id` bigint unsigned NOT NULL COMMENT '公司ID',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_by` bigint unsigned DEFAULT NULL COMMENT '创建者ID',
|
||||
`update_by` bigint unsigned DEFAULT NULL COMMENT '更新者ID',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `fk_org_position_company` (`company_id`) USING BTREE,
|
||||
KEY `fk_org_position_creator` (`create_by`) USING BTREE,
|
||||
KEY `fk_org_position_updater` (`update_by`) USING BTREE,
|
||||
CONSTRAINT `fk_org_position_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_org_position_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_org_position_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='岗位表';
|
||||
|
||||
CREATE TABLE `org_position_company_menu_map` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`position_id` bigint unsigned NOT NULL COMMENT '岗位ID',
|
||||
`company_menu_id` bigint unsigned NOT NULL COMMENT '公司菜单权限ID',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`create_by` bigint unsigned NOT NULL COMMENT '创建人ID',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `uk_position_menu` (`position_id`,`company_menu_id`) USING BTREE,
|
||||
KEY `fk_rel_position_company_menu_menu` (`company_menu_id`) USING BTREE,
|
||||
KEY `fk_rel_position_company_menu_creator` (`create_by`) USING BTREE,
|
||||
CONSTRAINT `fk_rel_position_company_menu_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_rel_position_company_menu_menu` FOREIGN KEY (`company_menu_id`) REFERENCES `org_company_menu` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_rel_position_company_menu_position` FOREIGN KEY (`position_id`) REFERENCES `org_position` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='岗位与公司菜单权限中间表';
|
||||
@@ -0,0 +1,68 @@
|
||||
CREATE TABLE `sub_plan` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '套餐ID',
|
||||
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '套餐名称',
|
||||
`user_limit` int DEFAULT NULL COMMENT '用户数量限制,NULL 表示不限',
|
||||
`is_trial` tinyint NOT NULL DEFAULT '0' COMMENT '是否为试用套餐 (1-是 0-否)',
|
||||
`trial_days` int DEFAULT NULL COMMENT '试用天数,仅 is_trial = 1 时有效',
|
||||
`status` tinyint NOT NULL DEFAULT '1' COMMENT '状态:(1-可购买 0-下架)',
|
||||
`remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '套餐描述',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_by` bigint unsigned DEFAULT NULL COMMENT '创建人 id',
|
||||
`update_by` bigint unsigned DEFAULT NULL COMMENT '更新人 id',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `fk_sub_plan_creator` (`create_by`) USING BTREE,
|
||||
KEY `fk_sub_plan_updater` (`update_by`) USING BTREE,
|
||||
CONSTRAINT `fk_sub_plan_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_sub_plan_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='订阅套餐定义表';
|
||||
|
||||
CREATE TABLE `sub_plan_pricing` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '定价ID',
|
||||
`plan_id` bigint unsigned NOT NULL COMMENT '对应套餐ID',
|
||||
`price` decimal(10,2) NOT NULL COMMENT '价格(元)',
|
||||
`duration_months` int NOT NULL DEFAULT '1' COMMENT '订阅时长(月)',
|
||||
`stauts` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用当前价格(1-启用,0-禁用)',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_by` bigint unsigned DEFAULT NULL COMMENT '创建人 id',
|
||||
`update_by` bigint unsigned DEFAULT NULL COMMENT '更新人 id',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `idx_plan_id` (`plan_id`) USING BTREE,
|
||||
KEY `fk_sub_plan_pricing_creator` (`create_by`) USING BTREE,
|
||||
KEY `fk_sub_plan_pricing_updater` (`update_by`) USING BTREE,
|
||||
CONSTRAINT `fk_sub_plan_pricing_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_sub_plan_pricing_plan` FOREIGN KEY (`plan_id`) REFERENCES `sub_plan` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_sub_plan_pricing_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='订阅套餐定价表';
|
||||
|
||||
CREATE TABLE `sub_subscription` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '记录ID',
|
||||
`company_id` bigint unsigned NOT NULL COMMENT '公司ID(关联sys_company)',
|
||||
`plan_id` bigint unsigned NOT NULL COMMENT '套餐ID(关联sub_plan)',
|
||||
`start_time` timestamp NOT NULL COMMENT '订阅开始时间',
|
||||
`end_time` timestamp NOT NULL COMMENT '订阅结束时间',
|
||||
`status` enum('ACTIVE','PENDING','INACTIVE') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'ACTIVE' COMMENT '生效状态(ACTIVE-生效中,PENDING-待生效,INACTIVE-已失效)',
|
||||
`paid_amount` decimal(10,2) DEFAULT '0.00' COMMENT '实际支付金额',
|
||||
`payment_status` enum('UNPAID','PAID','REFUNDED') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'UNPAID' COMMENT '支付状态(UNPAID=未支付,PAID=已支付,REFUNDED=已退款)',
|
||||
`payment_time` datetime DEFAULT NULL COMMENT '支付时间',
|
||||
`order_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '第三方支付订单号',
|
||||
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '备注',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`delete_time` timestamp NULL DEFAULT NULL COMMENT '删除时间',
|
||||
`create_by` bigint unsigned DEFAULT NULL COMMENT '创建人 id',
|
||||
`update_by` bigint unsigned DEFAULT NULL COMMENT '更新人 id',
|
||||
`delete_by` bigint unsigned DEFAULT NULL COMMENT '删除人 id',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `fk_sub_subscription_company` (`company_id`) USING BTREE,
|
||||
KEY `fk_sub_subscription_plan` (`plan_id`) USING BTREE,
|
||||
KEY `fk_sub_subscription_creator` (`create_by`) USING BTREE,
|
||||
KEY `fk_sub_subscription_updater` (`update_by`) USING BTREE,
|
||||
KEY `fk_sub_subscription_deleter` (`delete_by`) USING BTREE,
|
||||
CONSTRAINT `fk_sub_subscription_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_sub_subscription_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_sub_subscription_deleter` FOREIGN KEY (`delete_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_sub_subscription_plan` FOREIGN KEY (`plan_id`) REFERENCES `sub_plan` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_sub_subscription_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='订阅记录表中间表';
|
||||
@@ -0,0 +1,97 @@
|
||||
CREATE TABLE `sys_user` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
||||
`company_id` bigint unsigned DEFAULT NULL COMMENT '公司 id',
|
||||
`department_id` bigint unsigned DEFAULT NULL COMMENT '部门 id',
|
||||
`position_id` bigint unsigned DEFAULT NULL COMMENT '岗位 id',
|
||||
`login_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '登录账号',
|
||||
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '登录密码',
|
||||
`phone` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '手机号码',
|
||||
`real_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '用户名称',
|
||||
`avatar` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '头像路径',
|
||||
`role` enum('user','admin','super') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT 'user' COMMENT '关联角色(user-普通账户 admin-公司管理员 super-超管账户)',
|
||||
`pwd_security_level` tinyint unsigned DEFAULT NULL COMMENT '密码安全级别(0-初始 1-很弱 2-弱 3-安全 4-很安全)',
|
||||
`pwd_update_time` timestamp NULL DEFAULT NULL COMMENT '密码最后更新时间',
|
||||
`last_login_ip` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '最后登录 ip',
|
||||
`last_login_date` timestamp NULL DEFAULT NULL COMMENT '最后登录时间',
|
||||
`freeze_date` timestamp NULL DEFAULT NULL COMMENT '冻结时间',
|
||||
`freeze_cause` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '冻结原因',
|
||||
`status` tinyint unsigned DEFAULT NULL COMMENT '状态(0-正常 1-删除 2-停用 3-冻结)',
|
||||
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '备注信息',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_by` bigint unsigned DEFAULT NULL COMMENT '创建者',
|
||||
`update_by` bigint unsigned DEFAULT NULL COMMENT '更新者',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `uk_login_code` (`login_code`) USING BTREE,
|
||||
UNIQUE KEY `uk_phone` (`login_code`) USING BTREE,
|
||||
KEY `idx_role` (`role`) USING BTREE,
|
||||
KEY `idx_status` (`status`) USING BTREE,
|
||||
KEY `fk_user_company` (`company_id`) USING BTREE,
|
||||
KEY `fk_user_department` (`department_id`) USING BTREE,
|
||||
KEY `fk_user_position` (`position_id`) USING BTREE,
|
||||
CONSTRAINT `fk_user_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_user_department` FOREIGN KEY (`department_id`) REFERENCES `org_department` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_user_position` FOREIGN KEY (`position_id`) REFERENCES `org_position` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统模块-用户表';
|
||||
|
||||
CREATE TABLE `sys_menu` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '菜单 id',
|
||||
`parent_id` bigint unsigned DEFAULT NULL COMMENT '父菜单 id',
|
||||
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '菜单名称',
|
||||
`title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '菜单标题',
|
||||
`path` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '路由路径',
|
||||
`component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '页面组件',
|
||||
`redirect` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '从定向地址',
|
||||
`icon` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '路由图标',
|
||||
`order` int DEFAULT '0' COMMENT '顺序',
|
||||
`type` enum('catalog','menu','button','embedded','link') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '菜单类型 (目录,菜单,按钮,内联,外链)',
|
||||
`visible` tinyint NOT NULL DEFAULT '1' COMMENT '是否显示在菜单中 (0-否 1-是)',
|
||||
`status` tinyint NOT NULL DEFAULT '1' COMMENT '状态 (0-禁用 1-启用)',
|
||||
`keep_alive` tinyint DEFAULT '0' COMMENT '是否缓存',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_by` bigint unsigned DEFAULT NULL COMMENT '创建人 id',
|
||||
`update_by` bigint unsigned DEFAULT NULL COMMENT '更新人 id',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `fk_nemu_parent` (`parent_id`) USING BTREE,
|
||||
KEY `fk_nemu_creator` (`create_by`) USING BTREE,
|
||||
KEY `fk_nemu_updater` (`update_by`) USING BTREE,
|
||||
CONSTRAINT `fk_nemu_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_nemu_parent` FOREIGN KEY (`parent_id`) REFERENCES `sys_menu` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_nemu_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统模块-菜单权限表';
|
||||
|
||||
CREATE TABLE `sys_permission` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '权限ID',
|
||||
`code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '权限码(唯一标识,如 user:add, order:approve)',
|
||||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '权限名称(用于显示,如 用户新增、订单审核)',
|
||||
`type` enum('api','button','data') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'api' COMMENT '权限类型(api-接口权限,button-按钮权限,data-数据权限)',
|
||||
`status` tinyint NOT NULL DEFAULT '1' COMMENT '状态:1-启用 0-禁用',
|
||||
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '备注',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_by` bigint unsigned DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_by` bigint unsigned DEFAULT NULL COMMENT '更新人ID',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `uk_code` (`code`) USING BTREE,
|
||||
KEY `fk_permission_creator` (`create_by`) USING BTREE,
|
||||
KEY `fk_permission_updater` (`update_by`) USING BTREE,
|
||||
CONSTRAINT `fk_permission_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_permission_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统模块-权限定义表';
|
||||
|
||||
CREATE TABLE `sys_menu_permission_map` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`menu_id` bigint unsigned NOT NULL COMMENT '菜单ID',
|
||||
`permission_id` bigint unsigned NOT NULL COMMENT '权限ID',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`create_by` bigint unsigned DEFAULT NULL COMMENT '创建人ID',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `uk_menu_permission` (`menu_id`,`permission_id`) USING BTREE,
|
||||
KEY `fk_menu_permission_menu` (`menu_id`) USING BTREE,
|
||||
KEY `fk_menu_permission_permission` (`permission_id`) USING BTREE,
|
||||
KEY `fk_menu_permission_creator` (`create_by`) USING BTREE,
|
||||
CONSTRAINT `fk_menu_permission_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_menu_permission_menu` FOREIGN KEY (`menu_id`) REFERENCES `sys_menu` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_menu_permission_permission` FOREIGN KEY (`permission_id`) REFERENCES `sys_permission` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='菜单与权限关联表';
|
||||
Reference in New Issue
Block a user