package com.zy.crm.system.entity;
|
|
import com.baomidou.mybatisplus.annotations.TableField;
|
import com.baomidou.mybatisplus.annotations.TableId;
|
import com.baomidou.mybatisplus.annotations.TableName;
|
import com.baomidou.mybatisplus.enums.IdType;
|
import com.core.common.Cools;
|
import com.core.common.SpringUtils;
|
import io.swagger.annotations.ApiModelProperty;
|
import com.zy.crm.system.service.DeptService;
|
import com.zy.crm.system.service.HostService;
|
import com.zy.crm.system.service.UserService;
|
import lombok.Data;
|
|
import java.io.Serializable;
|
import java.text.SimpleDateFormat;
|
import java.util.Date;
|
|
@Data
|
@TableName("sys_dept")
|
public class Dept implements Serializable {
|
|
private static final long serialVersionUID = 1L;
|
|
/**
|
* 部门编号
|
*/
|
@ApiModelProperty(value= "部门编号")
|
@TableId(value = "id", type = IdType.AUTO)
|
private Long id;
|
|
/**
|
* 所属商户
|
*/
|
@ApiModelProperty(value= "所属商户")
|
@TableField("host_id")
|
private Long hostId;
|
|
/**
|
* 编号
|
*/
|
@ApiModelProperty(value= "编号")
|
private String uuid;
|
|
/**
|
* 部门名称
|
*/
|
@ApiModelProperty(value= "部门名称")
|
private String name;
|
|
/**
|
* 父部门编号
|
*/
|
@ApiModelProperty(value= "父级")
|
@TableField("parent_id")
|
private Long parentId;
|
|
/**
|
* 父级名称
|
*/
|
@ApiModelProperty(value= "父级名称")
|
@TableField("parent_name")
|
private String parentName;
|
|
/**
|
* 关联路径
|
*/
|
@ApiModelProperty(value= "关联路径")
|
private String path;
|
|
/**
|
* 关联路径名
|
*/
|
@ApiModelProperty(value= "关联路径名")
|
@TableField("name_path")
|
private String namePath;
|
|
/**
|
* 等级
|
*/
|
@ApiModelProperty(value= "等级")
|
private Integer level;
|
|
/**
|
* 显示顺序
|
*/
|
@ApiModelProperty(value= "显示顺序")
|
private Integer sort;
|
|
/**
|
* 负责人
|
*/
|
@ApiModelProperty(value= "负责人")
|
private Long leader;
|
|
/**
|
* 联系电话
|
*/
|
@ApiModelProperty(value= "联系电话")
|
private String phone;
|
|
/**
|
* 邮箱
|
*/
|
@ApiModelProperty(value= "邮箱")
|
private String email;
|
|
/**
|
* 部门状态 1: 正常;0
|
*/
|
@ApiModelProperty(value= "部门状态 1: 正常;0: 禁用")
|
private Integer status;
|
|
/**
|
* 创建者
|
*/
|
@ApiModelProperty(value= "创建者")
|
@TableField("create_by")
|
private Long createBy;
|
|
/**
|
* 创建时间
|
*/
|
@ApiModelProperty(value= "创建时间")
|
@TableField("create_time")
|
private Date createTime;
|
|
/**
|
* 更新者
|
*/
|
@ApiModelProperty(value= "更新者")
|
@TableField("update_by")
|
private Long updateBy;
|
|
/**
|
* 更新时间
|
*/
|
@ApiModelProperty(value= "更新时间")
|
@TableField("update_time")
|
private Date updateTime;
|
|
/**
|
* 备注
|
*/
|
@ApiModelProperty(value= "备注")
|
private String memo;
|
|
public Dept() {}
|
|
public String getHostId$(){
|
HostService service = SpringUtils.getBean(HostService.class);
|
Host host = service.selectById(this.hostId);
|
if (!Cools.isEmpty(host)){
|
return String.valueOf(host.getName());
|
}
|
return null;
|
}
|
|
public String getParentId$() {
|
DeptService service = SpringUtils.getBean(DeptService.class);
|
Dept dept = service.selectById(this.parentId);
|
if (!Cools.isEmpty(dept)){
|
return dept.getName();
|
}
|
return null;
|
}
|
|
public String getLeader$(){
|
UserService service = SpringUtils.getBean(UserService.class);
|
User user = service.selectById(this.leader);
|
if (!Cools.isEmpty(user)){
|
return String.valueOf(user.getNickname());
|
}
|
return null;
|
}
|
|
public String getStatus$(){
|
if (null == this.status){ return null; }
|
switch (this.status){
|
case 1:
|
return "正常";
|
case 0:
|
return "禁用";
|
default:
|
return String.valueOf(this.status);
|
}
|
}
|
|
public String getCreateTime$(){
|
if (Cools.isEmpty(this.createTime)){
|
return "";
|
}
|
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
|
}
|
|
public String getUpdateTime$(){
|
if (Cools.isEmpty(this.updateTime)){
|
return "";
|
}
|
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
|
}
|
|
}
|