From a647a08e36517f4473d0fcdc881eba65afec3394 Mon Sep 17 00:00:00 2001 From: chen-xin-zhi <3588068430@qq.com> Date: Sat, 2 Nov 2024 10:08:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BA=86=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E5=85=91=E6=8D=A2=E4=BC=98=E6=83=A0=E5=88=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/good/CategoryController.java | 3 - .../heritage/mapper/CartRecordMapper.java | 7 +++ .../model/dto/coupon/CouponAddRequest.java | 4 ++ .../model/dto/coupon/CouponUpdateRequest.java | 10 +++- .../heritage/model/entity/Address.java | 1 + .../heritage/model/entity/CartRecord.java | 59 +++++++++++++++++++ .../heritage/model/entity/Category.java | 3 + .../heritage/model/entity/Coupon.java | 8 +++ .../heritage/model/entity/Exchange.java | 3 + .../cultural/heritage/model/entity/Good.java | 3 + .../cultural/heritage/model/entity/User.java | 3 + .../service/good/CartRecordService.java | 8 +++ .../good/impl/CartRecordServiceImpl.java | 4 ++ .../resources/mapper/CartRecordMapper.xml | 7 +++ 14 files changed, 117 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/cultural/heritage/mapper/CartRecordMapper.java create mode 100644 src/main/java/com/cultural/heritage/model/entity/CartRecord.java create mode 100644 src/main/java/com/cultural/heritage/service/good/CartRecordService.java create mode 100644 src/main/java/com/cultural/heritage/service/good/impl/CartRecordServiceImpl.java create mode 100644 src/main/resources/mapper/CartRecordMapper.xml 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 668a1ee..9a81f81 100644 --- a/src/main/java/com/cultural/heritage/controller/good/CategoryController.java +++ b/src/main/java/com/cultural/heritage/controller/good/CategoryController.java @@ -1,7 +1,6 @@ package com.cultural.heritage.controller.good; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.cultural.heritage.common.BaseResponse; import com.cultural.heritage.common.ErrorCode; import com.cultural.heritage.common.ResultUtils; @@ -18,13 +17,11 @@ import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; -import org.springframework.util.CollectionUtils; 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.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/src/main/java/com/cultural/heritage/mapper/CartRecordMapper.java b/src/main/java/com/cultural/heritage/mapper/CartRecordMapper.java new file mode 100644 index 0000000..82ba936 --- /dev/null +++ b/src/main/java/com/cultural/heritage/mapper/CartRecordMapper.java @@ -0,0 +1,7 @@ +package com.cultural.heritage.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.cultural.heritage.model.entity.CartRecord; + +public interface CartRecordMapper extends BaseMapper { +} diff --git a/src/main/java/com/cultural/heritage/model/dto/coupon/CouponAddRequest.java b/src/main/java/com/cultural/heritage/model/dto/coupon/CouponAddRequest.java index 792a421..21aa479 100644 --- a/src/main/java/com/cultural/heritage/model/dto/coupon/CouponAddRequest.java +++ b/src/main/java/com/cultural/heritage/model/dto/coupon/CouponAddRequest.java @@ -46,6 +46,10 @@ public class CouponAddRequest implements Serializable { */ private Integer limitNum; + /** + * 作用范围 + */ + private String useScope; /** * 有效开始日期 diff --git a/src/main/java/com/cultural/heritage/model/dto/coupon/CouponUpdateRequest.java b/src/main/java/com/cultural/heritage/model/dto/coupon/CouponUpdateRequest.java index 14f514e..fbe50c3 100644 --- a/src/main/java/com/cultural/heritage/model/dto/coupon/CouponUpdateRequest.java +++ b/src/main/java/com/cultural/heritage/model/dto/coupon/CouponUpdateRequest.java @@ -1,7 +1,5 @@ package com.cultural.heritage.model.dto.coupon; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; import lombok.Data; import java.io.Serial; @@ -56,12 +54,18 @@ public class CouponUpdateRequest implements Serializable { */ private Date startTime; - /** * 有效截止日期 */ private Date endTime; + + /** + * 作用范围 + */ + private String useScope; + + /** * 使用说明 */ diff --git a/src/main/java/com/cultural/heritage/model/entity/Address.java b/src/main/java/com/cultural/heritage/model/entity/Address.java index 8052a46..02076cd 100644 --- a/src/main/java/com/cultural/heritage/model/entity/Address.java +++ b/src/main/java/com/cultural/heritage/model/entity/Address.java @@ -3,6 +3,7 @@ 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 com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.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 new file mode 100644 index 0000000..de77eae --- /dev/null +++ b/src/main/java/com/cultural/heritage/model/entity/CartRecord.java @@ -0,0 +1,59 @@ +package com.cultural.heritage.model.entity; + +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 cart_record + */ +@Data +@TableName("cart_record") +public class CartRecord implements Serializable { + + + /** + * 购物车记录id + */ + private Long id; + + /** + * 用户id + */ + private Long userId; + + /** + * 商品id + */ + private Long goodId; + + /** + * 数量 + */ + private Integer quantity; + + /** + * 小计 + */ + private BigDecimal subtotal; + + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + + @Serial + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/cultural/heritage/model/entity/Category.java b/src/main/java/com/cultural/heritage/model/entity/Category.java index 179ebb6..0413a58 100644 --- a/src/main/java/com/cultural/heritage/model/entity/Category.java +++ b/src/main/java/com/cultural/heritage/model/entity/Category.java @@ -4,6 +4,7 @@ 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 com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serial; @@ -47,11 +48,13 @@ public class Category implements Serializable { /** * 创建时间 */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createTime; /** * 更新时间 */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date updateTime; /** diff --git a/src/main/java/com/cultural/heritage/model/entity/Coupon.java b/src/main/java/com/cultural/heritage/model/entity/Coupon.java index a69cc44..ee980f4 100644 --- a/src/main/java/com/cultural/heritage/model/entity/Coupon.java +++ b/src/main/java/com/cultural/heritage/model/entity/Coupon.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serial; @@ -80,6 +81,11 @@ public class Coupon implements Serializable { */ private Date endTime; + /** + * 作用范围 + */ + private String useScope; + /** * 使用说明 */ @@ -88,12 +94,14 @@ public class Coupon implements Serializable { /** * 创建时间 */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createTime; /** * 更新时间 */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date updateTime; diff --git a/src/main/java/com/cultural/heritage/model/entity/Exchange.java b/src/main/java/com/cultural/heritage/model/entity/Exchange.java index 84b7995..6eae96e 100644 --- a/src/main/java/com/cultural/heritage/model/entity/Exchange.java +++ b/src/main/java/com/cultural/heritage/model/entity/Exchange.java @@ -3,6 +3,7 @@ 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 com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serial; @@ -47,11 +48,13 @@ public class Exchange implements Serializable { /** * 创建时间 */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createTime; /** * 更新时间 */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date updateTime; diff --git a/src/main/java/com/cultural/heritage/model/entity/Good.java b/src/main/java/com/cultural/heritage/model/entity/Good.java index 9394c20..b552112 100644 --- a/src/main/java/com/cultural/heritage/model/entity/Good.java +++ b/src/main/java/com/cultural/heritage/model/entity/Good.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serial; @@ -91,11 +92,13 @@ public class Good { /** * 创建时间 */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createTime; /** * 更新时间 */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date updateTime; /** diff --git a/src/main/java/com/cultural/heritage/model/entity/User.java b/src/main/java/com/cultural/heritage/model/entity/User.java index 2c7524b..03260c7 100644 --- a/src/main/java/com/cultural/heritage/model/entity/User.java +++ b/src/main/java/com/cultural/heritage/model/entity/User.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serial; @@ -72,11 +73,13 @@ public class User implements Serializable { /** * 创建时间 */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createTime; /** * 更新时间 */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date updateTime; /** diff --git a/src/main/java/com/cultural/heritage/service/good/CartRecordService.java b/src/main/java/com/cultural/heritage/service/good/CartRecordService.java new file mode 100644 index 0000000..0d741c9 --- /dev/null +++ b/src/main/java/com/cultural/heritage/service/good/CartRecordService.java @@ -0,0 +1,8 @@ +package com.cultural.heritage.service.good; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.cultural.heritage.model.entity.CartRecord; + +public interface CartRecordService extends IService { + +} 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 new file mode 100644 index 0000000..e72b523 --- /dev/null +++ b/src/main/java/com/cultural/heritage/service/good/impl/CartRecordServiceImpl.java @@ -0,0 +1,4 @@ +package com.cultural.heritage.service.good.impl; + +public class CartRecordServiceImpl { +} diff --git a/src/main/resources/mapper/CartRecordMapper.xml b/src/main/resources/mapper/CartRecordMapper.xml new file mode 100644 index 0000000..d83f8f6 --- /dev/null +++ b/src/main/resources/mapper/CartRecordMapper.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file