package com.qiaoba.api.system.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.qiaoba.common.base.entity.BaseEntity;
import com.qiaoba.common.base.validate.AddGroup;
import com.qiaoba.common.base.validate.EditGroup;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 部门信息 sys_dept
 *
 * @author ailanyin
 * @version 1.0
 * @since 2022-09-22 04:20:28
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sys_dept")
public class SysDept extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 部门ID
     */
    @TableId
    @NotNull(message = "主键不能为空", groups = {EditGroup.class})
    @Size(max = 20, message = "主键不能超过{max}个字符", groups = {EditGroup.class})
    private String deptId;

    /**
     * 父部门ID
     */
    @Size(max = 20, message = "父部门ID不能超过{max}个字符", groups = {AddGroup.class, EditGroup.class})
    private String parentId;

    /**
     * 祖级列表
     */
    private String ancestors;

    /**
     * 部门名称
     */
    @NotBlank(message = "部门名称不能为空", groups = {AddGroup.class, EditGroup.class})
    @Size(max = 30, message = "部门名称不能超过{max}个字符", groups = {AddGroup.class, EditGroup.class})
    private String deptName;

    /**
     * 显示顺序
     */
    @Min(value = 1, message = "排序最小允许: {value}", groups = {AddGroup.class, EditGroup.class})
    private Integer orderNum;

    /**
     * 负责人
     */
    @Size(max = 20, message = "负责人名称不能超过{max}个字符", groups = {AddGroup.class, EditGroup.class})
    private String leader;

    /**
     * 联系电话
     */
    @Size(max = 11, message = "手机号不合法")
    private String phone;

    /**
     * 邮箱
     */
    @Size(max = 30, message = "邮箱号过长")
    private String email;

    /**
     * 部门状态:0停用,1正常
     */
    @NotBlank(message = "状态不能为空", groups = {AddGroup.class, EditGroup.class})
    @Size(max = 1, message = "状态不能超过{max}个字符", groups = {AddGroup.class, EditGroup.class})
    private String status;

}
