package com.yonge.cooleshow.biz.dal.wrapper;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.microsvc.toolkit.common.response.paging.QueryInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Optional;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

/**
 * 商品价格设置
 * 2023-07-21 17:32:49
 */
@ApiModel(value = "SysGoodsPriceWrapper对象", description = "商品价格设置查询对象")
public class SysGoodsPriceWrapper {

    @Data
	@Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" SysGoodsPriceQuery-商品价格设置")
    public static class SysGoodsPriceQuery implements QueryInfo {
    
    	@ApiModelProperty("当前页")
        private Integer page;
        
        @ApiModelProperty("分页行数")
        private Integer rows;
        
        @ApiModelProperty("关键字匹配")
		private String keyword;
        
        public String getKeyword() {
            return Optional.ofNullable(keyword).filter(StringUtils::isNotBlank).orElse(null);
        }
        
        public String jsonString() {
            return JSON.toJSONString(this);
        }

        public static SysGoodsPriceQuery from(String json) {
            return JSON.parseObject(json, SysGoodsPriceQuery.class);
        }
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
	@ApiModel(" SysGoodsPrice-商品价格设置")
    public static class SysGoodsPrice {
        @ApiModelProperty("主键ID")
        private Long id;

        @ApiModelProperty("商品类型")
        private String goodsType;

        @ApiModelProperty("销售价")
        private BigDecimal salePrice;

        @ApiModelProperty("原价")
        private BigDecimal originalPrice;

        @ApiModelProperty("描述")
        private String describe;

        @ApiModelProperty("购买周期")
        private Integer duration;

        @ApiModelProperty("图片")
        private String goodsImg;

        @ApiModelProperty("更新人")
        private Long updateBy;

        @ApiModelProperty("更新时间")
        private Date updateTime;

        @ApiModelProperty("创建时间")
        private Date createTime;
        public String jsonString() {
            return JSON.toJSONString(this);
        }

        public static SysGoodsPrice from(String json) {
            return JSON.parseObject(json, SysGoodsPrice.class);
        }
	}

}