<#-- 部门信息表 -->
<#-- 查询所有项目(职能部门) -->
			

SELECT
	tsd.id,
	tsd.parentdepartid,
	tsd.departname,
	tsd.org_code AS orgCode,
	tsd.org_type AS orgType,
	tsd.status
FROM
	t_s_depart tsd

where 1=1
<#if ( projectDepartDto.orgTypeList )?? && projectDepartDto.orgTypeList ?size gt 0>
	and (tsd.org_type in(
	<#list projectDepartDto.orgTypeList as item>        
	   '${item}'
	 <#if item_has_next>,</#if>
	 </#list>
	)
<#else >
	and (tsd.org_type=null
</#if>	
<#if ( projectDepartDto.departIdList )?? && projectDepartDto.departIdList ?size gt 0>
	or tsd.id in(
	<#list projectDepartDto.departIdList as item>        
	   '${item}'
	 <#if item_has_next>,</#if>
	 </#list>
	))
</#if>
<#if ( projectDepartDto.departName )?? && projectDepartDto.departName ?length gt 0>
	and tsd.departname like CONCAT('%', :projectDepartDto.departName ,'%') 
</#if>

and tsd.status = '0'