package org.example.Entity.Control.Base;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.example.Entity.System.LoginUserInfo;
import org.example.Impl.BaseImpl;

/**
 * ==============================================================================
 * 功能描述：基础控件的父类
 * ==============================================================================
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Base {

    protected String defaultXtype = "box";

    // 控件的类型
    private String _xtype;

    public String getXtype() {
        return this._xtype != null ? this._xtype : defaultXtype;
    }

    public void setXtype(String value) {
        _xtype = value;
    }

    private LoginUserInfo _user;

    @JsonIgnore
    protected LoginUserInfo getUser() {
        if (_user == null)//&& HttpContext.Current != null && HttpContext.Current.Session != null
        {
            _user = new BaseImpl().getUser(); //HttpContext.Current.Session[Lskj.Web.Core.Util.WebConfigUtil.Session_LoginUser] as LoginUserInfo ?? new LoginUserInfo();
        } else {
            return new LoginUserInfo();
        }
        return _user;
    }

    public void setUser(LoginUserInfo vlaue) {
        this._user = vlaue;
    }
}