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

import com.alibaba.fastjson.JSON;
import com.microsvc.toolkit.common.response.paging.QueryInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;
import java.util.Optional;

/**
 * 平台建议类型表
 * 2023-08-30 11:26:33
 */
@ApiModel(value = "SysSuggestionTypeWrapper对象", description = "平台建议类型表查询对象")
public class SysSuggestionTypeWrapper {

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" SysSuggestionTypeQuery-平台建议类型表")
    public static class SysSuggestionTypeQuery 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 SysSuggestionTypeQuery from(String json) {
            return JSON.parseObject(json, SysSuggestionTypeQuery.class);
        }
    }

    @Data
    @ApiModel(" SysSuggestionType-平台建议类型表")
    public static class SysSuggestionType {

        @ApiModelProperty("编号")
        private Long id;

        @ApiModelProperty("名称")
        private String name;

        @ApiModelProperty("删除标识（0-正常,1-删除）")
        private Boolean delFlag;

        @ApiModelProperty("创建人")
        private Long createBy;

        @ApiModelProperty("修改人")
        private Long updateBy;

        @ApiModelProperty("修改人名称")
        private String operator;

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

        @ApiModelProperty("创建时间")
        private Date createTime;

        public String jsonString() {
            return JSON.toJSONString(this);
        }

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

}
