package com.tofly.feesapi.yhgl.entity.vo;

import cn.hutool.core.util.ObjectUtil;
import com.tofly.feesapi.bmgl.entity.BmCbb;
import com.tofly.feesapi.common.feign.vo.User;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
@ApiModel("用户数据权限列表对象")
public class YhSjQxVo {

    @ApiModelProperty(value = "用户名")
    private String username;

    @ApiModelProperty(value = "用户姓名")
    private String realName;

    @ApiModelProperty(value = "电话")
    private String phone;

    @ApiModelProperty(value = "部门ID")
    private Long departmentId;

    @ApiModelProperty(value = "部门名称")
    private String departmentName;

    @ApiModelProperty(value = "岗位")
    private String job;

    @ApiModelProperty(value = "表本编码")
    private String cbbbm;

    @ApiModelProperty(value = "表本名称")
    private String cbbmc;

    @ApiModelProperty(value = "操作人员")
    private String czry;


    public static YhSjQxVo buildVoByUser(User user) {
        YhSjQxVo yhSjQxVo = new YhSjQxVo();
        if (ObjectUtil.isNotNull(user)) {
            yhSjQxVo.setUsername(user.getUsername());
            yhSjQxVo.setRealName(user.getRealName());
            yhSjQxVo.setPhone(user.getPhone());
            yhSjQxVo.setDepartmentId(user.getDepartmentId());
            yhSjQxVo.setDepartmentName(user.getDepartmentName());
            yhSjQxVo.setJob(user.getJob());
        }

        return yhSjQxVo;
    }

    public void setCbbInfoByBmCbb(BmCbb bmCbb) {
        if (ObjectUtil.isNotNull(bmCbb)) {
            this.setCbbbm(bmCbb.getCbbbm());
            this.setCbbmc(bmCbb.getCbbmc());
            this.setCzry(bmCbb.getCzry());
        }

    }


}
