package com.cyksj.model.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.SearchBean;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

/*
 *项目名: yhlxj
 *文件名: YhShopUserPlatDistributeRate
 *创建者: JavaZou
 *创建时间:2023/9/18 14:23
 */
@Getter
@Setter
@SearchBean(tables = "goods_don g left join yh_shop_user_plat_distribute_rate ydr on g.id = ydr.goods_id :uid:",
		where = "g.type = 1 and g.status is true and g.deleted is true and g.is_distribute is true")
public class YhShopUserPlatDistributeRate {
	@TableId(value = "id", type = IdType.AUTO)
	@DbField("ydr.id")
	private Long id;

	@DbField("g.id")
	private Long goodsId;

	@DbField("g.title")
	@TableField(exist = false)
	private String title;

	/**
	 * 店铺主id
	 */
	@DbField("ydr.user_id")
	private Long userId;

	/**
	 * 分销比例
	 */
	@DbField("ifnull(ydr.rate,g.rate)")
	private Integer rate = 0;

	/**
	 * 第二分销比例 不包含套餐
	 */
	@DbField("ydr.second_rate")
	private Integer secondRate;



	/**
	 * 创建时间
	 */
	@TableField(fill = FieldFill.INSERT)
	@DbField("ydr.created_time")
	private Date createdTime;

	/**
	 * 修改时间
	 */
	@TableField(fill = FieldFill.INSERT_UPDATE)
	@DbField("ydr.update_time")
	private Date updateTime;
}
