package com.cyksj.model.views;

import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.SearchBean;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

/*
 *项目名: netflix
 *文件名: ArticleSelfFrontView
 *创建者: JavaZou
 *创建时间:2023/6/27 13:50
 */
@Getter
@Setter
@SearchBean(tables = "(select id,article_id,is_dz,is_col from article_user_mark :condition:) aum left join article a on a.id = aum.article_id",
		where = "a.status is true and a.deleted is true",
		groupBy = "a.id,a.name,a.banner,a.author,a.head_img_url,a.img,a.update_time,a.dz_num,a.col_num")
public class ArticleSelfFrontView {
	@DbField("a.id")
	private Long id;

	@DbField("a.name")
	private String name;

	@DbField("a.banner")
	private String banner;

	@DbField("a.author")
	private String author;

	@DbField("a.head_img_url")
	private String headImgUrl;

	@DbField("a.img")
	private String img;

	@DbField("a.update_time")
	private Date releaseTime;

	@DbField("a.dz_num")
	private Integer dzNum;

	@DbField("a.col_num")
	private Integer colNum;

	@DbField("if(count(if(aum.id is not null and aum.is_dz is true,1,NULL))>0, true,false)")
	private Boolean isDz = false;

	@DbField("if(count(if(aum.id is not null and aum.is_col is true,1,NULL))>0,true,false)")
	private Boolean isCol = false;
}
