修改了分页查询订单接口

This commit is contained in:
chen-xin-zhi 2024-11-08 18:44:37 +08:00
parent 397634f2d5
commit 4b4e21c52a
6 changed files with 42 additions and 3 deletions

View File

@ -110,4 +110,6 @@ public class CartRecordController {
List<CartRecordVO> cartRecordVOList = cartRecordService.transformToCartRecordVOList(list); List<CartRecordVO> cartRecordVOList = cartRecordService.transformToCartRecordVOList(list);
return ResultUtils.success(cartRecordVOList); return ResultUtils.success(cartRecordVOList);
} }
} }

View File

@ -144,4 +144,25 @@ public class GoodController {
/**
* 根据id查询商品
* @param getByIdRequest 根据id查询请求体
* @return 商品信息
*/
@PostMapping("/getById")
@Operation(summary = "根据id查询商品", description = "参数商品根据id查询请求体权限管理员(admin, boss), 方法名:getGoodById")
public BaseResponse<Good> 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);
}
} }

View File

@ -34,6 +34,12 @@ public class CartRecordAddRequest implements Serializable {
@Schema(description = "小计(商品单价 * 数量)", example = "60") @Schema(description = "小计(商品单价 * 数量)", example = "60")
private Double subtotal; private Double subtotal;
/**
* 是否是常规类商品
*/
@Schema(description = "是否是常规类商品", example = "1")
private Integer isGoodType;
@Serial @Serial

View File

@ -52,6 +52,11 @@ public class CartRecord implements Serializable {
*/ */
private Date updateTime; private Date updateTime;
/**
* 是否为商品类型
*/
private Integer isGoodType;
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -4,8 +4,6 @@ import lombok.Data;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import java.util.List;
@Data @Data
public class CartRecordVO implements Serializable { public class CartRecordVO implements Serializable {
@ -42,6 +40,12 @@ public class CartRecordVO implements Serializable {
*/ */
private GoodVO goodVO; private GoodVO goodVO;
/**
* 是否是常规类商品
*/
private Integer isGoodType;
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -16,7 +16,6 @@ import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
@Service @Service
@ -51,6 +50,8 @@ public class CartRecordServiceImpl extends ServiceImpl<CartRecordMapper, CartRec
return true; return true;
} }
/** /**
* 封装用户购物车中的商品信息 * 封装用户购物车中的商品信息
*/ */