package com.wzj.soopin.content.domain.bo;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wzj.soopin.content.domain.po.Article;
import io.swagger.annotations.ApiModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.dromara.common.core.domain.BaseBO;
import org.dromara.common.core.domain.model.BaseAudit;

/**
 * 文章DO
 *
 * @author Bulbasaur
 * @since 2020/12/10 17:42
 */
@Data
@TableName("cont_article")
@ApiModel(value = "文章")
public class ArticleBO extends BaseBO<Article> {

    /**
     * id
     */
    @Schema(description = "id")
    private Long id;
    /**
     * 标题
     */
    @Schema(description = "标题")
    private String title;

    /**
     * 分类id
     */
    @Schema(description = "分类id")
    private Long categoryId;

    /**
     * 排序
     */
    @Schema(description = "排序")
    private Integer sort;

    /**
     * 内容
     */
    @Schema(description = "内容")
    private String content;

    /**
     * 状态
     */
    @Schema(description = "状态")
    private Integer status;
    /**
     * 类型
     */
    @Schema(description = "类型")
    private Integer type;
    /**
     * 图片
     */
    @Schema(description = "图片")
    private String images;
    /**
     * 链接
     */
    @Schema(description = "链接")
    private String url;
    /**
     * 备注
     */
    @Schema(description = "备注")
    private String remark;

    @Override
    public LambdaQueryWrapper<Article> toWrapper() {
        return super.toWrapper().eq(id!=null, Article::getId, id)
            .eq(title!=null, Article::getTitle, title)
            .eq(categoryId!=null, Article::getCategoryId, categoryId)
            .eq(sort!=null, Article::getSort, sort)
            .eq(content!=null, Article::getContent, content)
            .eq(status!=null, Article::getStatus, status)
            .eq(type!=null, Article::getType, type)
            .eq(images!=null, Article::getImages, images)
            .eq(url!=null, Article::getUrl, url);
    }
}
