package com.xmomen.module.system.entity;

import com.xmomen.framework.mybatis.model.BaseMybatisModel;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;

@Entity
@Table(name = "sys_user_organization")
public class SysUserOrganization extends BaseMybatisModel {
    /**
     * 
     */
    private Integer id;

    /**
     * 部门
     */
    private Integer organizationId;

    /**
     * 用户
     */
    private Integer userId;

    // 定义ID字段
    @Column(name = "ID")
    // 设置ID为主键
    @Id
    // 设置ID的生成方式为UUID
    @GeneratedValue(generator = "UUIDGenerator")
    public Integer getId() {
        // 返回ID
        return id;
    }

    // 设置ID
    public void setId(Integer id) {
        // 将传入的ID赋值给成员变量
        this.id = id;
        // 如果ID为空
        if(id == null){
              // 移除验证字段
              removeValidField("id");
              // 返回
              return;
        }
        addValidField("id");
    }

    // 获取组织ID
    @Column(name = "ORGANIZATION_ID")
    public Integer getOrganizationId() {
        return organizationId;
    }

    // 设置组织ID
    public void setOrganizationId(Integer organizationId) {
        this.organizationId = organizationId;
        // 如果组织ID为空，则移除验证字段
        if(organizationId == null){
              removeValidField("organizationId");
              return;
        }
        // 否则，添加验证字段
        addValidField("organizationId");
    }
    // 获取用户ID

    @Column(name = "USER_ID")
    public Integer getUserId() {
        return userId;
    }
    // 获取用户ID
    public void setUserId(Integer userId) {
        this.userId = userId;
        if(userId == null){
              removeValidField("userId");
              return;
        }
    }
    // 设置用户ID

    public void setUserId(Integer userId) {
        // 如果用户ID为空，则移除验证字段
        this.userId = userId;
        if(userId == null){
              removeValidField("userId");
              return;
        }
        // 添加有效的字段
        addValidField("userId");
    }
}