From 0eaf00c200a470dcf39fd5798dd4bebc2df2b784 Mon Sep 17 00:00:00 2001 From: chen-xin-zhi <3588068430@qq.com> Date: Thu, 20 Mar 2025 11:54:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0https?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../book/PhotoCategoryController.java | 2 - .../clothes/ClothesCategoryController.java | 192 +++++++++++++++++ .../controller/clothes/ClothesController.java | 193 ++++++++++++++++++ .../controller/good/CategoryController.java | 9 +- .../order/ClothesOrderController.java | 4 + .../mapper/ClothesCategoryMapper.java | 7 + .../heritage/mapper/ClothesMapper.java | 7 + .../heritage/mapper/ClothesOrderMapper.java | 7 + .../ClothesCategoryAddRequest.java | 32 +++ .../ClothesCategoryUpdateRequest.java | 38 ++++ .../model/dto/clothes/ClothesAddRequest.java | 63 ++++++ .../dto/clothes/ClothesQueryRequest.java | 45 ++++ .../dto/clothes/ClothesUpdateRequest.java | 67 ++++++ .../heritage/model/entity/Clothes.java | 79 +++++++ .../model/entity/ClothesCategory.java | 61 ++++++ .../heritage/model/entity/ClothesOrder.java | 4 + .../model/vo/clothes/ClothesCategoryVO.java | 31 +++ .../heritage/model/vo/clothes/ClothesVO.java | 55 +++++ .../clothes/ClothesCategoryService.java | 13 ++ .../service/clothes/ClothesService.java | 26 +++ .../impl/ClothesCategoryServiceImpl.java | 46 +++++ .../clothes/impl/ClothesServiceImpl.java | 104 ++++++++++ .../service/common/CommonService.java | 13 ++ .../common/impl/CommonServiceImpl.java | 20 ++ src/main/resources/mapper/Clothes.xml | 7 + src/main/resources/mapper/ClothesCategory.xml | 7 + src/main/resources/mapper/ClothesOrder.xml | 7 + 27 files changed, 1131 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/cultural/heritage/controller/clothes/ClothesCategoryController.java create mode 100644 src/main/java/com/cultural/heritage/controller/clothes/ClothesController.java create mode 100644 src/main/java/com/cultural/heritage/controller/order/ClothesOrderController.java create mode 100644 src/main/java/com/cultural/heritage/mapper/ClothesCategoryMapper.java create mode 100644 src/main/java/com/cultural/heritage/mapper/ClothesMapper.java create mode 100644 src/main/java/com/cultural/heritage/mapper/ClothesOrderMapper.java create mode 100644 src/main/java/com/cultural/heritage/model/dto/clotheCategory/ClothesCategoryAddRequest.java create mode 100644 src/main/java/com/cultural/heritage/model/dto/clotheCategory/ClothesCategoryUpdateRequest.java create mode 100644 src/main/java/com/cultural/heritage/model/dto/clothes/ClothesAddRequest.java create mode 100644 src/main/java/com/cultural/heritage/model/dto/clothes/ClothesQueryRequest.java create mode 100644 src/main/java/com/cultural/heritage/model/dto/clothes/ClothesUpdateRequest.java create mode 100644 src/main/java/com/cultural/heritage/model/entity/Clothes.java create mode 100644 src/main/java/com/cultural/heritage/model/entity/ClothesCategory.java create mode 100644 src/main/java/com/cultural/heritage/model/entity/ClothesOrder.java create mode 100644 src/main/java/com/cultural/heritage/model/vo/clothes/ClothesCategoryVO.java create mode 100644 src/main/java/com/cultural/heritage/model/vo/clothes/ClothesVO.java create mode 100644 src/main/java/com/cultural/heritage/service/clothes/ClothesCategoryService.java create mode 100644 src/main/java/com/cultural/heritage/service/clothes/ClothesService.java create mode 100644 src/main/java/com/cultural/heritage/service/clothes/impl/ClothesCategoryServiceImpl.java create mode 100644 src/main/java/com/cultural/heritage/service/clothes/impl/ClothesServiceImpl.java create mode 100644 src/main/resources/mapper/Clothes.xml create mode 100644 src/main/resources/mapper/ClothesCategory.xml create mode 100644 src/main/resources/mapper/ClothesOrder.xml diff --git a/src/main/java/com/cultural/heritage/controller/book/PhotoCategoryController.java b/src/main/java/com/cultural/heritage/controller/book/PhotoCategoryController.java index ea9779d..ffd8f9c 100644 --- a/src/main/java/com/cultural/heritage/controller/book/PhotoCategoryController.java +++ b/src/main/java/com/cultural/heritage/controller/book/PhotoCategoryController.java @@ -105,7 +105,6 @@ public class PhotoCategoryController { // 获取原有写真类别名称 Long id = photoCategoryUpdateRequest.getId(); PhotoCategory originPhotoCategory = photoCategoryService.getById(id); - ThrowUtils.throwIf(originPhotoCategory == null, ErrorCode.OPERATION_ERROR, "写真类别不存在"); String originName = originPhotoCategory.getName(); // 获取目标写真预约名称 String targetName = photoCategoryUpdateRequest.getName(); @@ -141,7 +140,6 @@ public class PhotoCategoryController { } Long id = commonRequest.getId(); PhotoCategory photoCategory = photoCategoryService.getById(id); - ThrowUtils.throwIf(photoCategory == null, ErrorCode.OPERATION_ERROR, "写真类别不存在"); // 获取写真产品列表 List photoProductsList = commonService.findByFieldEqTargetField("categoryName", photoCategory.getName(), photoProductsService); // 获取预约日期表 diff --git a/src/main/java/com/cultural/heritage/controller/clothes/ClothesCategoryController.java b/src/main/java/com/cultural/heritage/controller/clothes/ClothesCategoryController.java new file mode 100644 index 0000000..5c5cb8a --- /dev/null +++ b/src/main/java/com/cultural/heritage/controller/clothes/ClothesCategoryController.java @@ -0,0 +1,192 @@ +package com.cultural.heritage.controller.clothes; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.cultural.heritage.annotation.AuthCheck; +import com.cultural.heritage.common.BaseResponse; +import com.cultural.heritage.common.ErrorCode; +import com.cultural.heritage.common.ResultUtils; +import com.cultural.heritage.constant.UserConstant; +import com.cultural.heritage.exception.BusinessException; +import com.cultural.heritage.exception.ThrowUtils; +import com.cultural.heritage.model.dto.CommonRequest; +import com.cultural.heritage.model.dto.clotheCategory.ClothesCategoryAddRequest; +import com.cultural.heritage.model.dto.clotheCategory.ClothesCategoryUpdateRequest; +import com.cultural.heritage.model.entity.Clothes; +import com.cultural.heritage.model.entity.ClothesCategory; +import com.cultural.heritage.model.vo.clothes.ClothesCategoryVO; +import com.cultural.heritage.model.vo.clothes.ClothesVO; +import com.cultural.heritage.service.clothes.ClothesCategoryService; +import com.cultural.heritage.service.clothes.ClothesService; +import com.cultural.heritage.service.common.CommonService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/clothesCategory") +@Slf4j +@Tag(name = "服装类别管理模块") +public class ClothesCategoryController { + + @Resource + private ClothesCategoryService clothesCategoryService; + + + @Resource + private CommonService commonService; + + + @Resource + private ClothesService clothesService; + + + + /** + * Web端管理员添加服装类别 + * @param clothesCategoryAddRequest 服装类别添加请求体 + * @return 服装类别id + */ + @PostMapping("/add") + @AuthCheck(mustRole = UserConstant.ADMIN_ROLE) + @Operation(summary = "Web端管理员添加服装类别", description = "参数:服装类别添加请求体,权限:管理员(admin, boss),方法名:addClothesCategory") + public BaseResponse addClothesCategory(@RequestBody ClothesCategoryAddRequest clothesCategoryAddRequest) { + if (clothesCategoryAddRequest == null) { + throw new BusinessException(ErrorCode.PARAMS_ERROR); + } + ClothesCategory clothesCategory = commonService.copyProperties(clothesCategoryAddRequest, ClothesCategory.class); + // 校验 + clothesCategoryService.validClothesCategory(clothesCategory, false); + boolean save = clothesCategoryService.save(clothesCategory); + ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "服装类别添加失败"); + return ResultUtils.success(clothesCategory.getId()); + } + + + + /** + * Web端管理员更新服装类别 + * @param clothesCategoryUpdateRequest 服装类别更新请求体 + * @return 是否更新成功 + */ + @PostMapping("/update") + @AuthCheck(mustRole = UserConstant.ADMIN_ROLE) + @Operation(summary = "Web端管理员更新服装类别", description = "参数:服装类别更新请求体,权限:管理员(admin, boss),方法名:updateClothesCategory") + public BaseResponse updateClothesCategory(@RequestBody ClothesCategoryUpdateRequest clothesCategoryUpdateRequest) { + if (clothesCategoryUpdateRequest == null || clothesCategoryUpdateRequest.getId() <= 0) { + throw new BusinessException(ErrorCode.PARAMS_ERROR); + } + ClothesCategory clothesCategory = commonService.copyProperties(clothesCategoryUpdateRequest, ClothesCategory.class); + // 校验 + clothesCategoryService.validClothesCategory(clothesCategory, true); + + boolean result = clothesCategoryService.updateById(clothesCategory); + ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服装类别名称更新失败"); + + return ResultUtils.success(true); + } + + + + + /** + * Web端管理员根据id删除服装类别 + * @param commonRequest 类别删除请求体 + * @return 是否删除成功 + */ + @PostMapping("/delete") + @Operation(summary = "Web端管理员根据id删除服装类别", description = "参数:类别删除请求体,权限:管理员(admin, boss),方法名:deleteClothesCategory") + @AuthCheck(mustRole = UserConstant.ADMIN_ROLE) + public BaseResponse deleteClothesCategory(@RequestBody CommonRequest commonRequest) { + if (commonRequest == null || commonRequest.getId() <= 0) { + throw new BusinessException(ErrorCode.PARAMS_ERROR); + } + Long id = commonRequest.getId(); + // 获取删除条件 + QueryWrapper queryWrapper = commonService.buildQueryWrapperByField("categoryId", id, clothesService); + + // 删除该类别下的所有服装 + clothesService.remove(queryWrapper); + + // 删除服装类别 + boolean result = clothesCategoryService.removeById(id); + ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服装类别删除失败"); + + return ResultUtils.success(true); + } + + + + + /** + * Web端管理员查询服装类别 + * @return 服装类别列表 + */ + @PostMapping("/list/web") + @Operation(summary = "Web端管理员查询服装类别", description = "参数:无,权限:web端管理员,方法名:listClothesCategory") + @AuthCheck(mustRole = UserConstant.ADMIN_ROLE) + public BaseResponse> listClothesCategory() { + List clothesCategoryList = clothesCategoryService.list(); + // 获取服装类别VO列表 + List clothesCategoryVOS = commonService.convertList(clothesCategoryList, ClothesCategoryVO.class); + return ResultUtils.success(clothesCategoryVOS); + } + + + + + /** + * 小程序端用户查询服装类别 + * @return 服装类别列表 + */ + @PostMapping("/list") + @Operation(summary = "小程序端用户查询服装类别", description = "参数:无,权限:所有人,方法名:listClothesCategoryByUsers") + public BaseResponse> listClothesCategoryByUsers() { + // 获取已上架的服装 + List clothesList = commonService.findByFieldEqTargetField("isShelves", 1, clothesService); + // 获取所有存在上架商品的商品类别 + List clothesCategoryList = commonService.findByFieldInTargetField(clothesList, clothesCategoryService, Clothes::getCategoryId, "id"); + + List clothesCategoryVOS = commonService.convertList(clothesCategoryList, ClothesCategoryVO.class); + return ResultUtils.success(clothesCategoryVOS); + } + + + + + + /** + * 小程序端用户根据类别id查询服装租赁产品 + * @param commonRequest 类别id + * @return 服装租赁产品列表 + */ + @PostMapping("/list/id") + @Operation(summary = "小程序端用户根据类别id查询服装租赁产品", description = "参数:类别id,权限:所有人,方法名:listClothesByCategoryId") + public BaseResponse> listClothesByCategoryId(@RequestBody CommonRequest commonRequest) { + if (commonRequest == null || commonRequest.getId() <= 0) { + throw new BusinessException(ErrorCode.PARAMS_ERROR); + } + Long id = commonRequest.getId(); + Map fieldConditions = new HashMap<>(); + fieldConditions.put("categoryId", id); + fieldConditions.put("isShelves", 1); + + List clothesList = commonService.findByFieldEqTargetFields(fieldConditions, clothesService); + // 获取服装租赁产品VO列表 + List clothesVOS = commonService.convertList(clothesList, ClothesVO.class); + Collections.reverse(clothesVOS); + return ResultUtils.success(clothesVOS); + } + + +} diff --git a/src/main/java/com/cultural/heritage/controller/clothes/ClothesController.java b/src/main/java/com/cultural/heritage/controller/clothes/ClothesController.java new file mode 100644 index 0000000..e9bf0f5 --- /dev/null +++ b/src/main/java/com/cultural/heritage/controller/clothes/ClothesController.java @@ -0,0 +1,193 @@ +package com.cultural.heritage.controller.clothes; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.cultural.heritage.annotation.AuthCheck; +import com.cultural.heritage.common.BaseResponse; +import com.cultural.heritage.common.ErrorCode; +import com.cultural.heritage.common.ResultUtils; +import com.cultural.heritage.constant.UserConstant; +import com.cultural.heritage.exception.BusinessException; +import com.cultural.heritage.exception.ThrowUtils; +import com.cultural.heritage.model.dto.CommonBatchRequest; +import com.cultural.heritage.model.dto.CommonRequest; +import com.cultural.heritage.model.dto.clothes.ClothesAddRequest; +import com.cultural.heritage.model.dto.clothes.ClothesQueryRequest; +import com.cultural.heritage.model.dto.clothes.ClothesUpdateRequest; +import com.cultural.heritage.model.entity.Clothes; +import com.cultural.heritage.model.vo.clothes.ClothesVO; +import com.cultural.heritage.service.clothes.ClothesService; +import com.cultural.heritage.service.common.CommonService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/clothes") +@Slf4j +@Tag(name = "服装租赁产品管理模块") +public class ClothesController { + + @Resource + private ClothesService clothesService; + + + @Resource + private CommonService commonService; + + + /** + * Web端管理员添加服装租赁产品 + * @param clothesAddRequest 服装租赁产品添加请求体 + * @return 服装租赁产品id + */ + @PostMapping("/add") + @Operation(summary = "Web端管理员添加服装租赁产品", description = "参数:服装租赁产品添加请求体,权限:管理员(admin, boss),方法名:addClothes") + @AuthCheck(mustRole = UserConstant.ADMIN_ROLE) + public BaseResponse addClothes(@RequestBody ClothesAddRequest clothesAddRequest) { + if (clothesAddRequest == null) { + throw new BusinessException(ErrorCode.PARAMS_ERROR); + } + Clothes clothes = commonService.copyProperties(clothesAddRequest, Clothes.class); + // 校验 + clothesService.validClothes(clothes, false); + boolean save = clothesService.save(clothes); + ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "服装租赁产品添加失败"); + return ResultUtils.success(clothes.getId()); + } + + + /** + * Web端管理员更新服装租赁产品 + * @param clothesUpdateRequest 服装租赁产品更新请求体 + * @return 是否更新成功 + */ + @PostMapping("/update") + @Operation(summary = "Web端管理员更新服装租赁产品", description = "参数:服装租赁产品更新请求体,权限:管理员(admin, boss),方法名:updateClothes") + @AuthCheck(mustRole = UserConstant.ADMIN_ROLE) + public BaseResponse updateClothes(@RequestBody ClothesUpdateRequest clothesUpdateRequest) { + if (clothesUpdateRequest == null || clothesUpdateRequest.getId() <= 0) { + throw new BusinessException(ErrorCode.PARAMS_ERROR); + } + // 更新服装租赁产品 + Clothes clothes = commonService.copyProperties(clothesUpdateRequest, Clothes.class); + clothesService.validClothes(clothes, true); + + boolean result = clothesService.updateById(clothes); + ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服装租赁产品更新失败"); + + return ResultUtils.success(true); + } + + + /** + * Web端管理员根据id删除服装租赁产品 + * @param commonRequest 服装租赁产品id + * @return 是否删除成功 + */ + @PostMapping("/delete") + @AuthCheck(mustRole = UserConstant.ADMIN_ROLE) + @Operation(summary = "Web端管理员根据id删除服装租赁产品", description = "参数:服装租赁产品id,权限:管理员(admin, boss),方法名:deleteClothes") + public BaseResponse deleteClothes(@RequestBody CommonRequest commonRequest) { + if (commonRequest == null || commonRequest.getId() <= 0) { + throw new BusinessException(ErrorCode.PARAMS_ERROR); + } + boolean result = clothesService.removeById(commonRequest.getId()); + ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服装租赁产品删除失败"); + return ResultUtils.success(true); + } + + + + /** + * web端用户根据id查询服装主要信息 + * @param commonRequest 服装id + * @return 服装信息 + */ + @PostMapping("/query/id") + @Operation(summary = "web端用户根据id查询服装主要信息", description = "参数:服装id,权限:所有人,方法名:webGetClothesById") + @AuthCheck(mustRole = UserConstant.ADMIN_ROLE) + public BaseResponse webGetClothesById(@RequestBody CommonRequest commonRequest) { + if (commonRequest == null) throw new BusinessException(ErrorCode.PARAMS_ERROR); + return ResultUtils.success(clothesService.getClothesById(commonRequest.getId())); + } + + + + + /** + * 根据服装id查询服装信息 + */ + @PostMapping("/get/id") + @Operation(summary = "小程序端用户根据id查询服装", description = "参数:服装id,权限:所有人,方法名:getClothesById") + public BaseResponse getClothesById(@RequestBody CommonRequest commonRequest) { + if (commonRequest == null) throw new BusinessException(ErrorCode.PARAMS_ERROR); + return ResultUtils.success(clothesService.getClothesById(commonRequest.getId())); + } + + + + + /** + * Web端管理员分页查询服装 + * @param clothesQueryRequest 查询服装请求体 + * @return 服装信息列表 + */ + @PostMapping("/list/page") + @Operation(summary = "Web端管理员分页查询服装", description = "参数:服装查询请求体,排序字段 sortField: price inventory id,权限:管理员(admin, boss),方法名:listClothesByPage") + @AuthCheck(mustRole = UserConstant.ADMIN_ROLE) + public BaseResponse> listClothesByPage(@RequestBody ClothesQueryRequest clothesQueryRequest) { + long current = clothesQueryRequest.getCurrent(); + long pageSize = clothesQueryRequest.getPageSize(); + QueryWrapper clothesQueryWrapper = clothesService.getQueryWrapper(clothesQueryRequest); + Page page = clothesService.page(new Page<>(current, pageSize), clothesQueryWrapper); + List records = page.getRecords(); + + List clothesVOS = commonService.convertList(records, ClothesVO.class); + Page clothesPageVOPage = new Page<>(); + clothesPageVOPage.setRecords(clothesVOS); + clothesPageVOPage.setTotal(page.getTotal()); + clothesPageVOPage.setSize(page.getSize()); + clothesPageVOPage.setCurrent(page.getCurrent()); + clothesPageVOPage.setPages(page.getPages()); + + return ResultUtils.success(clothesPageVOPage); + } + + + + + + + /** + * Web端管理员批量删除服装 + * @param commonDelBatchRequest 批量删除请求体 + * @return 是否批量删除成功 + */ + @PostMapping("/delBatch") + @Operation(summary = "Web端管理员批量删除服装", description = "参数:服装批量删除请求体,权限:管理员(admin, boss),方法名:delBatchClothes") + @AuthCheck(mustRole = UserConstant.ADMIN_ROLE) + public BaseResponse delBatchClothes(@RequestBody CommonBatchRequest commonDelBatchRequest) { + if (commonDelBatchRequest == null || CollectionUtils.isEmpty(commonDelBatchRequest.getIdList())) { + throw new BusinessException(ErrorCode.PARAMS_ERROR); + } + List idList = commonDelBatchRequest.getIdList(); + // 批量删除服装 + boolean result = clothesService.removeBatchByIds(idList); + ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服装批量删除失败"); + + return ResultUtils.success(true); + } + + + +} diff --git a/src/main/java/com/cultural/heritage/controller/good/CategoryController.java b/src/main/java/com/cultural/heritage/controller/good/CategoryController.java index 4aca630..eb8a6b3 100644 --- a/src/main/java/com/cultural/heritage/controller/good/CategoryController.java +++ b/src/main/java/com/cultural/heritage/controller/good/CategoryController.java @@ -96,7 +96,6 @@ public class CategoryController { // 批量删除当前类别下的所有商品 Long id = deleteCategoryRequest.getId(); Category category = categoryService.getCategoryById(id); - ThrowUtils.throwIf(category == null, ErrorCode.OPERATION_ERROR, "当前类别不存在"); String typeName = category.getTypeName(); List goodList = commonService.findByFieldEqTargetField("type", typeName, goodService); @@ -158,7 +157,6 @@ public class CategoryController { // 获取原有的类别名称 Long id = categoryUpdateRequest.getId(); Category originCategory = categoryService.getById(id); - ThrowUtils.throwIf(originCategory == null, ErrorCode.OPERATION_ERROR, "类别不存在"); String originTypeName = originCategory.getTypeName(); // 获取目标的类别名称 String targetTypeName = categoryUpdateRequest.getTypeName(); @@ -189,8 +187,7 @@ public class CategoryController { @PostMapping("/list/web") @Operation(summary = "Web端管理员查询商品类别", description = "参数:无,权限:所有人,方法名:listCategoryOnWeb") @AuthCheck(mustRole = UserConstant.ADMIN_ROLE) - public BaseResponse> listCategoryOnWeb(HttpServletRequest request) { - userService.getLoginUser(request); + public BaseResponse> listCategoryOnWeb() { List list = categoryService.list(); // TODO // for (Category category : list) { @@ -203,7 +200,7 @@ public class CategoryController { /** - * 查询所有商品类别 + * 小程序端用户查询商品类别 * @return 商品类别列表 */ @PostMapping("/list") @@ -224,7 +221,7 @@ public class CategoryController { /** - * 根据类别查询商品列表 + * 小程序端用户根据类别id查询该类的所有商品 * @param categoryQueryRequest 类别查询请求体 * @return 当前类别的商品列表 */ diff --git a/src/main/java/com/cultural/heritage/controller/order/ClothesOrderController.java b/src/main/java/com/cultural/heritage/controller/order/ClothesOrderController.java new file mode 100644 index 0000000..df0411c --- /dev/null +++ b/src/main/java/com/cultural/heritage/controller/order/ClothesOrderController.java @@ -0,0 +1,4 @@ +package com.cultural.heritage.controller.order; + +public class ClothesOrderController { +} diff --git a/src/main/java/com/cultural/heritage/mapper/ClothesCategoryMapper.java b/src/main/java/com/cultural/heritage/mapper/ClothesCategoryMapper.java new file mode 100644 index 0000000..f4d299c --- /dev/null +++ b/src/main/java/com/cultural/heritage/mapper/ClothesCategoryMapper.java @@ -0,0 +1,7 @@ +package com.cultural.heritage.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.cultural.heritage.model.entity.ClothesCategory; + +public interface ClothesCategoryMapper extends BaseMapper { +} diff --git a/src/main/java/com/cultural/heritage/mapper/ClothesMapper.java b/src/main/java/com/cultural/heritage/mapper/ClothesMapper.java new file mode 100644 index 0000000..c5a02e2 --- /dev/null +++ b/src/main/java/com/cultural/heritage/mapper/ClothesMapper.java @@ -0,0 +1,7 @@ +package com.cultural.heritage.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.cultural.heritage.model.entity.Clothes; + +public interface ClothesMapper extends BaseMapper { +} diff --git a/src/main/java/com/cultural/heritage/mapper/ClothesOrderMapper.java b/src/main/java/com/cultural/heritage/mapper/ClothesOrderMapper.java new file mode 100644 index 0000000..1a14af9 --- /dev/null +++ b/src/main/java/com/cultural/heritage/mapper/ClothesOrderMapper.java @@ -0,0 +1,7 @@ +package com.cultural.heritage.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.cultural.heritage.model.entity.ClothesOrder; + +public interface ClothesOrderMapper extends BaseMapper { +} diff --git a/src/main/java/com/cultural/heritage/model/dto/clotheCategory/ClothesCategoryAddRequest.java b/src/main/java/com/cultural/heritage/model/dto/clotheCategory/ClothesCategoryAddRequest.java new file mode 100644 index 0000000..074b6fe --- /dev/null +++ b/src/main/java/com/cultural/heritage/model/dto/clotheCategory/ClothesCategoryAddRequest.java @@ -0,0 +1,32 @@ +package com.cultural.heritage.model.dto.clotheCategory; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 服装类别添加请求体 + */ +@Data +@Schema(description = "服装类别添加请求体", requiredProperties = {"name", "price"}) +public class ClothesCategoryAddRequest implements Serializable { + + /** + * 类别名称 + */ + @Schema(description = "服装类别名称", example = "夏季男装") + private String name; + + /** + * 定金 + */ + @Schema(description = "服装类别定金", example = "100.00") + private BigDecimal price; + + + @Serial + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/cultural/heritage/model/dto/clotheCategory/ClothesCategoryUpdateRequest.java b/src/main/java/com/cultural/heritage/model/dto/clotheCategory/ClothesCategoryUpdateRequest.java new file mode 100644 index 0000000..c7e2a4e --- /dev/null +++ b/src/main/java/com/cultural/heritage/model/dto/clotheCategory/ClothesCategoryUpdateRequest.java @@ -0,0 +1,38 @@ +package com.cultural.heritage.model.dto.clotheCategory; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 服装类别更新请求体 + */ +@Data +@Schema(description = "服装类别更新请求体", requiredProperties = {"id", "name", "price"}) +public class ClothesCategoryUpdateRequest implements Serializable { + + /** + * id + */ + @Schema(description = "服装类别id (id > 0)", example = "2") + private Long id; + + /** + * 类别名称 + */ + @Schema(description = "服装类别名称", example = "秋季女装") + private String name; + + /** + * 定金 + */ + @Schema(description = "服装类别定金", example = "150.00") + private BigDecimal price; + + + @Serial + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/cultural/heritage/model/dto/clothes/ClothesAddRequest.java b/src/main/java/com/cultural/heritage/model/dto/clothes/ClothesAddRequest.java new file mode 100644 index 0000000..f607561 --- /dev/null +++ b/src/main/java/com/cultural/heritage/model/dto/clothes/ClothesAddRequest.java @@ -0,0 +1,63 @@ +package com.cultural.heritage.model.dto.clothes; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 服装租赁产品添加请求体 + */ +@Data +@Schema(description = "服装租赁产品添加请求体", requiredProperties = {"name", "categoryId", "price", "image", "period", "isShelves"}) +public class ClothesAddRequest implements Serializable { + + /** + * 服装名称 + */ + @Schema(description = "服装名称", example = "夏季白衬衫") + private String name; + + /** + * 类别id + */ + @Schema(description = "服装类别id", example = "1") + private Long categoryId; + + /** + * 价格/天 + */ + @Schema(description = "服装租赁价格/天", example = "50.00") + private BigDecimal price; + + /** + * 最大租赁天数 + */ + @Schema(description = "最大租赁天数", example = "30") + private Integer period; + + + /** + * 服装图片 + */ + @Schema(description = "服装图片", example = "https://xxx.jpg") + private String image; + + + /** + * 富文本 + */ + @Schema(description = "服装详情富文本", example = "

这是夏季白衬衫的描述

") + private String richText; + + /** + * 是否上架 + */ + @Schema(description = "是否上架", example = "1") + private Integer isShelves; + + @Serial + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/cultural/heritage/model/dto/clothes/ClothesQueryRequest.java b/src/main/java/com/cultural/heritage/model/dto/clothes/ClothesQueryRequest.java new file mode 100644 index 0000000..7206c04 --- /dev/null +++ b/src/main/java/com/cultural/heritage/model/dto/clothes/ClothesQueryRequest.java @@ -0,0 +1,45 @@ +package com.cultural.heritage.model.dto.clothes; + +import com.cultural.heritage.common.PageRequest; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 服装查询请求体 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@Schema(description = "服装查询请求体", requiredProperties = {"current", "pageSize"}) +public class ClothesQueryRequest extends PageRequest implements Serializable { + + /** + * 服装id + */ + @Schema(description = "服装id(id > 0)", example = "17") + private Long id; + + /** + * 服装名称 + */ + @Schema(description = "服装名称", example = "汉服") + private String name; + + /** + * 类别id + */ + @Schema(description = "服装类别id", example = "1") + private Long categoryId; + + /** + * 是否上架 + */ + @Schema(description = "是否上架(1:上架;0:下架)", example = "1") + private Integer isShelves; + + @Serial + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/cultural/heritage/model/dto/clothes/ClothesUpdateRequest.java b/src/main/java/com/cultural/heritage/model/dto/clothes/ClothesUpdateRequest.java new file mode 100644 index 0000000..950e123 --- /dev/null +++ b/src/main/java/com/cultural/heritage/model/dto/clothes/ClothesUpdateRequest.java @@ -0,0 +1,67 @@ +package com.cultural.heritage.model.dto.clothes; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 服装更新请求体 + */ +@Data +@Schema(description = "服装更新请求体", requiredProperties = {"id", "name", "category", "price", "image", "period", "isShelves"}) +public class ClothesUpdateRequest implements Serializable { + + /** + * 服装id + */ + @Schema(description = "服装id(id > 0)", example = "17") + private Long id; + + /** + * 服装名称 + */ + @Schema(description = "服装名称", example = "汉服") + private String name; + + /** + * 类别id + */ + @Schema(description = "服装类别id", example = "1") + private Long categoryId; + + /** + * 价格/天 + */ + @Schema(description = "价格/天", example = "100.00") + private BigDecimal price; + + /** + * 最大租赁天数 + */ + @Schema(description = "最大租赁天数", example = "30") + private Integer period; + + /** + * 服装图片 + */ + @Schema(description = "服装图片", example = "https://xxx.jpg") + private String image; + + /** + * 富文本 + */ + @Schema(description = "服装详情(富文本)", example = "

详细描述

") + private String richText; + + /** + * 是否上架 + */ + @Schema(description = "是否上架(1:上架;0:下架)", example = "1") + private Integer isShelves; + + @Serial + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/cultural/heritage/model/entity/Clothes.java b/src/main/java/com/cultural/heritage/model/entity/Clothes.java new file mode 100644 index 0000000..e6de9cd --- /dev/null +++ b/src/main/java/com/cultural/heritage/model/entity/Clothes.java @@ -0,0 +1,79 @@ +package com.cultural.heritage.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 服装租赁产品 + * @TableName clothes + */ +@Data +@TableName("clothes") +public class Clothes implements Serializable { + + /** + * 编号 + */ + @TableId(type = IdType.AUTO) + private Long id; + + /** + * 服装名称 + */ + private String name; + + /** + * 类别id + */ + private Long categoryId; + + /** + * 价格/天 + */ + private BigDecimal price; + + /** + * 最大租赁天数 + */ + private Integer period; + + /** + * 服装图片 + */ + private String image; + + /** + * 富文本 + */ + private String richText; + + /** + * 是否上架 + */ + private Integer isShelves; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 是否删除 + */ + private Integer isDelete; + + @Serial + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/cultural/heritage/model/entity/ClothesCategory.java b/src/main/java/com/cultural/heritage/model/entity/ClothesCategory.java new file mode 100644 index 0000000..1996a97 --- /dev/null +++ b/src/main/java/com/cultural/heritage/model/entity/ClothesCategory.java @@ -0,0 +1,61 @@ +package com.cultural.heritage.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + + + + +/** + * 服装类别 + * @TableName clothes_category + */ +@Data +@TableName("clothes_category") +public class ClothesCategory implements Serializable { + + /** + * 编号 + */ + @TableId(type = IdType.AUTO) + private Long id; + + /** + * 类别名称 + */ + private String name; + + /** + * 定金 + */ + private BigDecimal price; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 是否删除 + */ + private Integer isDelete; + + + + @Serial + private static final long serialVersionUID = 1L; + + +} diff --git a/src/main/java/com/cultural/heritage/model/entity/ClothesOrder.java b/src/main/java/com/cultural/heritage/model/entity/ClothesOrder.java new file mode 100644 index 0000000..5e79516 --- /dev/null +++ b/src/main/java/com/cultural/heritage/model/entity/ClothesOrder.java @@ -0,0 +1,4 @@ +package com.cultural.heritage.model.entity; + +public class ClothesOrder { +} diff --git a/src/main/java/com/cultural/heritage/model/vo/clothes/ClothesCategoryVO.java b/src/main/java/com/cultural/heritage/model/vo/clothes/ClothesCategoryVO.java new file mode 100644 index 0000000..555674f --- /dev/null +++ b/src/main/java/com/cultural/heritage/model/vo/clothes/ClothesCategoryVO.java @@ -0,0 +1,31 @@ +package com.cultural.heritage.model.vo.clothes; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class ClothesCategoryVO implements Serializable { + + /** + * 编号 + */ + private Long id; + + /** + * 类别名称 + */ + private String name; + + /** + * 定金 + */ + private BigDecimal price; + + + @Serial + private static final long serialVersionUID = 1L; + +} diff --git a/src/main/java/com/cultural/heritage/model/vo/clothes/ClothesVO.java b/src/main/java/com/cultural/heritage/model/vo/clothes/ClothesVO.java new file mode 100644 index 0000000..6b10de8 --- /dev/null +++ b/src/main/java/com/cultural/heritage/model/vo/clothes/ClothesVO.java @@ -0,0 +1,55 @@ +package com.cultural.heritage.model.vo.clothes; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class ClothesVO implements Serializable { + + /** + * 编号 + */ + private Long id; + + /** + * 服装名称 + */ + private String name; + + /** + * 类别id + */ + private Long categoryId; + + /** + * 服装图片 + */ + private String image; + + /** + * 价格/天 + */ + private BigDecimal price; + + /** + * 最大租赁天数 + */ + private Integer period; + + /** + * 富文本 + */ + private String richText; + + /** + * 是否上架 + */ + private Integer isShelves; + + + @Serial + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/cultural/heritage/service/clothes/ClothesCategoryService.java b/src/main/java/com/cultural/heritage/service/clothes/ClothesCategoryService.java new file mode 100644 index 0000000..3cdaabf --- /dev/null +++ b/src/main/java/com/cultural/heritage/service/clothes/ClothesCategoryService.java @@ -0,0 +1,13 @@ +package com.cultural.heritage.service.clothes; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.cultural.heritage.model.entity.ClothesCategory; + +public interface ClothesCategoryService extends IService { + + + /** + * 校验 + */ + void validClothesCategory(ClothesCategory clothesCategory, boolean update); +} diff --git a/src/main/java/com/cultural/heritage/service/clothes/ClothesService.java b/src/main/java/com/cultural/heritage/service/clothes/ClothesService.java new file mode 100644 index 0000000..c610d8f --- /dev/null +++ b/src/main/java/com/cultural/heritage/service/clothes/ClothesService.java @@ -0,0 +1,26 @@ +package com.cultural.heritage.service.clothes; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; +import com.cultural.heritage.model.dto.clothes.ClothesQueryRequest; +import com.cultural.heritage.model.entity.Clothes; +import com.cultural.heritage.model.vo.clothes.ClothesVO; + +public interface ClothesService extends IService { + + + /** + * 校验 + */ + void validClothes(Clothes clothes, boolean update); + + + /** + * 获取查询条件 + */ + QueryWrapper getQueryWrapper(ClothesQueryRequest clothesQueryRequest); + + + + ClothesVO getClothesById(Long id); +} diff --git a/src/main/java/com/cultural/heritage/service/clothes/impl/ClothesCategoryServiceImpl.java b/src/main/java/com/cultural/heritage/service/clothes/impl/ClothesCategoryServiceImpl.java new file mode 100644 index 0000000..bf2c594 --- /dev/null +++ b/src/main/java/com/cultural/heritage/service/clothes/impl/ClothesCategoryServiceImpl.java @@ -0,0 +1,46 @@ +package com.cultural.heritage.service.clothes.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.cultural.heritage.common.ErrorCode; +import com.cultural.heritage.exception.BusinessException; +import com.cultural.heritage.exception.ThrowUtils; +import com.cultural.heritage.mapper.ClothesCategoryMapper; +import com.cultural.heritage.model.entity.ClothesCategory; +import com.cultural.heritage.service.clothes.ClothesCategoryService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +@Service +public class ClothesCategoryServiceImpl extends ServiceImpl implements ClothesCategoryService { + + + /** + * 校验 + */ + @Override + public void validClothesCategory(ClothesCategory clothesCategory, boolean update) { + + Long id = clothesCategory.getId(); + String name = clothesCategory.getName(); + + if (update) { + if (id == null) { + throw new BusinessException(ErrorCode.PARAMS_ERROR, "参数id错误"); + } + } + if (StringUtils.isBlank(name)) { + throw new BusinessException(ErrorCode.PARAMS_ERROR, "类别名称不能为空"); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("name", name); + if (update) { + queryWrapper.ne("id", id); + Long count = this.baseMapper.selectCount(queryWrapper); + ThrowUtils.throwIf(count > 0, ErrorCode.OPERATION_ERROR, "当前服装类别名称已存在"); + } else { + Long count = this.baseMapper.selectCount(queryWrapper); + ThrowUtils.throwIf(count > 0, ErrorCode.OPERATION_ERROR, "不能重复添加服装类别名称"); + } + } +} diff --git a/src/main/java/com/cultural/heritage/service/clothes/impl/ClothesServiceImpl.java b/src/main/java/com/cultural/heritage/service/clothes/impl/ClothesServiceImpl.java new file mode 100644 index 0000000..ca78e3c --- /dev/null +++ b/src/main/java/com/cultural/heritage/service/clothes/impl/ClothesServiceImpl.java @@ -0,0 +1,104 @@ +package com.cultural.heritage.service.clothes.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.cultural.heritage.common.ErrorCode; +import com.cultural.heritage.constant.CommonConstant; +import com.cultural.heritage.exception.BusinessException; +import com.cultural.heritage.exception.ThrowUtils; +import com.cultural.heritage.mapper.ClothesMapper; +import com.cultural.heritage.model.dto.clothes.ClothesQueryRequest; +import com.cultural.heritage.model.entity.Clothes; +import com.cultural.heritage.model.vo.clothes.ClothesVO; +import com.cultural.heritage.service.clothes.ClothesService; +import com.cultural.heritage.service.common.CommonService; +import com.cultural.heritage.utils.DecoderUtils; +import com.cultural.heritage.utils.SqlUtils; +import jakarta.annotation.Resource; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; + +@Service +public class ClothesServiceImpl extends ServiceImpl implements ClothesService { + + + @Resource + private CommonService commonService; + + + /** + * 校验 + */ + @Override + public void validClothes(Clothes clothes, boolean update) { + Long id = clothes.getId(); + String name = clothes.getName(); + Long categoryId = clothes.getCategoryId(); + BigDecimal price = clothes.getPrice(); + Integer period = clothes.getPeriod(); + + if (update) { + if (id == null) { + throw new BusinessException(ErrorCode.PARAMS_ERROR, "参数id错误"); + } + } + if (StringUtils.isBlank(name)) { + throw new BusinessException(ErrorCode.PARAMS_ERROR, "服装名称不能为空"); + } + if (categoryId == null || categoryId <= 0) { + throw new BusinessException(ErrorCode.PARAMS_ERROR, "服装类别不能为空"); + } + if (price == null || price.compareTo(BigDecimal.ZERO) <= 0) { + throw new BusinessException(ErrorCode.PARAMS_ERROR, "价格必须大于零"); + } + if (period == null || period <= 0) { + throw new BusinessException(ErrorCode.PARAMS_ERROR, "租赁天数必须大于零"); + } + } + + + /** + * 获取查询条件 + */ + @Override + public QueryWrapper getQueryWrapper(ClothesQueryRequest clothesQueryRequest) { + + Long id = clothesQueryRequest.getId(); + String name = clothesQueryRequest.getName(); + Long categoryId = clothesQueryRequest.getCategoryId(); + Integer isShelves = clothesQueryRequest.getIsShelves(); + String sortField = clothesQueryRequest.getSortField(); + String sortOrder = clothesQueryRequest.getSortOrder(); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(id != null, "id", id); + queryWrapper.like(StringUtils.isNotBlank(name), "name", name); + queryWrapper.eq(categoryId != null, "categoryId", categoryId); + queryWrapper.eq("isShelves", isShelves); + + // 根据排序字段和排序顺序进行排序 + queryWrapper.orderBy(SqlUtils.validSortField(sortField), + sortOrder.equals(CommonConstant.SORT_ORDER_ASC), + sortField); + + return queryWrapper; + } + + + /** + * 根据服装id查询服装信息 + */ + public ClothesVO getClothesById(Long id) { + if (id == null || id <= 0) { + throw new BusinessException(ErrorCode.PARAMS_ERROR); + } + Clothes clothes = this.getById(id); + ThrowUtils.throwIf(clothes == null, ErrorCode.OPERATION_ERROR, "服装不存在"); + // 处理富文本字段 + clothes.setRichText(DecoderUtils.decodeText(clothes.getRichText())); + // 转换为VO对象 + return commonService.copyProperties(clothes, ClothesVO.class); + } +} diff --git a/src/main/java/com/cultural/heritage/service/common/CommonService.java b/src/main/java/com/cultural/heritage/service/common/CommonService.java index d19b02a..edec8b9 100644 --- a/src/main/java/com/cultural/heritage/service/common/CommonService.java +++ b/src/main/java/com/cultural/heritage/service/common/CommonService.java @@ -1,5 +1,6 @@ package com.cultural.heritage.service.common; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; @@ -70,6 +71,18 @@ public interface CommonService { + /** + * 根据指定字段名和值,使用给定的服务对象构建查询条件。 + * @param 实体类类型 + * @param fieldName 查询字段的名称 + * @param fieldValue 查询字段的值 + * @param service 用于执行查询的服务层对象 + * + * @return 返回构建的 QueryWrapper 对象,用于进一步查询或修改 + */ + QueryWrapper buildQueryWrapperByField(String fieldName, Object fieldValue, IService service); + + /** diff --git a/src/main/java/com/cultural/heritage/service/common/impl/CommonServiceImpl.java b/src/main/java/com/cultural/heritage/service/common/impl/CommonServiceImpl.java index 4148913..2d07515 100644 --- a/src/main/java/com/cultural/heritage/service/common/impl/CommonServiceImpl.java +++ b/src/main/java/com/cultural/heritage/service/common/impl/CommonServiceImpl.java @@ -156,6 +156,26 @@ public class CommonServiceImpl implements CommonService { + /** + * 根据指定字段名和值,使用给定的服务对象构建查询条件。 + * @param 实体类类型 + * @param fieldName 查询字段的名称 + * @param fieldValue 查询字段的值 + * @param service 用于执行查询的服务层对象 + * + * @return 返回构建的 QueryWrapper 对象,用于进一步查询或修改 + */ + @Override + public QueryWrapper buildQueryWrapperByField(String fieldName, Object fieldValue, IService service) { + // 创建 QueryWrapper,动态构建查询条件 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(fieldName, fieldValue); // 设置等值查询条件 + + // 返回 QueryWrapper,供外部使用 + return queryWrapper; + } + + diff --git a/src/main/resources/mapper/Clothes.xml b/src/main/resources/mapper/Clothes.xml new file mode 100644 index 0000000..21ad4f9 --- /dev/null +++ b/src/main/resources/mapper/Clothes.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/ClothesCategory.xml b/src/main/resources/mapper/ClothesCategory.xml new file mode 100644 index 0000000..cb42be2 --- /dev/null +++ b/src/main/resources/mapper/ClothesCategory.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/ClothesOrder.xml b/src/main/resources/mapper/ClothesOrder.xml new file mode 100644 index 0000000..aa2f39b --- /dev/null +++ b/src/main/resources/mapper/ClothesOrder.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file