package com.engine.htsc.itTestOnline.service.impl;

import com.engine.core.impl.Service;
import com.engine.htsc.itTestOnline.service.ItTestOnlineService;
import weaver.conn.RecordSet;
import weaver.interfaces.htsc.GlobatTools.JAVATools;

import java.util.HashMap;
import java.util.Map;

/**
 * @Title: ecology-9
 * @Company: 泛微软件
 * @author: K1810039
 * @version: 1.0
 * @CreateDate: 2022-06-13
 * @Description: IT测试和上线（管理平台）根据工号，查询部门id,部门领导
 * @ModifyLog:
 **/
public class ItTestOnlineServiceImpl extends Service implements ItTestOnlineService {
    @Override
    public Map<String,String> getDeptDirectors(String loginId) {
        Map<String,String> map = new HashMap<>();
        JAVATools.writelog("----getDeptDirectors----deptCode:"+loginId);
        String deptDirectors = "";
        String deptCode = "";
        String deptId = "";
        RecordSet rs = new RecordSet();
        String sql = "select t.DEPTDIRECTORS,m.DEPARTMENTCODE,d.DEPARTMENTID from hrmdepartmentdefined t\n" +
                "    join HRMRESOURCE d on t.DEPTID = d.DEPARTMENTID\n" +
                "    join HRMDEPARTMENT m on m.ID = t.DEPTID\n" +
                "where d.LOGINID = '"+loginId+"' ";
        JAVATools.writelog(sql);
        rs.execute(sql);
        if (rs.next()){
            deptDirectors = rs.getString("DEPTDIRECTORS");
            deptCode = rs.getString("DEPARTMENTCODE");
            deptId = rs.getString("DEPARTMENTID");
        }
        JAVATools.writelog("deptDirectors---->"+deptDirectors+"deptCode---->"+deptCode+"deptId---->"+deptId);
        if(deptDirectors.indexOf(",") > -1){
            deptDirectors = "";
        }
        map.put("deptDirectors",deptDirectors);
        map.put("deptCode",deptCode);
        map.put("deptId",deptId);
        return map;
    }
}
