mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2025-01-03 17:42:20 +08:00
fix(AddressController.java): 新增会员地址移除会员ID必填判断
This commit is contained in:
parent
04105e75e4
commit
f915e0aad0
@ -10,9 +10,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.hibernate.validator.constraints.Length;
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import javax.validation.constraints.Pattern;
|
import javax.validation.constraints.Pattern;
|
||||||
import javax.validation.constraints.Positive;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@ -22,8 +20,8 @@ public class UmsAddress extends BaseEntity {
|
|||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@NotNull(message = "{id.positive}")
|
// @NotNull(message = "{id.positive}")
|
||||||
@Positive(message = "{id.positive}")
|
// @Positive(message = "{id.positive}")
|
||||||
private Long memberId;
|
private Long memberId;
|
||||||
|
|
||||||
@Length(min = 2, max = 8, message = "{text.length.min},{text.length.max}")
|
@Length(min = 2, max = 8, message = "{text.length.min},{text.length.max}")
|
||||||
|
@ -41,12 +41,10 @@ public class AddressController {
|
|||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "新增地址")
|
@ApiOperation(value = "新增地址")
|
||||||
@ApiImplicitParam(name = "address", value = "实体JSON对象", required = true, paramType = "body", dataType = "UmsAddress")
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public <T> Result<T> add(@RequestBody @Validated UmsAddress address) {
|
public <T> Result<T> add(@RequestBody @Validated UmsAddress address) {
|
||||||
Long memberId = JwtUtils.getUserId();
|
Long memberId = JwtUtils.getUserId();
|
||||||
address.setMemberId(memberId);
|
address.setMemberId(memberId);
|
||||||
address.setId(null);
|
|
||||||
if (ADDRESS_DEFAULTED.equals(address.getDefaulted())) { // 修改其他默认地址为非默认
|
if (ADDRESS_DEFAULTED.equals(address.getDefaulted())) { // 修改其他默认地址为非默认
|
||||||
iUmsAddressService.update(new LambdaUpdateWrapper<UmsAddress>()
|
iUmsAddressService.update(new LambdaUpdateWrapper<UmsAddress>()
|
||||||
.eq(UmsAddress::getMemberId, memberId)
|
.eq(UmsAddress::getMemberId, memberId)
|
||||||
|
Loading…
Reference in New Issue
Block a user