feat: 初始化后端项目基础架构
添加项目基础配置文件和目录结构 实现用户、角色、权限等核心模块的实体类、Mapper接口和服务层 配置数据库连接和MyBatis-Plus支持 添加统一响应格式和异常处理机制
This commit is contained in:
83
src/main/java/com/qf/backend/service/OrderItemsService.java
Normal file
83
src/main/java/com/qf/backend/service/OrderItemsService.java
Normal file
@@ -0,0 +1,83 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.entity.OrderItems;
|
||||
|
||||
/**
|
||||
* 订单项服务接口
|
||||
*/
|
||||
public interface OrderItemsService extends IService<OrderItems> {
|
||||
|
||||
/**
|
||||
* 根据订单ID查询订单项
|
||||
* @param orderId 订单ID
|
||||
* @return 订单项列表
|
||||
*/
|
||||
Result<List<OrderItems>> getOrderItemsByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 根据商品ID查询订单项
|
||||
* @param productId 商品ID
|
||||
* @return 订单项列表
|
||||
*/
|
||||
Result<List<OrderItems>> getOrderItemsByProductId(Long productId);
|
||||
|
||||
/**
|
||||
* 创建订单项
|
||||
* @param orderItems 订单项信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> createOrderItem(OrderItems orderItems);
|
||||
|
||||
/**
|
||||
* 更新订单项信息
|
||||
* @param orderItems 订单项信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateOrderItem(OrderItems orderItems);
|
||||
|
||||
/**
|
||||
* 删除订单项
|
||||
* @param id 订单项ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteOrderItem(Long id);
|
||||
|
||||
/**
|
||||
* 根据订单项ID查询订单项
|
||||
* @param id 订单项ID
|
||||
* @return 订单项信息
|
||||
*/
|
||||
Result<OrderItems> getOrderItemById(Long id);
|
||||
|
||||
/**
|
||||
* 批量创建订单项
|
||||
* @param orderItemsList 订单项列表
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> batchCreateOrderItems(List<OrderItems> orderItemsList);
|
||||
|
||||
/**
|
||||
* 根据订单ID删除所有订单项
|
||||
* @param orderId 订单ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteOrderItemsByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 计算订单总金额
|
||||
* @param orderId 订单ID
|
||||
* @return 订单总金额
|
||||
*/
|
||||
Result<Double> calculateOrderTotal(Long orderId);
|
||||
|
||||
/**
|
||||
* 根据SKU ID查询订单项
|
||||
* @param skuId SKU ID
|
||||
* @return 订单项列表
|
||||
*/
|
||||
Result<List<OrderItems>> getOrderItemsBySkuId(Long skuId);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.entity.OrderStatusHistory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单状态历史服务接口
|
||||
*/
|
||||
public interface OrderStatusHistoryService extends IService<OrderStatusHistory> {
|
||||
|
||||
/**
|
||||
* 根据订单ID查询状态历史
|
||||
* @param orderId 订单ID
|
||||
* @return 订单状态历史列表
|
||||
*/
|
||||
Result<List<OrderStatusHistory>> getHistoryByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 创建订单状态历史记录
|
||||
* @param orderStatusHistory 订单状态历史信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> createStatusHistory(OrderStatusHistory orderStatusHistory);
|
||||
|
||||
/**
|
||||
* 更新订单状态历史信息
|
||||
* @param orderStatusHistory 订单状态历史信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateStatusHistory(OrderStatusHistory orderStatusHistory);
|
||||
|
||||
/**
|
||||
* 删除订单状态历史记录
|
||||
* @param id 记录ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteStatusHistory(Long id);
|
||||
|
||||
/**
|
||||
* 根据记录ID查询订单状态历史
|
||||
* @param id 记录ID
|
||||
* @return 订单状态历史信息
|
||||
*/
|
||||
Result<OrderStatusHistory> getStatusHistoryById(Long id);
|
||||
|
||||
/**
|
||||
* 批量创建订单状态历史记录
|
||||
* @param historyList 订单状态历史列表
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> batchCreateStatusHistory(List<OrderStatusHistory> historyList);
|
||||
|
||||
/**
|
||||
* 根据订单ID和状态查询历史记录
|
||||
* @param orderId 订单ID
|
||||
* @param status 订单状态
|
||||
* @return 订单状态历史列表
|
||||
*/
|
||||
Result<List<OrderStatusHistory>> getHistoryByOrderIdAndStatus(Long orderId, Integer status);
|
||||
|
||||
/**
|
||||
* 获取订单最新状态
|
||||
* @param orderId 订单ID
|
||||
* @return 最新订单状态历史信息
|
||||
*/
|
||||
Result<OrderStatusHistory> getLatestStatusHistory(Long orderId);
|
||||
|
||||
/**
|
||||
* 根据订单ID删除所有状态历史
|
||||
* @param orderId 订单ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteHistoryByOrderId(Long orderId);
|
||||
}
|
||||
85
src/main/java/com/qf/backend/service/OrdersService.java
Normal file
85
src/main/java/com/qf/backend/service/OrdersService.java
Normal file
@@ -0,0 +1,85 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.entity.Orders;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单服务接口
|
||||
*/
|
||||
public interface OrdersService extends IService<Orders> {
|
||||
|
||||
/**
|
||||
* 根据订单号查询订单
|
||||
* @param orderNumber 订单号
|
||||
* @return 订单信息
|
||||
*/
|
||||
Result<Orders> getOrderByNumber(String orderNumber);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询订单列表
|
||||
* @param userId 用户ID
|
||||
* @return 订单列表
|
||||
*/
|
||||
Result<List<Orders>> getOrdersByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 创建订单
|
||||
* @param orders 订单信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> createOrder(Orders orders);
|
||||
|
||||
/**
|
||||
* 更新订单信息
|
||||
* @param orders 订单信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateOrder(Orders orders);
|
||||
|
||||
/**
|
||||
* 删除订单
|
||||
* @param id 订单ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteOrder(Long id);
|
||||
|
||||
/**
|
||||
* 根据订单ID查询订单
|
||||
* @param id 订单ID
|
||||
* @return 订单信息
|
||||
*/
|
||||
Result<Orders> getOrderById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询订单
|
||||
* @param page 当前页码
|
||||
* @param size 每页数量
|
||||
* @return 订单列表
|
||||
*/
|
||||
Result<List<Orders>> listOrdersByPage(int page, int size);
|
||||
|
||||
/**
|
||||
* 根据店铺ID查询订单
|
||||
* @param shopId 店铺ID
|
||||
* @return 订单列表
|
||||
*/
|
||||
Result<List<Orders>> getOrdersByShopId(Long shopId);
|
||||
|
||||
/**
|
||||
* 更新订单状态
|
||||
* @param orderId 订单ID
|
||||
* @param status 订单状态
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateOrderStatus(Long orderId, Integer status);
|
||||
|
||||
/**
|
||||
* 根据订单状态查询订单
|
||||
* @param status 订单状态
|
||||
* @return 订单列表
|
||||
*/
|
||||
Result<List<Orders>> getOrdersByStatus(Integer status);
|
||||
}
|
||||
84
src/main/java/com/qf/backend/service/PaymentsService.java
Normal file
84
src/main/java/com/qf/backend/service/PaymentsService.java
Normal file
@@ -0,0 +1,84 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.entity.Payments;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 支付服务接口
|
||||
*/
|
||||
public interface PaymentsService extends IService<Payments> {
|
||||
|
||||
/**
|
||||
* 根据订单ID查询支付记录
|
||||
* @param orderId 订单ID
|
||||
* @return 支付记录
|
||||
*/
|
||||
Payments getPaymentByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 根据支付流水号查询支付记录
|
||||
* @param transactionId 支付流水号
|
||||
* @return 支付记录
|
||||
*/
|
||||
Payments getPaymentByTransactionId(String transactionId);
|
||||
|
||||
/**
|
||||
* 创建支付记录
|
||||
* @param payments 支付信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean createPayment(Payments payments);
|
||||
|
||||
/**
|
||||
* 更新支付信息
|
||||
* @param payments 支付信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updatePayment(Payments payments);
|
||||
|
||||
/**
|
||||
* 删除支付记录
|
||||
* @param id 支付ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deletePayment(Long id);
|
||||
|
||||
/**
|
||||
* 根据支付ID查询支付记录
|
||||
* @param id 支付ID
|
||||
* @return 支付记录
|
||||
*/
|
||||
Payments getPaymentById(Long id);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询支付记录
|
||||
* @param userId 用户ID
|
||||
* @return 支付记录列表
|
||||
*/
|
||||
List<Payments> getPaymentsByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据支付状态查询支付记录
|
||||
* @param status 支付状态
|
||||
* @return 支付记录列表
|
||||
*/
|
||||
List<Payments> getPaymentsByStatus(Integer status);
|
||||
|
||||
/**
|
||||
* 更新支付状态
|
||||
* @param paymentId 支付ID
|
||||
* @param status 支付状态
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updatePaymentStatus(Long paymentId, Integer status);
|
||||
|
||||
/**
|
||||
* 分页查询支付记录
|
||||
* @param page 当前页码
|
||||
* @param size 每页数量
|
||||
* @return 支付记录列表
|
||||
*/
|
||||
List<Payments> listPaymentsByPage(int page, int size);
|
||||
}
|
||||
74
src/main/java/com/qf/backend/service/PermissionsService.java
Normal file
74
src/main/java/com/qf/backend/service/PermissionsService.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.entity.Permissions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 权限服务接口
|
||||
*/
|
||||
public interface PermissionsService extends IService<Permissions> {
|
||||
|
||||
/**
|
||||
* 根据权限编码查询权限
|
||||
* @param permissionCode 权限编码
|
||||
* @return 权限信息
|
||||
*/
|
||||
Permissions getPermissionByCode(String permissionCode);
|
||||
|
||||
/**
|
||||
* 创建权限
|
||||
* @param permissions 权限信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean createPermission(Permissions permissions);
|
||||
|
||||
/**
|
||||
* 更新权限信息
|
||||
* @param permissions 权限信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updatePermission(Permissions permissions);
|
||||
|
||||
/**
|
||||
* 删除权限
|
||||
* @param id 权限ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deletePermission(Long id);
|
||||
|
||||
/**
|
||||
* 查询所有权限
|
||||
* @return 权限列表
|
||||
*/
|
||||
List<Permissions> listAllPermissions();
|
||||
|
||||
/**
|
||||
* 根据权限ID查询权限
|
||||
* @param id 权限ID
|
||||
* @return 权限信息
|
||||
*/
|
||||
Permissions getPermissionById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除权限
|
||||
* @param ids 权限ID列表
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean batchDeletePermissions(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据菜单ID查询权限
|
||||
* @param menuId 菜单ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
List<Permissions> listPermissionsByMenuId(Long menuId);
|
||||
|
||||
/**
|
||||
* 根据权限类型查询权限
|
||||
* @param permissionType 权限类型
|
||||
* @return 权限列表
|
||||
*/
|
||||
List<Permissions> listPermissionsByType(String permissionType);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.entity.ProductAttributeValues;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品属性值服务接口
|
||||
*/
|
||||
public interface ProductAttributeValuesService extends IService<ProductAttributeValues> {
|
||||
|
||||
/**
|
||||
* 根据商品ID查询属性值
|
||||
* @param productId 商品ID
|
||||
* @return 属性值列表
|
||||
*/
|
||||
Result<List<ProductAttributeValues>> getAttributeValuesByProductId(Long productId);
|
||||
|
||||
/**
|
||||
* 根据属性ID查询属性值
|
||||
* @param attributeId 属性ID
|
||||
* @return 属性值列表
|
||||
*/
|
||||
Result<List<ProductAttributeValues>> getAttributeValuesByAttributeId(Long attributeId);
|
||||
|
||||
/**
|
||||
* 创建属性值
|
||||
* @param productAttributeValues 属性值信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> createAttributeValue(ProductAttributeValues productAttributeValues);
|
||||
|
||||
/**
|
||||
* 更新属性值信息
|
||||
* @param productAttributeValues 属性值信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateAttributeValue(ProductAttributeValues productAttributeValues);
|
||||
|
||||
/**
|
||||
* 删除属性值
|
||||
* @param id 属性值ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteAttributeValue(Long id);
|
||||
|
||||
/**
|
||||
* 根据属性值ID查询属性值
|
||||
* @param id 属性值ID
|
||||
* @return 属性值信息
|
||||
*/
|
||||
Result<ProductAttributeValues> getAttributeValueById(Long id);
|
||||
|
||||
/**
|
||||
* 批量创建商品属性值
|
||||
* @param attributeValues 属性值列表
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> batchCreateAttributeValues(List<ProductAttributeValues> attributeValues);
|
||||
|
||||
/**
|
||||
* 根据商品ID和属性ID查询属性值
|
||||
* @param productId 商品ID
|
||||
* @param attributeId 属性ID
|
||||
* @return 属性值信息
|
||||
*/
|
||||
Result<ProductAttributeValues> getAttributeValueByProductAndAttribute(Long productId, Long attributeId);
|
||||
|
||||
/**
|
||||
* 根据商品ID删除所有属性值
|
||||
* @param productId 商品ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteAttributeValuesByProductId(Long productId);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.entity.ProductAttributes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品属性服务接口
|
||||
*/
|
||||
public interface ProductAttributesService extends IService<ProductAttributes> {
|
||||
|
||||
/**
|
||||
* 根据分类ID查询属性
|
||||
* @param categoryId 分类ID
|
||||
* @return 属性列表
|
||||
*/
|
||||
Result<List<ProductAttributes>> getAttributesByCategoryId(Long categoryId);
|
||||
|
||||
/**
|
||||
* 根据属性名称查询属性
|
||||
* @param attributeName 属性名称
|
||||
* @return 属性列表
|
||||
*/
|
||||
Result<List<ProductAttributes>> getAttributesByName(String attributeName);
|
||||
|
||||
/**
|
||||
* 创建属性
|
||||
* @param productAttributes 属性信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> createAttribute(ProductAttributes productAttributes);
|
||||
|
||||
/**
|
||||
* 更新属性信息
|
||||
* @param productAttributes 属性信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateAttribute(ProductAttributes productAttributes);
|
||||
|
||||
/**
|
||||
* 删除属性
|
||||
* @param id 属性ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteAttribute(Long id);
|
||||
|
||||
/**
|
||||
* 根据属性ID查询属性
|
||||
* @param id 属性ID
|
||||
* @return 属性信息
|
||||
*/
|
||||
Result<ProductAttributes> getAttributeById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除属性
|
||||
* @param ids 属性ID列表
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> batchDeleteAttributes(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据属性类型查询属性
|
||||
* @param attributeType 属性类型
|
||||
* @return 属性列表
|
||||
*/
|
||||
Result<List<ProductAttributes>> getAttributesByType(String attributeType);
|
||||
|
||||
/**
|
||||
* 查询是否可搜索的属性
|
||||
* @param searchable 是否可搜索
|
||||
* @return 属性列表
|
||||
*/
|
||||
Result<List<ProductAttributes>> getAttributesBySearchable(Boolean searchable);
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.entity.ProductCategories;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品分类服务接口
|
||||
*/
|
||||
public interface ProductCategoriesService extends IService<ProductCategories> {
|
||||
|
||||
/**
|
||||
* 根据分类名称查询分类
|
||||
* @param categoryName 分类名称
|
||||
* @return 分类信息
|
||||
*/
|
||||
Result<ProductCategories> getCategoryByName(String categoryName);
|
||||
|
||||
/**
|
||||
* 根据父分类ID查询子分类
|
||||
* @param parentId 父分类ID
|
||||
* @return 子分类列表
|
||||
*/
|
||||
Result<List<ProductCategories>> getSubCategoriesByParentId(Long parentId);
|
||||
|
||||
/**
|
||||
* 创建分类
|
||||
* @param productCategories 分类信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> createCategory(ProductCategories productCategories);
|
||||
|
||||
/**
|
||||
* 更新分类信息
|
||||
* @param productCategories 分类信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateCategory(ProductCategories productCategories);
|
||||
|
||||
/**
|
||||
* 删除分类
|
||||
* @param id 分类ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteCategory(Long id);
|
||||
|
||||
/**
|
||||
* 查询所有根分类(父分类ID为0或null的分类)
|
||||
* @return 根分类列表
|
||||
*/
|
||||
Result<List<ProductCategories>> listRootCategories();
|
||||
|
||||
/**
|
||||
* 根据分类ID查询分类
|
||||
* @param id 分类ID
|
||||
* @return 分类信息
|
||||
*/
|
||||
Result<ProductCategories> getCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除分类
|
||||
* @param ids 分类ID列表
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> batchDeleteCategories(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 查询所有分类(树形结构)
|
||||
* @return 分类树形列表
|
||||
*/
|
||||
Result<List<ProductCategories>> listAllCategoriesWithTree();
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.entity.ProductImages;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品图片服务接口
|
||||
*/
|
||||
public interface ProductImagesService extends IService<ProductImages> {
|
||||
|
||||
/**
|
||||
* 根据商品ID查询图片
|
||||
* @param productId 商品ID
|
||||
* @return 图片列表
|
||||
*/
|
||||
Result<List<ProductImages>> getImagesByProductId(Long productId);
|
||||
|
||||
/**
|
||||
* 根据商品ID查询主图
|
||||
* @param productId 商品ID
|
||||
* @return 主图信息
|
||||
*/
|
||||
Result<ProductImages> getMainImageByProductId(Long productId);
|
||||
|
||||
/**
|
||||
* 创建商品图片
|
||||
* @param productImages 图片信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> createImage(ProductImages productImages);
|
||||
|
||||
/**
|
||||
* 更新图片信息
|
||||
* @param productImages 图片信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateImage(ProductImages productImages);
|
||||
|
||||
/**
|
||||
* 删除图片
|
||||
* @param id 图片ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteImage(Long id);
|
||||
|
||||
/**
|
||||
* 根据图片ID查询图片
|
||||
* @param id 图片ID
|
||||
* @return 图片信息
|
||||
*/
|
||||
Result<ProductImages> getImageById(Long id);
|
||||
|
||||
/**
|
||||
* 批量创建商品图片
|
||||
* @param images 图片列表
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> batchCreateImages(List<ProductImages> images);
|
||||
|
||||
/**
|
||||
* 根据商品ID删除所有图片
|
||||
* @param productId 商品ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteImagesByProductId(Long productId);
|
||||
|
||||
/**
|
||||
* 设置主图
|
||||
* @param productId 商品ID
|
||||
* @param imageId 图片ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> setMainImage(Long productId, Long imageId);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.entity.ProductInventories;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品库存服务接口
|
||||
*/
|
||||
public interface ProductInventoriesService extends IService<ProductInventories> {
|
||||
|
||||
/**
|
||||
* 根据商品ID查询库存
|
||||
* @param productId 商品ID
|
||||
* @return 库存列表
|
||||
*/
|
||||
Result<List<ProductInventories>> getInventoriesByProductId(Long productId);
|
||||
|
||||
/**
|
||||
* 根据SKU ID查询库存
|
||||
* @param skuId SKU ID
|
||||
* @return 库存信息
|
||||
*/
|
||||
Result<ProductInventories> getInventoryBySkuId(Long skuId);
|
||||
|
||||
/**
|
||||
* 创建库存记录
|
||||
* @param productInventories 库存信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> createInventory(ProductInventories productInventories);
|
||||
|
||||
/**
|
||||
* 更新库存信息
|
||||
* @param productInventories 库存信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateInventory(ProductInventories productInventories);
|
||||
|
||||
/**
|
||||
* 删除库存记录
|
||||
* @param id 库存ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteInventory(Long id);
|
||||
|
||||
/**
|
||||
* 根据库存ID查询库存
|
||||
* @param id 库存ID
|
||||
* @return 库存信息
|
||||
*/
|
||||
Result<ProductInventories> getInventoryById(Long id);
|
||||
|
||||
/**
|
||||
* 增加库存
|
||||
* @param skuId SKU ID
|
||||
* @param quantity 增加数量
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> increaseInventory(Long skuId, Integer quantity);
|
||||
|
||||
/**
|
||||
* 减少库存
|
||||
* @param skuId SKU ID
|
||||
* @param quantity 减少数量
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> decreaseInventory(Long skuId, Integer quantity);
|
||||
|
||||
/**
|
||||
* 检查库存是否充足
|
||||
* @param skuId SKU ID
|
||||
* @param quantity 需要的数量
|
||||
* @return 是否充足
|
||||
*/
|
||||
Result<Boolean> checkInventorySufficient(Long skuId, Integer quantity);
|
||||
|
||||
/**
|
||||
* 批量更新库存
|
||||
* @param inventoryUpdates 库存更新列表
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> batchUpdateInventory(List<ProductInventories> inventoryUpdates);
|
||||
}
|
||||
84
src/main/java/com/qf/backend/service/ProductSkusService.java
Normal file
84
src/main/java/com/qf/backend/service/ProductSkusService.java
Normal file
@@ -0,0 +1,84 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.entity.ProductSkus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品SKU服务接口
|
||||
*/
|
||||
public interface ProductSkusService extends IService<ProductSkus> {
|
||||
|
||||
/**
|
||||
* 根据商品ID查询SKU
|
||||
* @param productId 商品ID
|
||||
* @return SKU列表
|
||||
*/
|
||||
Result<List<ProductSkus>> getSkusByProductId(Long productId);
|
||||
|
||||
/**
|
||||
* 根据SKU编码查询SKU
|
||||
* @param skuCode SKU编码
|
||||
* @return SKU信息
|
||||
*/
|
||||
Result<ProductSkus> getSkuByCode(String skuCode);
|
||||
|
||||
/**
|
||||
* 创建SKU
|
||||
* @param productSkus SKU信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> createSku(ProductSkus productSkus);
|
||||
|
||||
/**
|
||||
* 更新SKU信息
|
||||
* @param productSkus SKU信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateSku(ProductSkus productSkus);
|
||||
|
||||
/**
|
||||
* 删除SKU
|
||||
* @param id SKU ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteSku(Long id);
|
||||
|
||||
/**
|
||||
* 根据SKU ID查询SKU
|
||||
* @param id SKU ID
|
||||
* @return SKU信息
|
||||
*/
|
||||
Result<ProductSkus> getSkuById(Long id);
|
||||
|
||||
/**
|
||||
* 批量创建SKU
|
||||
* @param skus SKU列表
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> batchCreateSkus(List<ProductSkus> skus);
|
||||
|
||||
/**
|
||||
* 根据商品ID删除所有SKU
|
||||
* @param productId 商品ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteSkusByProductId(Long productId);
|
||||
|
||||
/**
|
||||
* 更新SKU库存
|
||||
* @param skuId SKU ID
|
||||
* @param quantity 库存数量
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateSkuStock(Long skuId, Integer quantity);
|
||||
|
||||
/**
|
||||
* 批量查询SKU
|
||||
* @param skuIds SKU ID列表
|
||||
* @return SKU列表
|
||||
*/
|
||||
Result<List<ProductSkus>> batchGetSkus(List<Long> skuIds);
|
||||
}
|
||||
87
src/main/java/com/qf/backend/service/ProductsService.java
Normal file
87
src/main/java/com/qf/backend/service/ProductsService.java
Normal file
@@ -0,0 +1,87 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.entity.Products;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品服务接口
|
||||
*/
|
||||
public interface ProductsService extends IService<Products> {
|
||||
|
||||
/**
|
||||
* 根据商品名称查询商品
|
||||
* @param productName 商品名称
|
||||
* @return 商品列表
|
||||
*/
|
||||
Result<List<Products>> getProductsByName(String productName);
|
||||
|
||||
/**
|
||||
* 根据分类ID查询商品
|
||||
* @param categoryId 分类ID
|
||||
* @return 商品列表
|
||||
*/
|
||||
Result<List<Products>> getProductsByCategoryId(Long categoryId);
|
||||
|
||||
/**
|
||||
* 创建商品
|
||||
* @param products 商品信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> createProduct(Products products);
|
||||
|
||||
/**
|
||||
* 更新商品信息
|
||||
* @param products 商品信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateProduct(Products products);
|
||||
|
||||
/**
|
||||
* 删除商品
|
||||
* @param id 商品ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteProduct(Long id);
|
||||
|
||||
/**
|
||||
* 根据商品ID查询商品
|
||||
* @param id 商品ID
|
||||
* @return 商品信息
|
||||
*/
|
||||
Result<Products> getProductById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询商品
|
||||
* @param page 当前页码
|
||||
* @param size 每页数量
|
||||
* @return 商品列表
|
||||
*/
|
||||
Result<List<Products>> listProductsByPage(int page, int size);
|
||||
|
||||
/**
|
||||
* 根据店铺ID查询商品
|
||||
* @param shopId 店铺ID
|
||||
* @return 商品列表
|
||||
*/
|
||||
Result<List<Products>> getProductsByShopId(Long shopId);
|
||||
|
||||
/**
|
||||
* 批量上下架商品
|
||||
* @param ids 商品ID列表
|
||||
* @param status 状态(上架/下架)
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> batchUpdateProductStatus(List<Long> ids, Integer status);
|
||||
|
||||
/**
|
||||
* 搜索商品
|
||||
* @param keyword 关键词
|
||||
* @param page 当前页码
|
||||
* @param size 每页数量
|
||||
* @return 商品列表
|
||||
*/
|
||||
Result<List<Products>> searchProducts(String keyword, int page, int size);
|
||||
}
|
||||
84
src/main/java/com/qf/backend/service/RefundsService.java
Normal file
84
src/main/java/com/qf/backend/service/RefundsService.java
Normal file
@@ -0,0 +1,84 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.entity.Refunds;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 退款服务接口
|
||||
*/
|
||||
public interface RefundsService extends IService<Refunds> {
|
||||
|
||||
/**
|
||||
* 根据订单ID查询退款记录
|
||||
* @param orderId 订单ID
|
||||
* @return 退款记录列表
|
||||
*/
|
||||
List<Refunds> getRefundsByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 根据退款单号查询退款记录
|
||||
* @param refundNumber 退款单号
|
||||
* @return 退款记录
|
||||
*/
|
||||
Refunds getRefundByNumber(String refundNumber);
|
||||
|
||||
/**
|
||||
* 创建退款记录
|
||||
* @param refunds 退款信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean createRefund(Refunds refunds);
|
||||
|
||||
/**
|
||||
* 更新退款信息
|
||||
* @param refunds 退款信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updateRefund(Refunds refunds);
|
||||
|
||||
/**
|
||||
* 删除退款记录
|
||||
* @param id 退款ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteRefund(Long id);
|
||||
|
||||
/**
|
||||
* 根据退款ID查询退款记录
|
||||
* @param id 退款ID
|
||||
* @return 退款记录
|
||||
*/
|
||||
Refunds getRefundById(Long id);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询退款记录
|
||||
* @param userId 用户ID
|
||||
* @return 退款记录列表
|
||||
*/
|
||||
List<Refunds> getRefundsByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据退款状态查询退款记录
|
||||
* @param status 退款状态
|
||||
* @return 退款记录列表
|
||||
*/
|
||||
List<Refunds> getRefundsByStatus(Integer status);
|
||||
|
||||
/**
|
||||
* 更新退款状态
|
||||
* @param refundId 退款ID
|
||||
* @param status 退款状态
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updateRefundStatus(Long refundId, Integer status);
|
||||
|
||||
/**
|
||||
* 分页查询退款记录
|
||||
* @param page 当前页码
|
||||
* @param size 每页数量
|
||||
* @return 退款记录列表
|
||||
*/
|
||||
List<Refunds> listRefundsByPage(int page, int size);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.entity.RolePermissions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色权限关联服务接口
|
||||
*/
|
||||
public interface RolePermissionsService extends IService<RolePermissions> {
|
||||
|
||||
/**
|
||||
* 根据角色ID查询角色权限关联
|
||||
* @param roleId 角色ID
|
||||
* @return 角色权限关联列表
|
||||
*/
|
||||
List<RolePermissions> getRolePermissionsByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 根据权限ID查询角色权限关联
|
||||
* @param permissionId 权限ID
|
||||
* @return 角色权限关联列表
|
||||
*/
|
||||
List<RolePermissions> getRolePermissionsByPermissionId(Long permissionId);
|
||||
|
||||
/**
|
||||
* 为角色添加权限
|
||||
* @param roleId 角色ID
|
||||
* @param permissionId 权限ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean addPermissionToRole(Long roleId, Long permissionId);
|
||||
|
||||
/**
|
||||
* 从角色移除权限
|
||||
* @param roleId 角色ID
|
||||
* @param permissionId 权限ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean removePermissionFromRole(Long roleId, Long permissionId);
|
||||
|
||||
/**
|
||||
* 批量为角色添加权限
|
||||
* @param roleId 角色ID
|
||||
* @param permissionIds 权限ID列表
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean batchAddPermissionsToRole(Long roleId, List<Long> permissionIds);
|
||||
|
||||
/**
|
||||
* 清空角色的所有权限
|
||||
* @param roleId 角色ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean clearRolePermissions(Long roleId);
|
||||
|
||||
/**
|
||||
* 检查角色是否拥有指定权限
|
||||
* @param roleId 角色ID
|
||||
* @param permissionId 权限ID
|
||||
* @return 是否拥有
|
||||
*/
|
||||
boolean checkRoleHasPermission(Long roleId, Long permissionId);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询其拥有的权限ID列表
|
||||
* @param roleId 角色ID
|
||||
* @return 权限ID列表
|
||||
*/
|
||||
List<Long> listPermissionIdsByRoleId(Long roleId);
|
||||
}
|
||||
67
src/main/java/com/qf/backend/service/RolesService.java
Normal file
67
src/main/java/com/qf/backend/service/RolesService.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.entity.Roles;
|
||||
|
||||
/**
|
||||
* 角色服务接口
|
||||
*/
|
||||
public interface RolesService extends IService<Roles> {
|
||||
|
||||
/**
|
||||
* 根据角色名称查询角色
|
||||
* @param roleName 角色名称
|
||||
* @return 角色信息
|
||||
*/
|
||||
Roles getRoleByName(String roleName);
|
||||
|
||||
/**
|
||||
* 创建角色
|
||||
* @param roles 角色信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean createRole(Roles roles);
|
||||
|
||||
/**
|
||||
* 更新角色信息
|
||||
* @param roles 角色信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updateRole(Roles roles);
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
* @param id 角色ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteRole(Long id);
|
||||
|
||||
/**
|
||||
* 查询所有角色
|
||||
* @return 角色列表
|
||||
*/
|
||||
List<Roles> listAllRoles();
|
||||
|
||||
/**
|
||||
* 根据角色ID查询角色
|
||||
* @param id 角色ID
|
||||
* @return 角色信息
|
||||
*/
|
||||
Roles getRoleById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除角色
|
||||
* @param ids 角色ID列表
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean batchDeleteRoles(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询其拥有的角色列表
|
||||
* @param userId 用户ID
|
||||
* @return 角色列表
|
||||
*/
|
||||
List<Roles> listRolesByUserId(Long userId);
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.entity.ShopCategories;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺分类服务接口
|
||||
*/
|
||||
public interface ShopCategoriesService extends IService<ShopCategories> {
|
||||
|
||||
/**
|
||||
* 根据分类名称查询分类
|
||||
* @param categoryName 分类名称
|
||||
* @return 分类信息
|
||||
*/
|
||||
Result<ShopCategories> getCategoryByName(String categoryName);
|
||||
|
||||
/**
|
||||
* 根据父分类ID查询子分类
|
||||
* @param parentId 父分类ID
|
||||
* @return 子分类列表
|
||||
*/
|
||||
Result<List<ShopCategories>> getSubCategoriesByParentId(Long parentId);
|
||||
|
||||
/**
|
||||
* 创建分类
|
||||
* @param shopCategories 分类信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> createCategory(ShopCategories shopCategories);
|
||||
|
||||
/**
|
||||
* 更新分类信息
|
||||
* @param shopCategories 分类信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateCategory(ShopCategories shopCategories);
|
||||
|
||||
/**
|
||||
* 删除分类
|
||||
* @param id 分类ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteCategory(Long id);
|
||||
|
||||
/**
|
||||
* 查询所有根分类(父分类ID为0或null的分类)
|
||||
* @return 根分类列表
|
||||
*/
|
||||
Result<List<ShopCategories>> listRootCategories();
|
||||
|
||||
/**
|
||||
* 根据分类ID查询分类
|
||||
* @param id 分类ID
|
||||
* @return 分类信息
|
||||
*/
|
||||
Result<ShopCategories> getCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除分类
|
||||
* @param ids 分类ID列表
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> batchDeleteCategories(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 查询所有分类(树形结构)
|
||||
* @return 分类树形列表
|
||||
*/
|
||||
Result<List<ShopCategories>> listAllCategoriesWithTree();
|
||||
}
|
||||
94
src/main/java/com/qf/backend/service/ShopRatingsService.java
Normal file
94
src/main/java/com/qf/backend/service/ShopRatingsService.java
Normal file
@@ -0,0 +1,94 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.entity.ShopRatings;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺评分服务接口
|
||||
*/
|
||||
public interface ShopRatingsService extends IService<ShopRatings> {
|
||||
|
||||
/**
|
||||
* 根据店铺ID查询评分
|
||||
* @param shopId 店铺ID
|
||||
* @return 评分列表
|
||||
*/
|
||||
Result<List<ShopRatings>> getRatingsByShopId(Long shopId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询评分
|
||||
* @param userId 用户ID
|
||||
* @return 评分列表
|
||||
*/
|
||||
Result<List<ShopRatings>> getRatingsByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 创建评分
|
||||
* @param shopRatings 评分信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> createRating(ShopRatings shopRatings);
|
||||
|
||||
/**
|
||||
* 更新评分信息
|
||||
* @param shopRatings 评分信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateRating(ShopRatings shopRatings);
|
||||
|
||||
/**
|
||||
* 删除评分
|
||||
* @param id 评分ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteRating(Long id);
|
||||
|
||||
/**
|
||||
* 根据评分ID查询评分
|
||||
* @param id 评分ID
|
||||
* @return 评分信息
|
||||
*/
|
||||
Result<ShopRatings> getRatingById(Long id);
|
||||
|
||||
/**
|
||||
* 获取店铺平均评分
|
||||
* @param shopId 店铺ID
|
||||
* @return 平均评分
|
||||
*/
|
||||
Result<Double> getAverageRatingByShopId(Long shopId);
|
||||
|
||||
/**
|
||||
* 获取店铺评分数量
|
||||
* @param shopId 店铺ID
|
||||
* @return 评分数量
|
||||
*/
|
||||
Result<Integer> getRatingCountByShopId(Long shopId);
|
||||
|
||||
/**
|
||||
* 根据评分星级查询店铺评分
|
||||
* @param shopId 店铺ID
|
||||
* @param rating 评分星级
|
||||
* @return 评分列表
|
||||
*/
|
||||
Result<List<ShopRatings>> getRatingsByShopIdAndRating(Long shopId, Integer rating);
|
||||
|
||||
/**
|
||||
* 检查用户是否已对店铺评分
|
||||
* @param shopId 店铺ID
|
||||
* @param userId 用户ID
|
||||
* @return 是否已评分
|
||||
*/
|
||||
Result<Boolean> checkUserHasRated(Long shopId, Long userId);
|
||||
|
||||
/**
|
||||
* 分页查询店铺评分
|
||||
* @param shopId 店铺ID
|
||||
* @param page 当前页码
|
||||
* @param size 每页数量
|
||||
* @return 评分列表
|
||||
*/
|
||||
Result<List<ShopRatings>> listRatingsByShopIdAndPage(Long shopId, int page, int size);
|
||||
}
|
||||
87
src/main/java/com/qf/backend/service/ShopsService.java
Normal file
87
src/main/java/com/qf/backend/service/ShopsService.java
Normal file
@@ -0,0 +1,87 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.entity.Shops;
|
||||
|
||||
/**
|
||||
* 店铺服务接口
|
||||
*/
|
||||
public interface ShopsService extends IService<Shops> {
|
||||
|
||||
/**
|
||||
* 根据店铺名称查询店铺
|
||||
* @param shopName 店铺名称
|
||||
* @return 店铺列表
|
||||
*/
|
||||
Result<List<Shops>> getShopsByName(String shopName);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询店铺
|
||||
* @param userId 用户ID
|
||||
* @return 店铺信息
|
||||
*/
|
||||
Result<Shops> getShopByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 创建店铺
|
||||
* @param shops 店铺信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> createShop(Shops shops);
|
||||
|
||||
/**
|
||||
* 更新店铺信息
|
||||
* @param shops 店铺信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateShop(Shops shops);
|
||||
|
||||
/**
|
||||
* 删除店铺
|
||||
* @param id 店铺ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteShop(Long id);
|
||||
|
||||
/**
|
||||
* 根据店铺ID查询店铺
|
||||
* @param id 店铺ID
|
||||
* @return 店铺信息
|
||||
*/
|
||||
Result<Shops> getShopById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询店铺
|
||||
* @param page 当前页码
|
||||
* @param size 每页数量
|
||||
* @return 店铺列表
|
||||
*/
|
||||
Result<List<Shops>> listShopsByPage(int page, int size);
|
||||
|
||||
/**
|
||||
* 根据店铺分类ID查询店铺
|
||||
* @param categoryId 分类ID
|
||||
* @return 店铺列表
|
||||
*/
|
||||
Result<List<Shops>> getShopsByCategoryId(Long categoryId);
|
||||
|
||||
/**
|
||||
* 更新店铺状态
|
||||
* @param shopId 店铺ID
|
||||
* @param status 店铺状态
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateShopStatus(Long shopId, Integer status);
|
||||
|
||||
/**
|
||||
* 搜索店铺
|
||||
* @param keyword 关键词
|
||||
* @param page 当前页码
|
||||
* @param size 每页数量
|
||||
* @return 店铺列表
|
||||
*/
|
||||
Result<List<Shops>> searchShops(String keyword, int page, int size);
|
||||
}
|
||||
55
src/main/java/com/qf/backend/service/UserDetailsService.java
Normal file
55
src/main/java/com/qf/backend/service/UserDetailsService.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.entity.UserDetails;
|
||||
|
||||
/**
|
||||
* 用户详情服务接口
|
||||
*/
|
||||
public interface UserDetailsService extends IService<UserDetails> {
|
||||
|
||||
/**
|
||||
* 根据用户ID查询用户详情
|
||||
* @param userId 用户ID
|
||||
* @return 用户详情信息
|
||||
*/
|
||||
Result<UserDetails> getUserDetailsByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 创建用户详情
|
||||
* @param userDetails 用户详情信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> createUserDetails(UserDetails userDetails);
|
||||
|
||||
/**
|
||||
* 更新用户详情
|
||||
* @param userDetails 用户详情信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateUserDetails(UserDetails userDetails);
|
||||
|
||||
/**
|
||||
* 根据用户ID删除用户详情
|
||||
* @param userId 用户ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteUserDetailsByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户详情ID查询
|
||||
* @param id 用户详情ID
|
||||
* @return 用户详情信息
|
||||
*/
|
||||
Result<UserDetails> getUserDetailsById(Long id);
|
||||
|
||||
/**
|
||||
* 更新用户联系方式
|
||||
* @param userId 用户ID
|
||||
* @param phone 手机号
|
||||
* @param email 邮箱
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateContactInfo(Long userId, String phone, String email);
|
||||
}
|
||||
66
src/main/java/com/qf/backend/service/UserRolesService.java
Normal file
66
src/main/java/com/qf/backend/service/UserRolesService.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.entity.UserRoles;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户角色关联服务接口
|
||||
*/
|
||||
public interface UserRolesService extends IService<UserRoles> {
|
||||
|
||||
/**
|
||||
* 根据用户ID查询用户角色关联
|
||||
* @param userId 用户ID
|
||||
* @return 用户角色关联列表
|
||||
*/
|
||||
Result<List<UserRoles>> getUserRolesByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询用户角色关联
|
||||
* @param roleId 角色ID
|
||||
* @return 用户角色关联列表
|
||||
*/
|
||||
Result<List<UserRoles>> getUserRolesByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 为用户添加角色
|
||||
* @param userId 用户ID
|
||||
* @param roleId 角色ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> addRoleToUser(Long userId, Long roleId);
|
||||
|
||||
/**
|
||||
* 从用户移除角色
|
||||
* @param userId 用户ID
|
||||
* @param roleId 角色ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> removeRoleFromUser(Long userId, Long roleId);
|
||||
|
||||
/**
|
||||
* 批量为用户添加角色
|
||||
* @param userId 用户ID
|
||||
* @param roleIds 角色ID列表
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> batchAddRolesToUser(Long userId, List<Long> roleIds);
|
||||
|
||||
/**
|
||||
* 清空用户的所有角色
|
||||
* @param userId 用户ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> clearUserRoles(Long userId);
|
||||
|
||||
/**
|
||||
* 检查用户是否拥有指定角色
|
||||
* @param userId 用户ID
|
||||
* @param roleId 角色ID
|
||||
* @return 是否拥有
|
||||
*/
|
||||
Result<Boolean> checkUserHasRole(Long userId, Long roleId);
|
||||
}
|
||||
77
src/main/java/com/qf/backend/service/UsersService.java
Normal file
77
src/main/java/com/qf/backend/service/UsersService.java
Normal file
@@ -0,0 +1,77 @@
|
||||
package com.qf.backend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.entity.Users;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户服务接口
|
||||
*/
|
||||
public interface UsersService extends IService<Users> {
|
||||
|
||||
/**
|
||||
* 根据用户名查询用户
|
||||
* @param username 用户名
|
||||
* @return 用户信息
|
||||
*/
|
||||
Result<Users> getUserByUsername(String username);
|
||||
|
||||
/**
|
||||
* 根据邮箱查询用户
|
||||
* @param email 邮箱
|
||||
* @return 用户信息
|
||||
*/
|
||||
Result<Users> getUserByEmail(String email);
|
||||
|
||||
/**
|
||||
* 创建用户
|
||||
* @param users 用户信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> createUser(Users users);
|
||||
|
||||
/**
|
||||
* 更新用户信息
|
||||
* @param users 用户信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updateUser(Users users);
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
* @param id 用户ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> deleteUser(Long id);
|
||||
|
||||
/**
|
||||
* 查询所有用户
|
||||
* @return 用户列表
|
||||
*/
|
||||
Result<List<Users>> listAllUsers();
|
||||
|
||||
/**
|
||||
* 分页查询用户
|
||||
* @param page 当前页码
|
||||
* @param size 每页数量
|
||||
* @return 用户列表
|
||||
*/
|
||||
Result<List<Users>> listUsersByPage(int page, int size);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询用户
|
||||
* @param id 用户ID
|
||||
* @return 用户信息
|
||||
*/
|
||||
Result<Users> getUserById(Long id);
|
||||
|
||||
/**
|
||||
* 更新用户密码
|
||||
* @param id 用户ID
|
||||
* @param newPassword 新密码
|
||||
* @return 是否成功
|
||||
*/
|
||||
Result<Boolean> updatePassword(Long id, String newPassword);
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.qf.backend.service.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.common.ResultUtils;
|
||||
import com.qf.backend.entity.OrderItems;
|
||||
import com.qf.backend.exception.ErrorCode;
|
||||
import com.qf.backend.mapper.OrderItemsMapper;
|
||||
import com.qf.backend.service.OrderItemsService;
|
||||
|
||||
@Service
|
||||
public class OrderItemsServiceImpl implements OrderItemsService {
|
||||
|
||||
@Autowired
|
||||
private OrderItemsMapper orderItemsMapper;
|
||||
|
||||
@Override
|
||||
public Result<List<OrderItems>> getOrderItemsByOrderId(Long orderId) {
|
||||
try {
|
||||
List<OrderItems> orderItems = orderItemsMapper.selectByOrderId(orderId);
|
||||
if (orderItems == null || orderItems.isEmpty()) {
|
||||
return ResultUtils.fail(ErrorCode.ORDER_NOT_FOUND);
|
||||
}
|
||||
return ResultUtils.success(orderItems);
|
||||
} catch (Exception e) {
|
||||
return ResultUtils.fail(ErrorCode.ORDER_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Result<List<OrderItems>> getOrderItemsByProductId(Long productId) {
|
||||
try {
|
||||
List<OrderItems> orderItems = orderItemsMapper.selectByProductId(productId);
|
||||
if (orderItems == null || orderItems.isEmpty()) {
|
||||
return ResultUtils.fail(ErrorCode.ORDER_NOT_FOUND);
|
||||
}
|
||||
return ResultUtils.success(orderItems);
|
||||
} catch (Exception e) {
|
||||
return ResultUtils.fail(ErrorCode.ORDER_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public BaseMapper<OrderItems> getBaseMapper() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getBaseMapper'");
|
||||
}
|
||||
@Override
|
||||
public Class<OrderItems> getEntityClass() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getEntityClass'");
|
||||
}
|
||||
@Override
|
||||
public Map<String, Object> getMap(Wrapper<OrderItems> queryWrapper) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getMap'");
|
||||
}
|
||||
@Override
|
||||
public <V> V getObj(Wrapper<OrderItems> queryWrapper, Function<? super Object, V> mapper) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getObj'");
|
||||
}
|
||||
@Override
|
||||
public OrderItems getOne(Wrapper<OrderItems> queryWrapper, boolean throwEx) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getOne'");
|
||||
}
|
||||
@Override
|
||||
public Optional<OrderItems> getOneOpt(Wrapper<OrderItems> queryWrapper, boolean throwEx) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getOneOpt'");
|
||||
}
|
||||
@Override
|
||||
public boolean saveBatch(Collection<OrderItems> entityList, int batchSize) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'saveBatch'");
|
||||
}
|
||||
@Override
|
||||
public boolean saveOrUpdate(OrderItems entity) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'saveOrUpdate'");
|
||||
}
|
||||
@Override
|
||||
public boolean saveOrUpdateBatch(Collection<OrderItems> entityList, int batchSize) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'saveOrUpdateBatch'");
|
||||
}
|
||||
@Override
|
||||
public boolean updateBatchById(Collection<OrderItems> entityList, int batchSize) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'updateBatchById'");
|
||||
}
|
||||
@Override
|
||||
public Result<Boolean> createOrderItem(OrderItems orderItems) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'createOrderItem'");
|
||||
}
|
||||
@Override
|
||||
public Result<Boolean> updateOrderItem(OrderItems orderItems) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'updateOrderItem'");
|
||||
}
|
||||
@Override
|
||||
public Result<Boolean> deleteOrderItem(Long id) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'deleteOrderItem'");
|
||||
}
|
||||
@Override
|
||||
public Result<OrderItems> getOrderItemById(Long id) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getOrderItemById'");
|
||||
}
|
||||
@Override
|
||||
public Result<Boolean> batchCreateOrderItems(List<OrderItems> orderItemsList) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'batchCreateOrderItems'");
|
||||
}
|
||||
@Override
|
||||
public Result<Boolean> deleteOrderItemsByOrderId(Long orderId) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'deleteOrderItemsByOrderId'");
|
||||
}
|
||||
@Override
|
||||
public Result<Double> calculateOrderTotal(Long orderId) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'calculateOrderTotal'");
|
||||
}
|
||||
@Override
|
||||
public Result<List<OrderItems>> getOrderItemsBySkuId(Long skuId) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getOrderItemsBySkuId'");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.qf.backend.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qf.backend.common.Result;
|
||||
import com.qf.backend.common.ResultUtils;
|
||||
import com.qf.backend.entity.Orders;
|
||||
import com.qf.backend.exception.ErrorCode;
|
||||
import com.qf.backend.mapper.OrdersMapper;
|
||||
import com.qf.backend.service.OrdersService;
|
||||
|
||||
import ch.qos.logback.classic.Logger;
|
||||
|
||||
@Service
|
||||
public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders> implements OrdersService {
|
||||
@Autowired
|
||||
private OrdersMapper ordersMapper;
|
||||
@Autowired
|
||||
private Logger logger;
|
||||
|
||||
@Override
|
||||
public Result<Orders> getOrderByNumber(String orderNumber) {
|
||||
logger.info("根据订单号查询订单: {}", orderNumber);
|
||||
try {
|
||||
Orders orders = ordersMapper.selectByOrderNumber(orderNumber);
|
||||
if (orders == null) {
|
||||
logger.warn("订单号 {} 不存在", orderNumber);
|
||||
return ResultUtils.fail(ErrorCode.ORDER_NOT_FOUND);
|
||||
}
|
||||
return ResultUtils.success(orders);
|
||||
} catch (Exception e) {
|
||||
return ResultUtils.fail(ErrorCode.ORDER_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<Orders>> getOrdersByUserId(Long userId) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getOrdersByUserId'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Boolean> createOrder(Orders orders) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'createOrder'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Boolean> updateOrder(Orders orders) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'updateOrder'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Boolean> deleteOrder(Long id) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'deleteOrder'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Orders> getOrderById(Long id) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getOrderById'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<Orders>> listOrdersByPage(int page, int size) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'listOrdersByPage'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<Orders>> getOrdersByShopId(Long shopId) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getOrdersByShopId'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Boolean> updateOrderStatus(Long orderId, Integer status) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'updateOrderStatus'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<Orders>> getOrdersByStatus(Integer status) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getOrdersByStatus'");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user