diff --git a/src/main/java/com/cultural/heritage/controller/good/CartRecordController.java b/src/main/java/com/cultural/heritage/controller/good/CartRecordController.java index d05ecdc..e250a98 100644 --- a/src/main/java/com/cultural/heritage/controller/good/CartRecordController.java +++ b/src/main/java/com/cultural/heritage/controller/good/CartRecordController.java @@ -110,4 +110,6 @@ public class CartRecordController { List cartRecordVOList = cartRecordService.transformToCartRecordVOList(list); return ResultUtils.success(cartRecordVOList); } + + } diff --git a/src/main/java/com/cultural/heritage/controller/good/GoodController.java b/src/main/java/com/cultural/heritage/controller/good/GoodController.java index 5fe2018..76e962f 100644 --- a/src/main/java/com/cultural/heritage/controller/good/GoodController.java +++ b/src/main/java/com/cultural/heritage/controller/good/GoodController.java @@ -144,4 +144,25 @@ public class GoodController { + + + /** + * 根据id查询商品 + * @param getByIdRequest 根据id查询请求体 + * @return 商品信息 + */ + @PostMapping("/getById") + @Operation(summary = "根据id查询商品", description = "参数:商品根据id查询请求体,权限:管理员(admin, boss), 方法名:getGoodById") + public BaseResponse getGoodById(@RequestBody CommonRequest getByIdRequest) { + if (getByIdRequest == null || getByIdRequest.getId() <= 0) { + throw new BusinessException(ErrorCode.PARAMS_ERROR); + } + Long id = getByIdRequest.getId(); + Good good = goodService.getById(id); + ThrowUtils.throwIf(good == null, ErrorCode.NOT_FOUND_ERROR); + return ResultUtils.success(good); + } + + + } diff --git a/src/main/java/com/cultural/heritage/model/dto/cart/CartRecordAddRequest.java b/src/main/java/com/cultural/heritage/model/dto/cart/CartRecordAddRequest.java index 7dfcda9..390037f 100644 --- a/src/main/java/com/cultural/heritage/model/dto/cart/CartRecordAddRequest.java +++ b/src/main/java/com/cultural/heritage/model/dto/cart/CartRecordAddRequest.java @@ -34,6 +34,12 @@ public class CartRecordAddRequest implements Serializable { @Schema(description = "小计(商品单价 * 数量)", example = "60") private Double subtotal; + /** + * 是否是常规类商品 + */ + @Schema(description = "是否是常规类商品", example = "1") + private Integer isGoodType; + @Serial diff --git a/src/main/java/com/cultural/heritage/model/entity/CartRecord.java b/src/main/java/com/cultural/heritage/model/entity/CartRecord.java index 63483df..2831368 100644 --- a/src/main/java/com/cultural/heritage/model/entity/CartRecord.java +++ b/src/main/java/com/cultural/heritage/model/entity/CartRecord.java @@ -52,6 +52,11 @@ public class CartRecord implements Serializable { */ private Date updateTime; + /** + * 是否为商品类型 + */ + private Integer isGoodType; + @Serial private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/cultural/heritage/model/vo/CartRecordVO.java b/src/main/java/com/cultural/heritage/model/vo/CartRecordVO.java index 25e19f6..3c85668 100644 --- a/src/main/java/com/cultural/heritage/model/vo/CartRecordVO.java +++ b/src/main/java/com/cultural/heritage/model/vo/CartRecordVO.java @@ -4,8 +4,6 @@ import lombok.Data; import java.io.Serial; import java.io.Serializable; -import java.util.Date; -import java.util.List; @Data public class CartRecordVO implements Serializable { @@ -42,6 +40,12 @@ public class CartRecordVO implements Serializable { */ private GoodVO goodVO; + /** + * 是否是常规类商品 + */ + private Integer isGoodType; + + @Serial private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/cultural/heritage/service/good/impl/CartRecordServiceImpl.java b/src/main/java/com/cultural/heritage/service/good/impl/CartRecordServiceImpl.java index c7af1ef..7689b84 100644 --- a/src/main/java/com/cultural/heritage/service/good/impl/CartRecordServiceImpl.java +++ b/src/main/java/com/cultural/heritage/service/good/impl/CartRecordServiceImpl.java @@ -16,7 +16,6 @@ import jakarta.annotation.Resource; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; -import java.math.BigDecimal; import java.util.List; @Service @@ -51,6 +50,8 @@ public class CartRecordServiceImpl extends ServiceImpl