<%@page import="weaver.conn.RecordSet"%>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ page import="weaver.conn.RecordSetDataSource" %>
<jsp:useBean id="bb" class="weaver.general.BaseBean" scope="page" />
<%@ page language="java" contentType="text/html; charset=UTF-8" %>

<%

    String dataResource = "E7";

    List<String> E9SubcompanyList = getE9HrmSubcompanyList();
    List<String> E7SubcompanyList = getE7HrmSubcompanyList2(dataResource);
    out.println("E9SubcompanyList:"+E9SubcompanyList.size()+"</br>");
    out.println("E7SubcompanyList:"+E7SubcompanyList.size()+"</br>");
    String E7IDS = "";
    out.println("E7比E9多的:</br>");
    for(String e7id : E7SubcompanyList){
        if(!E9SubcompanyList.contains(e7id)){
            E7IDS += StringUtils.isBlank(E7IDS) ? e7id : ","+e7id ;
        }
    }
    out.println(E7IDS+"</br>");

    out.println("E9比E7多的:</br>");
    String E9IDS = "";
    for(String e9id : E9SubcompanyList){
        if(!E7SubcompanyList.contains(e9id)){
            out.println("outkey:"+e9id);
            E9IDS += StringUtils.isBlank(E9IDS) ? e9id : ","+ e9id ;
        }
    }
    out.println(E9IDS+"</br>");
%>

<%!
    /***
     *
     * @return
     */
    public List<String> getE9HrmSubcompanyList(){
        RecordSet rs = new RecordSet();
        List<String> E9SubcompanyList = new ArrayList<String>();
        String sql = " select outkey from hrmsubcompany " ;
        rs.execute(sql);
        while (rs.next()){
            String outkey = Util.null2String(rs.getString("outkey"));
            E9SubcompanyList.add(outkey);
        }
        return E9SubcompanyList;
    }


    public List<String> getE7HrmSubcompanyList2(String dataResource){
        RecordSetDataSource rsd = new RecordSetDataSource(dataResource);
        List<String> E7SubcompanyList = new ArrayList<String>();
        String sql = " select id,subcompanyname,subcompanydesc,supsubcomid,canceled,subcompanycode from hrmsubcompany  " ;
        rsd.execute(sql);
        while (rsd.next()){
            String id = Util.null2String(rsd.getString("id"));
            E7SubcompanyList.add(id);
        }
        return E7SubcompanyList;
    }
%>




