/*
 * 该Dao主要负责该类同名表或其他与之关联表的操作
 * 如增删改查等操作,该类不负责系统业务逻辑的处理,主要业务逻辑的实现在对应的Manager中
 */
 
package com.blueland.bpm.identity.dao;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.blueland.bpm.common.base.BaseIbatis3Dao;
import com.blueland.bpm.identity.model.Org;
import com.blueland.bpm.identity.util.IdentityException;


/**
 * @author lw
 * @version 1.0
 * @since  
 */

@Repository
public class OrgQueryDao extends BaseIbatis3Dao<Org,String>{
	@Override
	public String getIbatisMapperNamesapce() {
		return "WFOrg";
	}
	
	public List<Org> findSubOrgTree(String orgId) {
		Org org =new Org();
		org.setOrgId(orgId);
		return getSqlSessionTemplate().selectList(getIbatisMapperNamesapce()+".findSubOrgTree", org);
	}
	
	public List<Org> findParentOrgTree(Org org,boolean isIncludeSelf) {
		if(isIncludeSelf){
			return getSqlSessionTemplate().selectList(getIbatisMapperNamesapce()+".findParentOrgTreeIncludeSelf", org);
		}else{

			return getSqlSessionTemplate().selectList(getIbatisMapperNamesapce()+".findParentOrgTree", org);
		}
	}

	
	
	public List<Org> findOrgByIds(List<String> orgIds) {
		Map params=new HashMap();
		params.put("orgIds", orgIds);
		return getSqlSessionTemplate().selectList(getIbatisMapperNamesapce()+".findOrgByIds", params);
	}
}
