fix(AddressController.java): 新增会员地址移除会员ID必填判断

This commit is contained in:
有来技术 2021-08-23 21:14:57 +08:00
parent 04105e75e4
commit f915e0aad0
2 changed files with 2 additions and 6 deletions

View File

@ -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}")

View File

@ -41,12 +41,10 @@ public class AddressController {
@ApiOperation(value = "新增地址")
@ApiImplicitParam(name = "address", value = "实体JSON对象", required = true, paramType = "body", dataType = "UmsAddress")
@PostMapping
public <T> Result<T> 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<UmsAddress>()
.eq(UmsAddress::getMemberId, memberId)