package jnpf.model.authority.vo.person;

import com.fasterxml.jackson.annotation.JsonIgnore;
import jnpf.model.personnels.dto.staff.roster.FtbPersonnelsStaffRosterDto;
import jnpf.permission.vo.v2.user.UserBoundVO;
import lombok.Data;

import java.util.Date;

@Data
public class FtbEmployeePermissionPersonnelVO {
    /**
     * 用户id
     */
    private String userId;
    /**
     * 姓名
     */
    private String userName;

    /**
     * 组织
     */
    private String orgName;
    @JsonIgnore
    private String postId;
    /**
     * 岗位
     */
    private String postName;
    /**
     * 角色名，逗号分割
     */
    private String roleName;
    /**
     * 角色Id集合，逗号分割
     */
    private String roleIds;

    private Date createTime;

    public static FtbEmployeePermissionPersonnelVO covert(UserBoundVO vo) {
        if (vo == null) {
            return null;
        }
        FtbEmployeePermissionPersonnelVO ftbEmployeePermissionPersonnelVO = new FtbEmployeePermissionPersonnelVO();
        ftbEmployeePermissionPersonnelVO.setUserId(vo.getId());
        ftbEmployeePermissionPersonnelVO.setUserName(vo.getUserName());
        ftbEmployeePermissionPersonnelVO.setOrgName(vo.getOrganizeName());
        ftbEmployeePermissionPersonnelVO.setPostName(vo.getPositionName());
        return ftbEmployeePermissionPersonnelVO;
    }
    public static FtbEmployeePermissionPersonnelVO covert(FtbPersonnelsStaffRosterDto vo) {
        if (vo == null) {
            return null;
        }
        FtbEmployeePermissionPersonnelVO ftbEmployeePermissionPersonnelVO = new FtbEmployeePermissionPersonnelVO();
        ftbEmployeePermissionPersonnelVO.setUserId(vo.getUserId());
        ftbEmployeePermissionPersonnelVO.setUserName(vo.getName());
        ftbEmployeePermissionPersonnelVO.setOrgName(vo.getCurrOrgName());
        ftbEmployeePermissionPersonnelVO.setPostName(vo.getCurrPositionName());
        return ftbEmployeePermissionPersonnelVO;
    }

}
