feat: 添加用户、角色服务和验证工具类

新增用户服务实现类UsersServiceImpl,包含用户CRUD操作
新增角色服务实现类RolesServiceImpl,包含角色管理功能
新增验证工具类ValidateUtil,提供参数验证功能
更新所有实体类添加@Builder注解
更新所有Mapper接口添加selectInfo和updateInfo方法
更新application.properties添加server.port配置
修复OrdersServiceImpl中Logger使用问题
添加updateInfo方法使用文档
This commit is contained in:
qingfeng1121
2025-11-25 15:30:27 +08:00
parent 5aa2017eef
commit 7536c8087e
48 changed files with 1107 additions and 31 deletions

View File

@@ -5,6 +5,7 @@ import java.util.List;
import org.apache.ibatis.annotations.Select;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.OrderItems;
@@ -27,4 +28,20 @@ public interface OrderItemsMapper extends BaseMapper<OrderItems> {
*/
@Select("select * from order_items where product_id = #{productId}")
List<OrderItems> selectByProductId(Long productId);
/**
* 查询订单项信息
* @param orderItems 订单项对象
* @param queryWrapper 查询包装器
* @return 订单项对象
*/
OrderItems selectInfo(OrderItems orderItems, QueryWrapper<OrderItems> queryWrapper);
/**
* 更新订单项信息
* @param orderItems 订单项对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(OrderItems orderItems, UpdateWrapper<OrderItems> updateWrapper);
}

View File

@@ -1,5 +1,7 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.OrderStatusHistory;
@@ -7,4 +9,19 @@ import com.qf.backend.entity.OrderStatusHistory;
* 订单状态历史表 Mapper 接口
*/
public interface OrderStatusHistoryMapper extends BaseMapper<OrderStatusHistory> {
/**
* 查询订单状态历史信息
* @param orderStatusHistory 订单状态历史对象
* @param queryWrapper 查询包装器
* @return 订单状态历史对象
*/
OrderStatusHistory selectInfo(OrderStatusHistory orderStatusHistory, QueryWrapper<OrderStatusHistory> queryWrapper);
/**
* 更新订单状态历史信息
* @param orderStatusHistory 订单状态历史对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(OrderStatusHistory orderStatusHistory, UpdateWrapper<OrderStatusHistory> updateWrapper);
}

View File

@@ -1,12 +1,30 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.Orders;
/**
* 订单表 Mapper 接口
* 订单信息表 Mapper 接口
*/
public interface OrdersMapper extends BaseMapper<Orders> {
/**
* 查询订单信息
* @param orders 订单对象
* @param queryWrapper 查询包装器
* @return 订单对象
*/
Orders selectInfo(Orders orders, QueryWrapper<Orders> queryWrapper);
/**
* 更新订单信息
* @param orders 订单对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(Orders orders, UpdateWrapper<Orders> updateWrapper);
/**
* 根据订单号查询订单
* @param orderNumber 订单号

View File

@@ -1,10 +1,27 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.Payments;
/**
* 支付信息表 Mapper 接口
* 支付记录表 Mapper 接口
*/
public interface PaymentsMapper extends BaseMapper<Payments> {
/**
* 查询支付记录信息
* @param payments 支付记录对象
* @param queryWrapper 查询包装器
* @return 支付记录对象
*/
Payments selectInfo(Payments payments, QueryWrapper<Payments> queryWrapper);
/**
* 更新支付记录信息
* @param payments 支付记录对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(Payments payments, UpdateWrapper<Payments> updateWrapper);
}

View File

@@ -1,5 +1,7 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.Permissions;
@@ -7,4 +9,19 @@ import com.qf.backend.entity.Permissions;
* 权限信息表 Mapper 接口
*/
public interface PermissionsMapper extends BaseMapper<Permissions> {
/**
* 查询权限信息
* @param permissions 权限对象
* @param queryWrapper 查询包装器
* @return 权限对象
*/
Permissions selectInfo(Permissions permissions, QueryWrapper<Permissions> queryWrapper);
/**
* 更新权限信息
* @param permissions 权限对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(Permissions permissions, UpdateWrapper<Permissions> updateWrapper);
}

View File

@@ -1,5 +1,7 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.ProductAttributeValues;
@@ -7,4 +9,19 @@ import com.qf.backend.entity.ProductAttributeValues;
* 商品属性值表 Mapper 接口
*/
public interface ProductAttributeValuesMapper extends BaseMapper<ProductAttributeValues> {
/**
* 查询商品属性值信息
* @param productAttributeValues 商品属性值对象
* @param queryWrapper 查询包装器
* @return 商品属性值对象
*/
ProductAttributeValues selectInfo(ProductAttributeValues productAttributeValues, QueryWrapper<ProductAttributeValues> queryWrapper);
/**
* 更新商品属性值信息
* @param productAttributeValues 商品属性值对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(ProductAttributeValues productAttributeValues, UpdateWrapper<ProductAttributeValues> updateWrapper);
}

View File

@@ -1,5 +1,7 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.ProductAttributes;
@@ -7,4 +9,19 @@ import com.qf.backend.entity.ProductAttributes;
* 商品属性表 Mapper 接口
*/
public interface ProductAttributesMapper extends BaseMapper<ProductAttributes> {
/**
* 查询商品属性信息
* @param productAttributes 商品属性对象
* @param queryWrapper 查询包装器
* @return 商品属性对象
*/
ProductAttributes selectInfo(ProductAttributes productAttributes, QueryWrapper<ProductAttributes> queryWrapper);
/**
* 更新商品属性信息
* @param productAttributes 商品属性对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(ProductAttributes productAttributes, UpdateWrapper<ProductAttributes> updateWrapper);
}

View File

@@ -1,5 +1,7 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.ProductCategories;
@@ -7,4 +9,19 @@ import com.qf.backend.entity.ProductCategories;
* 商品分类表 Mapper 接口
*/
public interface ProductCategoriesMapper extends BaseMapper<ProductCategories> {
/**
* 查询商品分类信息
* @param productCategories 商品分类对象
* @param queryWrapper 查询包装器
* @return 商品分类对象
*/
ProductCategories selectInfo(ProductCategories productCategories, QueryWrapper<ProductCategories> queryWrapper);
/**
* 更新商品分类信息
* @param productCategories 商品分类对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(ProductCategories productCategories, UpdateWrapper<ProductCategories> updateWrapper);
}

View File

@@ -1,5 +1,7 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.ProductImages;
@@ -7,4 +9,19 @@ import com.qf.backend.entity.ProductImages;
* 商品图片表 Mapper 接口
*/
public interface ProductImagesMapper extends BaseMapper<ProductImages> {
/**
* 查询商品图片信息
* @param productImages 商品图片对象
* @param queryWrapper 查询包装器
* @return 商品图片对象
*/
ProductImages selectInfo(ProductImages productImages, QueryWrapper<ProductImages> queryWrapper);
/**
* 更新商品图片信息
* @param productImages 商品图片对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(ProductImages productImages, UpdateWrapper<ProductImages> updateWrapper);
}

View File

@@ -1,10 +1,27 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.ProductInventories;
/**
* 库存信息表 Mapper 接口
* 商品库存表 Mapper 接口
*/
public interface ProductInventoriesMapper extends BaseMapper<ProductInventories> {
/**
* 查询商品库存信息
* @param productInventories 商品库存对象
* @param queryWrapper 查询包装器
* @return 商品库存对象
*/
ProductInventories selectInfo(ProductInventories productInventories, QueryWrapper<ProductInventories> queryWrapper);
/**
* 更新商品库存信息
* @param productInventories 商品库存对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(ProductInventories productInventories, UpdateWrapper<ProductInventories> updateWrapper);
}

View File

@@ -1,5 +1,7 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.ProductSkus;
@@ -7,4 +9,19 @@ import com.qf.backend.entity.ProductSkus;
* 商品SKU表 Mapper 接口
*/
public interface ProductSkusMapper extends BaseMapper<ProductSkus> {
/**
* 查询商品SKU信息
* @param productSkus 商品SKU对象
* @param queryWrapper 查询包装器
* @return 商品SKU对象
*/
ProductSkus selectInfo(ProductSkus productSkus, QueryWrapper<ProductSkus> queryWrapper);
/**
* 更新商品SKU信息
* @param productSkus 商品SKU对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(ProductSkus productSkus, UpdateWrapper<ProductSkus> updateWrapper);
}

View File

@@ -1,10 +1,27 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.Products;
/**
* 商品基本信息表 Mapper 接口
* 商品信息表 Mapper 接口
*/
public interface ProductsMapper extends BaseMapper<Products> {
/**
* 查询商品信息
* @param products 商品对象
* @param queryWrapper 查询包装器
* @return 商品对象
*/
Products selectInfo(Products products, QueryWrapper<Products> queryWrapper);
/**
* 更新商品信息
* @param products 商品对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(Products products, UpdateWrapper<Products> updateWrapper);
}

View File

@@ -1,10 +1,27 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.Refunds;
/**
* 退款信息表 Mapper 接口
* 退款记录表 Mapper 接口
*/
public interface RefundsMapper extends BaseMapper<Refunds> {
/**
* 查询退款记录信息
* @param refunds 退款记录对象
* @param queryWrapper 查询包装器
* @return 退款记录对象
*/
Refunds selectInfo(Refunds refunds, QueryWrapper<Refunds> queryWrapper);
/**
* 更新退款记录信息
* @param refunds 退款记录对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(Refunds refunds, UpdateWrapper<Refunds> updateWrapper);
}

View File

@@ -1,10 +1,27 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.RolePermissions;
/**
* 角色-权限关联表 Mapper 接口
* 角色权限关联表 Mapper 接口
*/
public interface RolePermissionsMapper extends BaseMapper<RolePermissions> {
/**
* 查询角色权限关联信息
* @param rolePermissions 角色权限关联对象
* @param queryWrapper 查询包装器
* @return 角色权限关联对象
*/
RolePermissions selectInfo(RolePermissions rolePermissions, QueryWrapper<RolePermissions> queryWrapper);
/**
* 更新角色权限关联信息
* @param rolePermissions 角色权限关联对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(RolePermissions rolePermissions, UpdateWrapper<RolePermissions> updateWrapper);
}

View File

@@ -1,5 +1,7 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.Roles;
@@ -7,4 +9,18 @@ import com.qf.backend.entity.Roles;
* 角色信息表 Mapper 接口
*/
public interface RolesMapper extends BaseMapper<Roles> {
/**
* 查询角色信息
* @param roles 角色对象
* @param queryWrapper 查询包装器
* @return 角色对象
*/
Roles selectInfo(Roles roles, QueryWrapper<Roles> queryWrapper);
/**
* 更新角色信息
* @param roles 角色对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(Roles roles, UpdateWrapper<Roles> updateWrapper);
}

View File

@@ -1,5 +1,7 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.ShopCategories;
@@ -7,4 +9,19 @@ import com.qf.backend.entity.ShopCategories;
* 店铺分类表 Mapper 接口
*/
public interface ShopCategoriesMapper extends BaseMapper<ShopCategories> {
/**
* 查询店铺分类信息
* @param shopCategories 店铺分类对象
* @param queryWrapper 查询包装器
* @return 店铺分类对象
*/
ShopCategories selectInfo(ShopCategories shopCategories, QueryWrapper<ShopCategories> queryWrapper);
/**
* 更新店铺分类信息
* @param shopCategories 店铺分类对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(ShopCategories shopCategories, UpdateWrapper<ShopCategories> updateWrapper);
}

View File

@@ -1,10 +1,27 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.ShopRatings;
/**
* 店铺评表 Mapper 接口
* 店铺评表 Mapper 接口
*/
public interface ShopRatingsMapper extends BaseMapper<ShopRatings> {
/**
* 查询店铺评价信息
* @param shopRatings 店铺评价对象
* @param queryWrapper 查询包装器
* @return 店铺评价对象
*/
ShopRatings selectInfo(ShopRatings shopRatings, QueryWrapper<ShopRatings> queryWrapper);
/**
* 更新店铺评价信息
* @param shopRatings 店铺评价对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(ShopRatings shopRatings, UpdateWrapper<ShopRatings> updateWrapper);
}

View File

@@ -1,5 +1,7 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.Shops;
@@ -7,4 +9,19 @@ import com.qf.backend.entity.Shops;
* 店铺信息表 Mapper 接口
*/
public interface ShopsMapper extends BaseMapper<Shops> {
/**
* 查询店铺信息
* @param shops 店铺对象
* @param queryWrapper 查询包装器
* @return 店铺对象
*/
Shops selectInfo(Shops shops, QueryWrapper<Shops> queryWrapper);
/**
* 更新店铺信息
* @param shops 店铺对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(Shops shops, UpdateWrapper<Shops> updateWrapper);
}

View File

@@ -1,5 +1,7 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.UserDetails;
@@ -7,4 +9,19 @@ import com.qf.backend.entity.UserDetails;
* 用户详细信息表 Mapper 接口
*/
public interface UserDetailsMapper extends BaseMapper<UserDetails> {
/**
* 查询用户详情信息
* @param userDetails 用户详情对象
* @param queryWrapper 查询包装器
* @return 用户详情对象
*/
UserDetails selectInfo(UserDetails userDetails, QueryWrapper<UserDetails> queryWrapper);
/**
* 更新用户详情信息
* @param userDetails 用户详情对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(UserDetails userDetails, UpdateWrapper<UserDetails> updateWrapper);
}

View File

@@ -1,10 +1,27 @@
package com.qf.backend.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.UserRoles;
/**
* 用户-角色关联表 Mapper 接口
* 用户角色关联表 Mapper 接口
*/
public interface UserRolesMapper extends BaseMapper<UserRoles> {
/**
* 查询用户角色关联信息
* @param userRoles 用户角色关联对象
* @param queryWrapper 查询包装器
* @return 用户角色关联对象
*/
UserRoles selectInfo(UserRoles userRoles, QueryWrapper<UserRoles> queryWrapper);
/**
* 更新用户角色关联信息
* @param userRoles 用户角色关联对象
* @param updateWrapper 更新包装器
* @return 更新影响的行数
*/
int updateInfo(UserRoles userRoles, UpdateWrapper<UserRoles> updateWrapper);
}

View File

@@ -1,5 +1,9 @@
package com.qf.backend.mapper;
import org.apache.ibatis.annotations.Select;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.backend.entity.Users;
@@ -7,4 +11,41 @@ import com.qf.backend.entity.Users;
* 用户基本信息表 Mapper 接口
*/
public interface UsersMapper extends BaseMapper<Users> {
/**
* 根据用户名查询用户
* @param username 用户名
* @return 用户对象
*/
@Select("select * from users where username = #{username}")
Users selectByUsername(String username);
/**
* 根据邮箱查询用户
* @param email 邮箱
* @return 用户对象
*/
@Select("select * from Users where email = #{email}")
Users selectByEmail(String email);
/**
* 根据手机号查询用户
* @param phone 手机号
* @return 用户对象
*/
@Select("select * from Users where phone = #{phone}")
Users selectByPhone(String phone);
/**
* 查询用户信息
* @param users 用户信息
* @param queryWrapper 查询条件包装器
* @return 用户对象
*/
Users selectInfo(Users users, QueryWrapper<Users> queryWrapper);
/**
* 更新用户信息
* @param users 用户信息
* @param updateWrapper 更新条件包装器
* @return 是否成功
*/
int updateInfo(Users users, UpdateWrapper<Users> updateWrapper);
}