From 18d4c3fb8fcc09f21ced45d085343e6c97a31132 Mon Sep 17 00:00:00 2001 From: grey <2300486727@qq.com> Date: Mon, 16 Dec 2024 19:46:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yami/shop/bean/app/param/AddrParam.java | 189 ++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 yami-shop-bean/src/main/java/com/yami/shop/bean/app/param/AddrParam.java diff --git a/yami-shop-bean/src/main/java/com/yami/shop/bean/app/param/AddrParam.java b/yami-shop-bean/src/main/java/com/yami/shop/bean/app/param/AddrParam.java new file mode 100644 index 0000000..8b3bb5b --- /dev/null +++ b/yami-shop-bean/src/main/java/com/yami/shop/bean/app/param/AddrParam.java @@ -0,0 +1,189 @@ +package com.yami.shop.bean.app.param; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; + +/** + * AddrParam类用于封装与地址相关的参数信息,在应用层(app)传递地址相关的数据时使用。 + * 此类中的各个属性对应地址的不同组成部分,并且通过相关注解进行了验证约束和描述说明,方便数据的校验与接口文档生成。 + * + * @author lanhai + */ +@Schema(description = "地址参数") +public class AddrParam { + + /** + * 地址的唯一标识符,用于在系统中区分不同的地址记录。 + * 通过 @Schema 注解描述该属性在接口文档中的相关信息,设置为必填项(required=true)。 + */ + @Schema(description = "地址ID", required = true) + private Long addrId; + + /** + * 收货人的姓名,是地址信息中重要的一部分,不能为空,通过 @NotNull 注解进行验证约束, + * 同时使用 @Schema 注解在接口文档中进行相应描述,且设置为必填项。 + */ + @NotNull(message = "收货人不能为空") + @Schema(description = "收货人", required = true) + private String receiver; + + /** + * 详细的地址内容,例如街道名称、门牌号等具体的收货地址信息,不能为空, + * 利用 @NotNull 约束验证,通过 @Schema 注解在接口文档中说明,设置为必填项。 + */ + @NotNull(message = "地址不能为空") + @Schema(description = "地址", required = true) + private String addr; + + /** + * 地址对应的邮编信息,该属性为可选填项(required=false),通过 @Schema 注解在接口文档中体现其属性描述。 + */ + @Schema(description = "邮编", required = false) + private String postCode; + + /** + * 收货人联系用的手机号码,是确保能联系到收货人的关键信息,不能为空, + * 使用 @NotNull 进行约束,借助 @Schema 注解在接口文档里标记为必填项并描述。 + */ + @NotNull(message = "手机不能为空") + @Schema(description = "手机", required = true) + private String mobile; + + /** + * 省份的唯一标识符,用于关联对应的省份信息,不能为空, + * 以 @NotNull 做验证,通过 @Schema 注解在接口文档中表明为必填项并描述其用途。 + */ + @NotNull(message = "省ID不能为空") + @Schema(description = "省ID", required = true) + private Long provinceId; + + /** + * 城市的唯一标识符,用于准确关联到具体的城市信息,不能为空, + * 借助 @NotNull 约束验证,利用 @Schema 注解在接口文档里设置为必填项并描述相关情况。 + */ + @NotNull(message = "城市ID不能为空") + @Schema(description = "城市ID", required = true) + private Long cityId; + + /** + * 区(县等)的唯一标识符,用于精确到具体的区(县等)级别的地域信息,不能为空, + * 通过 @NotNull 进行验证,使用 @Schema 注解在接口文档中标记为必填项并给出相应说明。 + */ + @NotNull(message = "区ID不能为空") + @Schema(description = "区ID", required = true) + private Long areaId; + + /** + * 省份的名称,以字符串形式表示具体的省份,不能为空, + * 通过 @NotNull 约束,配合 @Schema 注解在接口文档里设置为必填项并描述其含义。 + */ + @NotNull(message = "省不能为空") + @Schema(description = "省", required = true) + private String province; + + /** + * 城市的名称,用于明确具体的城市称呼,不能为空, + * 以 @NotNull 进行验证,通过 @Schema 注解在接口文档中设置为必填项并说明情况。 + */ + @NotNull(message = "城市不能为空") + @Schema(description = "城市", required = true) + private String city; + + /** + * 区(县等)的名称,具体指出所在的区(县等)的名称,不能为空, + * 通过 @NotNull 约束验证,利用 @Schema 注解在接口文档里标记为必填项并加以说明。 + */ + @NotNull(message = "区不能为空") + @Schema(description = "区", required = true) + private String area; + + // 以下是各个属性的Getter和Setter方法,用于获取和设置对应属性的值 + + public Long getAddrId() { + return addrId; + } + + public void setAddrId(Long addrId) { + this.addrId = addrId; + } + + public String getReceiver() { + return receiver; + } + + public void setReceiver(String receiver) { + this.receiver = receiver; + } + + public String getAddr() { + return addr; + } + + public void setAddr(String addr) { + this.addr = addr; + } + + public String getPostCode() { + return postCode; + } + + public void setPostCode(String postCode) { + this.postCode = postCode; + } + + public String getMobile() { + return mobile; + } + + public void setMobile(String mobile) { + this.mobile = mobile; + } + + public Long getProvinceId() { + return provinceId; + } + + public void setProvinceId(Long provinceId) { + this.provinceId = provinceId; + } + + public Long getCityId() { + return cityId; + } + + public void setCityId(Long cityId) { + this.cityId = cityId; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getProvince() { + return province; + } + + public void setProvince(String province) { + this.province = province; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } +} \ No newline at end of file