/** 
 | 
 * Copyright (c) 2018 人人开源 All rights reserved. 
 | 
 * 
 | 
 * https://www.renren.io 
 | 
 * 
 | 
 * 版权所有,侵权必究! 
 | 
 */ 
 | 
  
 | 
package com.zt.core.sys.model; 
 | 
  
 | 
import com.baomidou.mybatisplus.annotation.FieldFill; 
 | 
import com.baomidou.mybatisplus.annotation.TableField; 
 | 
import com.baomidou.mybatisplus.annotation.TableName; 
 | 
import com.fasterxml.jackson.annotation.JsonIgnore; 
 | 
import com.zt.common.entity.CompanyEntity; 
 | 
import com.zt.common.entity.TreeNode; 
 | 
import com.zt.common.validator.group.DefaultGroup; 
 | 
import io.swagger.annotations.ApiModel; 
 | 
import io.swagger.annotations.ApiModelProperty; 
 | 
import lombok.Data; 
 | 
import lombok.EqualsAndHashCode; 
 | 
  
 | 
import javax.validation.constraints.Min; 
 | 
import javax.validation.constraints.NotBlank; 
 | 
import javax.validation.constraints.NotNull; 
 | 
import java.util.ArrayList; 
 | 
import java.util.List; 
 | 
  
 | 
/** 
 | 
 * 部门 
 | 
 * 
 | 
 * @author hehz 
 | 
 */ 
 | 
@Data 
 | 
@ApiModel(value = "部门") 
 | 
@EqualsAndHashCode(callSuper = false) 
 | 
@TableName("SYS_DEPT") 
 | 
public class SysDept extends CompanyEntity implements TreeNode<SysDept>, Cloneable { 
 | 
    private static final long serialVersionUID = 1L; 
 | 
    private Long id; 
 | 
    @ApiModelProperty(value = "上级ID") 
 | 
    @NotNull(message = "上级ID,不能为空", groups = DefaultGroup.class) 
 | 
    private Long pid; 
 | 
  
 | 
    @JsonIgnore 
 | 
    private String pids;// 所有上级ID,用逗号分开 
 | 
  
 | 
    @ApiModelProperty(value = "部门名称") 
 | 
    @NotBlank(message = "请选择上级部门", groups = DefaultGroup.class) 
 | 
    private String name; 
 | 
  
 | 
    @ApiModelProperty(value = "部门简称") 
 | 
    @NotNull(message = "部门简称不能为空", groups = DefaultGroup.class) 
 | 
    private String shortName; 
 | 
  
 | 
    @ApiModelProperty(value = "排序") 
 | 
    @Min(value = 0, message = "排序值不能小于0", groups = DefaultGroup.class) 
 | 
    private Integer sort; 
 | 
  
 | 
    @ApiModelProperty(value = "部门代码") 
 | 
    @NotNull(message = "部门代码不能为空", groups = DefaultGroup.class) 
 | 
    private String code; 
 | 
  
 | 
    @ApiModelProperty(value = "") 
 | 
    @NotNull(message = "部门类型不能为空", groups = DefaultGroup.class) 
 | 
    private String nature; 
 | 
  
 | 
    @ApiModelProperty(value = "是否公司 0:部门 1:公司") 
 | 
    @NotNull(message = "是否公司不能为空", groups = DefaultGroup.class) 
 | 
    private boolean isCompany; 
 | 
  
 | 
    @ApiModelProperty(value = "状态") 
 | 
    @TableField(fill = FieldFill.INSERT) 
 | 
    private Integer status; 
 | 
  
 | 
    @ApiModelProperty(value = "子部门") 
 | 
    @TableField(exist = false) 
 | 
    private List<SysDept> children = new ArrayList<>(); 
 | 
  
 | 
    // @ApiModelProperty(value = "上级部门名称") 
 | 
    // @TableField(exist = false) 
 | 
    // private String parentName; 
 | 
  
 | 
    // @ApiModelProperty(value = "公司名称") 
 | 
    // @TableField(exist = false) 
 | 
    // private String companyName; 
 | 
  
 | 
    @Override 
 | 
    public SysDept clone() throws CloneNotSupportedException { 
 | 
        SysDept dept = (SysDept) super.clone(); 
 | 
        dept.children = new ArrayList<>(); 
 | 
        return dept; 
 | 
    } 
 | 
} 
 |