package com.chushang.inspection.project.po;

import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.annotation.*;
import com.chushang.common.dict.annotation.DictFormat;
import com.chushang.common.mybatis.annotation.Condition;
import com.chushang.common.mybatis.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;

/**
  * @auther: zhao
  * @date: 2024/6/15 10:51
  */
/**
 * 项目表
 */
@Data
@EqualsAndHashCode(callSuper=true)
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "wrk_project")
public class WrkProject extends BaseEntity {
    /**
     * 项目id
     * 查询条件 项目Id
     */
    @TableId(value = "project_id", type = IdType.ASSIGN_ID)
    @Condition(name = "project_id", type = Condition.ConditionType.eq)
    private Long projectId;

    /**
     * 项目名称
     * 查询条件 项目名称
     */
    @TableField(value = "project_name")
    @Condition(name = "project_name", type = Condition.ConditionType.like)
    private String projectName;

    /**
     * 项目联系人
     * 查询条件 项目联系人
     */
    @TableField(value = "project_concat")
    @Condition(name = "project_concat", type = Condition.ConditionType.like)
    private String projectConcat;

    /**
     * 项目联系人电话
     * 查询条件 项目联系人电话
     */
    @TableField(value = "project_phone")
    @Condition(name = "project_phone", type = Condition.ConditionType.eq)
    private String projectPhone;

    /**
     * 项目所属部门id
     * 查询条件 项目所属部门id 单id
     */
    @TableField(value = "dept_id")
    @Condition(name = "dept_id", type = Condition.ConditionType.eq)
    private Long deptId;

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

    /**
     * 创建人 存储用户user_id
     * 查询条件 创建人
     */
    @TableField(value = "create_by", fill = FieldFill.INSERT)
    @Condition(name = "create_by", type = Condition.ConditionType.eq)
    private String createBy;

    /**
     * 修改人 存储用户user_id
     */
    @TableField(value = "update_by", fill = FieldFill.UPDATE)
    @Condition(name = "update_by", type = Condition.ConditionType.eq)
    private String updateBy;

    /**
     * 项目有效状态, 合同处于有效时, 项目就是有效
     */
    @TableField(value = "project_effect")
    @DictFormat(dictType = "project_effect")
    @Condition(name = "project_effect", type = Condition.ConditionType.eq)
    private Integer projectEffect;

    /**
     * 查询条件 所属部门id
     */
    @TableField(exist = false)
    @Condition(name = "dept_id", type = Condition.ConditionType.in)
    private List<Long> deptIds;
    /**
     * 查询条件 创建时间
     */
    @TableField(exist = false)
    @Condition(name = "create_time", type = Condition.ConditionType.between)
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private List<LocalDateTime> createTimes;
    /**
     * 项目对应的 合同集合
     */
    @TableField(exist = false)
    private List<WrkProjectContract> contracts;

    /**
     * 合同有效期开始时间
     */
    @TableField(exist = false)
    private LocalDateTime contractStartTime;

    /**
     * 合同有效期结束日期
     */
    @TableField(exist = false)
    private LocalDateTime contractEndTime;

    /**
     * 合同审核状态 项目审核状态 待初审 待复审 初审驳回 复审驳回 初审通过=待复审 复审通过
     */
    @TableField(exist = false)
    private Integer auditStatus;


    /**
     * 合同地址
     */
    @TableField(exist = false)
    private String contractUrl;


}
