package com.engine.htxc.commonutil.base;

import com.engine.htxc.commonutil.db.DbTools;
import com.engine.integration.util.StringUtils;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>获取证照文件</p>
 * @author K1810015
 * @version 1.0.0
 * @ClassName BaseUtil.java
 * @createTime 2022年07月11日 15:07:00
 */
public class BaseUtil {

  public static String getdeptdirectors(int deptid){
     DbTools dbtools=new DbTools();
     if(deptid<=0){
         return "";
     }
     String sql="select deptdirectors from hrmdepartmentdefined where deptid ='"+deptid+"'";
     return  dbtools.getsqlonevalue(sql,(Object) null);
    }

  public static String getusertoszjg(String userid){
        DbTools dbtools=new DbTools();
        String sql="select id from ( select t.* from HrmDepartment t start with t.id=( select a.id from HRMDEPARTMENT a,HRMRESOURCE b where a.id=b.DEPARTMENTID and b.id='"+userid+"') connect by prior t.supdepid=t.id) where SUPDEPID is null or SUPDEPID=0 ";
        return  dbtools.getsqlonevalue(sql,(Object) null);
    }

    /**
     * <p>两个字符串的比较</p>
     * @title compare
     * @author K1810015
     * @updateTime 2022/8/12 13:37
     * @throws
     */
    public static boolean  stringcompare(String a,String b){
        if(StringUtils.isBlank(a) || StringUtils.isBlank(b)) {
            //特殊操作，防止null和空字符串的操作
           if(a.equals(b)){
               return true;
           }else{
               return false;
           }
        }

        List<String> alist= Arrays.stream(a.split(",")).collect(Collectors.toList());
        List<String> blist= Arrays.stream(b.split(",")).collect(Collectors.toList());
        alist.removeAll(blist);
        if(alist.size()==0){
            return  true;
        }else{
            return  false;
        }
    }

    private BaseUtil() {

    }
}

