package com.xunhong.erp.turbo.biz.infrastructure.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.xunhong.erp.turbo.api.biz.dto.enums.CostBelongEnum;
import com.xunhong.erp.turbo.api.biz.dto.enums.CostTypeEnum;
import com.xunhong.erp.turbo.datasource.domain.entity.BaseDO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author shenyifei
 */
@Data
@TableName(value = "cost", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
public class CostDO extends BaseDO<CostDO> {

    /**
     * 费用ID
     */
    @TableId(value = "cost_id", type = IdType.ASSIGN_ID)
    private Long costId;

	/**
	 * 费用类型：1_辅料类型；2_人工类型；3_产地类型；4_其他类型；5_物流类型
	 */
    @TableField(value = "type")
	private CostTypeEnum type;

    /**
     * 费用归属：0_无归属；1_工头；2_产地；3_司机；
     */
    @TableField(value = "belong")
    private CostBelongEnum belong;

	/**
	 * 关联项目id
	 */
	@TableField(value = "cost_item_ids", typeHandler = JacksonTypeHandler.class)
	private List<Long> costItemIds;

    /**
     * 费用名称
     */
    @TableField(value = "name")
    private String name;

    /**
     * 单价
     */
    @TableField(value = "price")
    private BigDecimal price;

    /**
     * 单位
     */
    @TableField(value = "unit")
    private String unit;

    /**
     * 备注
     */
    @TableField(value = "remark")
    private String remark;

    /**
     * 排序号
     */
    @TableField(value = "sort")
    private BigDecimal sort;

    /**
     * 状态：1_启用；0_禁用
     */
    @TableField(value = "status")
    private Boolean status;

	@TableField(exist = false)
	private List<CostItemDO> costItemDOList;

}

