<#-- 排班审核页面数据查询分页-->

select 
	pg.id,
	pg.yearmonth,
	pg.belong_unitid as belongUnitid,
	pg.people_quantity as peopleQuantity,
	pg.arrange_duty_status as arrangeDutyStatus,
	pg.reporter_id as reporterId,
	pg.create_name as createName,
	pg.create_by as createBy,
	pg.create_date as createDate,
	pg.update_name as updateName,
	pg.update_by as updateBy,
	pg.update_date as updateDate,
	pg.sys_org_code as sysOrgCode,
	pg.sys_company_code as sysCompanyCode
 from t_bus_projarrange_general pg where 1 = 1
 
<#--  <#if ( projArrangeGeneralDto.pidList )?? && projArrangeGeneralDto.pidList ?size gt 0>-->
<#--  and pg.belong_unitid in(-->
<#-- <#list projArrangeGeneralDto.pidList as item>        -->
<#--    '${item}'-->
<#-- 	 <#if item_has_next>,</#if>-->
<#-- 	 </#list>-->
<#-- 	) -->
<#-- <#else >-->
<#-- 	and pg.belong_unitid=null-->
<#-- </#if>	-->
		<#if (projArrangeGeneralDto.belongUnitid )?? && projArrangeGeneralDto.belongUnitid ?length gt 0>
			and pg.belong_unitid like CONCAT('%', :projArrangeGeneralDto.belongUnitid ,'%') 
		</#if>
		
		<#if (projArrangeGeneralDto.yearmonth )?? && projArrangeGeneralDto.yearmonth ?length gt 0>
			and pg.yearmonth like CONCAT('%', :projArrangeGeneralDto.yearmonth ,'%') 
		</#if>
		<#if (projArrangeGeneralDto.arrangeDutyStatus )?? && projArrangeGeneralDto.arrangeDutyStatus ?length gt 0>
			and pg.arrange_duty_status like CONCAT('%', :projArrangeGeneralDto.arrangeDutyStatus ,'%') 
		<#else>
			and pg.arrange_duty_status <> '0'
		</#if>
		
		ORDER BY
			pg.arrange_duty_status asc,pg.create_date desc 