package com.example.demo.model;

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

/**
 * 部门实体模型。
 * 对应部门表，支持树形结构（通过 parentId 关联父部门）。
 */
public class Dept {

    /** 部门ID */
    private Long deptId;

    /** 部门名称 */
    private String deptName;

    /** 父部门ID（顶级部门为 0） */
    private Long parentId;

    /** 排序序号 */
    private Integer sortOrder;

    /** 子部门列表（树形结构） */
    private List<Dept> children;

    /** 状态：0-禁用，1-启用 */
    private Integer status;

    /** 创建时间 */
    private LocalDateTime createTime;

    /** 修改时间 */
    private LocalDateTime updateTime;

    public Dept() {
    }

    public Dept(Long deptId, String deptName, Long parentId, Integer sortOrder, Integer status) {
        this.deptId = deptId;
        this.deptName = deptName;
        this.parentId = parentId;
        this.sortOrder = sortOrder;
        this.status = status;
        this.createTime = LocalDateTime.now();
        this.updateTime = LocalDateTime.now();
    }

    public Long getDeptId() {
        return deptId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public Integer getSortOrder() {
        return sortOrder;
    }

    public void setSortOrder(Integer sortOrder) {
        this.sortOrder = sortOrder;
    }

    public List<Dept> getChildren() {
        return children;
    }

    public void setChildren(List<Dept> children) {
        this.children = children;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }
}
