From f915e0aad0f23fb01bcc3daa191a4d70490d14fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=89=E6=9D=A5=E6=8A=80=E6=9C=AF?= <1490493387@qq.com> Date: Mon, 23 Aug 2021 21:14:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(AddressController.java):=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=BC=9A=E5=91=98=E5=9C=B0=E5=9D=80=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E4=BC=9A=E5=91=98ID=E5=BF=85=E5=A1=AB=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/youlai/mall/ums/pojo/entity/UmsAddress.java | 6 ++---- .../youlai/mall/ums/controller/app/AddressController.java | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/mall-ums/ums-api/src/main/java/com/youlai/mall/ums/pojo/entity/UmsAddress.java b/mall-ums/ums-api/src/main/java/com/youlai/mall/ums/pojo/entity/UmsAddress.java index a507e39cf..663b7f962 100644 --- a/mall-ums/ums-api/src/main/java/com/youlai/mall/ums/pojo/entity/UmsAddress.java +++ b/mall-ums/ums-api/src/main/java/com/youlai/mall/ums/pojo/entity/UmsAddress.java @@ -10,9 +10,7 @@ import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import org.hibernate.validator.constraints.Length; -import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; -import javax.validation.constraints.Positive; @Data @Accessors(chain = true) @@ -22,8 +20,8 @@ public class UmsAddress extends BaseEntity { @TableId(type = IdType.AUTO) private Long id; - @NotNull(message = "{id.positive}") - @Positive(message = "{id.positive}") + // @NotNull(message = "{id.positive}") + // @Positive(message = "{id.positive}") private Long memberId; @Length(min = 2, max = 8, message = "{text.length.min},{text.length.max}") diff --git a/mall-ums/ums-boot/src/main/java/com/youlai/mall/ums/controller/app/AddressController.java b/mall-ums/ums-boot/src/main/java/com/youlai/mall/ums/controller/app/AddressController.java index 565a957ab..a28762d1c 100644 --- a/mall-ums/ums-boot/src/main/java/com/youlai/mall/ums/controller/app/AddressController.java +++ b/mall-ums/ums-boot/src/main/java/com/youlai/mall/ums/controller/app/AddressController.java @@ -41,12 +41,10 @@ public class AddressController { @ApiOperation(value = "新增地址") - @ApiImplicitParam(name = "address", value = "实体JSON对象", required = true, paramType = "body", dataType = "UmsAddress") @PostMapping public Result add(@RequestBody @Validated UmsAddress address) { Long memberId = JwtUtils.getUserId(); address.setMemberId(memberId); - address.setId(null); if (ADDRESS_DEFAULTED.equals(address.getDefaulted())) { // 修改其他默认地址为非默认 iUmsAddressService.update(new LambdaUpdateWrapper() .eq(UmsAddress::getMemberId, memberId)