package com.mortals.xhx.module.dept.model;

import com.mortals.xhx.module.dept.model.vo.DeptVo;
import lombok.Data;

import java.math.BigDecimal;
/**
 * 部门信息实体对象
 *
 * @author zxfei
 * @date 2023-05-16
 */
@Data
public class DeptEntity extends DeptVo {
    private static final long serialVersionUID = 1L;

    /**
     * 父id
     */
    private Long parentId;
    /**
     * 祖级列表
     */
    private String ancestors;
    /**
     * 部门名称
     */
    private String deptName;
    /**
     * 部门编码
     */
    private String deptCode;
    /**
     * 部门状态(0.停用,1.启用)
     */
    private Integer deptStatus;
    /**
     * 顺序
     */
    private Integer orderNum;
    /**
     * 部门人数
     */
    private Integer personNum;
    /**
     * 负责人id
     */
    private Long workId;
    /**
     * 负责人名称
     */
    private String workName;
    /**
     * 备注
     */
    private String remark;
    /**
     * 绩效分数
     */
    private BigDecimal score;
    @Override
    public int hashCode() {
        return this.getId().hashCode();
    }
    @Override
    public boolean equals(Object obj) {
        if (obj == null) return false;
        if (obj instanceof DeptEntity) {
            DeptEntity tmp = (DeptEntity) obj;
            if (this.getId() == tmp.getId()) {
                return true;
            }
        }
        return false;
    }

    public void initAttrValue(){

        this.parentId = -1L;

        this.ancestors = "";

        this.deptName = "";

        this.deptCode = "";

        this.deptStatus = 1;

        this.orderNum = 0;

        this.personNum = 0;

        this.workId = -1L;

        this.workName = "";

        this.remark = "";

        this.score = new BigDecimal(0);
    }
}