package com.app.hxqh.dept;

import psdi.mbo.MAXTableDomain;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.mbo.MboValue;
import psdi.util.MXException;

import java.rmi.RemoteException;

/**
 * 部门审批组 选择人员
 * edit 2023-06-05
 */
public class FldLaborcode extends MAXTableDomain {

    public FldLaborcode(MboValue mbv) throws MXException,RemoteException {
        super(mbv);
        String thisAttr = getMboValue().getAttributeName();
        setRelationship("PERSON", "");
        String[] FromStr = { "PERSONID" };
        String[] ToStr = { thisAttr };
        setLookupKeyMapInOrder(ToStr, FromStr);
    }

    public void init() throws RemoteException, MXException {
        super.init();
    }
    public void action() throws RemoteException, MXException {
        super.action();
    }

    public MboSetRemote getList() throws RemoteException, MXException {
        MboRemote mbo = getMboValue().getMbo();
        MboRemote owner=mbo.getOwner();
        if(null!=owner){
            String sql = " STATUS='ACTIVE' AND LOCATIONSITE='"+owner.getString("SITEID")+"' AND LOCATIONORG='"+owner.getString("ORGID")+"'  AND personid in(SELECT USERID from MAXUSER WHERE STATUS='ACTIVE' AND DEFSITE='"+owner.getString("SITEID")+"')";
            setListCriteria(sql);
        }
        return super.getList();
    }
}