罗元桥
2021-09-24 09e41d546b030b47661877d4b8141c88584d7598
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ConvenientProductDTO.java
New file
@@ -0,0 +1,66 @@
package com.panzhihua.common.model.dtos.community.convenient;
import com.panzhihua.common.validated.AddGroup;
import com.panzhihua.common.validated.PutGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
 * @title: ConvenientProductDTO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 新增/编辑便民服务商家后台产品
 * @author: hans
 * @date: 2021/09/20 20:32
 */
@Data
@ApiModel("新增/编辑便民服务商家后台产品")
public class ConvenientProductDTO {
    @ApiModelProperty("产品ID")
    @NotNull(groups = {PutGroup.class}, message = "产品ID不能为空")
    private Long id;
    @ApiModelProperty("产品名称")
    @NotBlank(groups = {AddGroup.class}, message = "产品名称不能为空")
    @Length(groups = {AddGroup.class}, max = 20, message = "产品名称最多支持20个字符")
    private String name;
    @ApiModelProperty("产品介绍")
    private String introduction;
    @ApiModelProperty("所属分类")
    @NotNull(groups = {AddGroup.class}, message = "所属分类不能为空")
    private Long categoryId;
    @ApiModelProperty("产品规格")
    @NotEmpty(groups = {AddGroup.class}, message = "产品规格不能为空")
    private List<ConvenientProductSpecificationDTO> productSpecificationDTOList;
    @ApiModelProperty("上架状态,1.上架 0.下架")
    @NotNull(groups = {AddGroup.class}, message = "上架状态不能为空")
    private Integer onShelf;
    @ApiModelProperty(value = "创建人", hidden = true)
    private Long createdBy;
    @ApiModelProperty(value = "更新人", hidden = true)
    private Long updatedBy;
    @ApiModelProperty(value = "所属商家", hidden = true)
    private Long merchantId;
    public Boolean getOnShelf() {
        return onShelf.intValue() == 1;
    }
    public void setOnShelf(Boolean onShelf) {
        this.onShelf = onShelf ? 1 : 0;
    }
}