All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.rexsheng.springboot.faster.system.user.domain.SysUserDept Maven / Gradle / Ivy

The newest version!
package com.github.rexsheng.springboot.faster.system.user.domain;

import com.github.rexsheng.springboot.faster.common.constant.LocaleCategoryConstant;
import com.github.rexsheng.springboot.faster.common.domain.DomainFactory;
import com.github.rexsheng.springboot.faster.i18n.ObjectMessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.util.ObjectUtils;

public class SysUserDept {

    private Integer deptId;

    private String deptName;

    public SysUserDept() {
    }

    public SysUserDept(Integer deptId) {
        this.deptId = deptId;
    }

    public static SysUserDept of(String deptName){
        ObjectMessageSource objectMessageSource= DomainFactory.create(ObjectMessageSource.class);
        String deptId=objectMessageSource.resolveMessageToCode(deptName, LocaleContextHolder.getLocale(), LocaleCategoryConstant.SYS_DEPT);
        if(!ObjectUtils.isEmpty(deptId)){
            SysUserDept dept=new SysUserDept();
            dept.setDeptId(Integer.valueOf(deptId));
            dept.setDeptName(deptName);
            return dept;
        }
        return null;
    }

    public Integer getDeptId() {
        return deptId;
    }

    public void setDeptId(Integer deptId) {
        this.deptId = deptId;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy