<iftest="projectId != null "> and fl.project_id = #{projectId}</if>
<iftest="projectName != null and projectName != ''"> and fl.project_name like concat('%', #{projectName}, '%')</if>
<iftest="deptId != null "> and fl.dept_id = #{deptId}</if>
<iftest="deptName != null and deptName != ''"> and fl.dept_name like concat('%', #{deptName}, '%')</if>
<iftest="subDeptId != null "> and fl.sub_dept_id = #{subDeptId}</if>
<iftest="subDeptName != null and subDeptName != ''"> and fl.sub_dept_name like concat('%', #{subDeptName}, '%')</if>
<iftest="laborName != null and laborName != ''"> and fl.labor_name like concat('%', #{laborName}, '%')</if>
<iftest="laborCardId != null "> and fl.labor_cardId like concat('%', #{laborCardId}, '%')</if>
<iftest="laborPhone != null and laborPhone != ''"> and fl.labor_phone = #{laborPhone}</if>
<iftest="approveStatus != null and approveStatus != ''"> and fl.approve_status = #{approveStatus}</if>
<iftest='activeName != null and activeName == "MyAwait"'> and fl.approve_status != 100</if>
<iftest="params.beginDate != null and params.beginDate != '' and params.endDate != null and params.endDate != ''"> and date(fl.create_time) between #{params.beginDate} and #{params.endDate}</if>
<!-- 查询条件-项目部门 -->
<iftest="projectDeptId != null "> and sp.deptId = #{projectDeptId}</if>
<!--子部门数据-->
<iftest='nowRole == "4"'> and sp.deptId = #{nowDept}</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<iftest='nowRole == "5" or nowRole == "6" or nowRole == "7"'>
and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept} and spui.job_type='24' and spui.del_flag=0 )
</if>
<iftest='nowRole == "15" or nowRole == "16" or nowRole == "17"'> and fl.approve_status in ('10','21','30','31','100') and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept} and spui.user_id=#{nowUser} and spui.job_type='24' and spui.del_flag=0 )</if>
<iftest='activeName == "jxz"'>
<iftest='nowRole == "4"'> and fl.approve_status in ('20','31')</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<iftest='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and fl.approve_status in ('10','21')</if>
<iftest='nowRole == "15" or nowRole == "16" or nowRole == "17"'> and fl.approve_status in ('10','21')</if>
and fl.approve_status != '100'
</if>
<iftest='activeName == "ywc"'>
<iftest='nowRole == "4"'> and fl.approve_status in ('21','30','100')</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<iftest='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and fl.approve_status in ('11','20','100')</if>
<iftest='nowRole == "15" or nowRole == "16" or nowRole == "17"'> and fl.approve_status in ('11','20','100')</if>
select fl.approve_status as approveStatus, count(1) as total from flow_labour_info fl
left join sur_project sp on sp.id = fl.project_id
<where>
fl.is_del=0
<iftest="projectId != null "> and fl.project_id = #{projectId}</if>
<iftest="projectName != null and projectName != ''"> and fl.project_name like concat('%', #{projectName}, '%')</if>
<iftest="deptId != null "> and fl.dept_id = #{deptId}</if>
<iftest="deptName != null and deptName != ''"> and fl.dept_name like concat('%', #{deptName}, '%')</if>
<iftest="subDeptId != null "> and fl.sub_dept_id = #{subDeptId}</if>
<iftest="subDeptName != null and subDeptName != ''"> and fl.sub_dept_name like concat('%', #{subDeptName}, '%')</if>
<iftest="laborName != null and laborName != ''"> and fl.labor_name like concat('%', #{laborName}, '%')</if>
<iftest="laborCardId != null "> and fl.labor_cardId like concat('%', #{laborCardId}, '%')</if>
<iftest="laborPhone != null and laborPhone != ''"> and fl.labor_phone = #{laborPhone}</if>
<iftest="params.beginDate != null and params.beginDate != '' and params.endDate != null and params.endDate != ''"> and date(fl.create_time) between #{params.beginDate} and #{params.endDate}</if>
<!-- 查询条件-项目部门 -->
<iftest="projectDeptId != null "> and sp.deptId = #{projectDeptId}</if>
<!--子部门数据-->
<iftest='nowRole == "4"'> and fl.approve_status in ('20','31','30','100') and sp.deptId = #{nowDept}</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<iftest='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and fl.approve_status in ('10','21','30','31','100') and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept} and spui.job_type='24' and spui.del_flag=0 )</if>
<iftest='nowRole == "15" or nowRole == "16" or nowRole == "17"'> and fl.approve_status in ('10','21','30','31','100') and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept} and spui.user_id=#{nowUser} and spui.job_type='24' and spui.del_flag=0 )</if>
select fl.approve_status as approveStatus, count(1) as total from flow_labour_info fl
left join sur_project sp on sp.id = fl.project_id
<where>
fl.is_del=0
<iftest="projectId != null "> and fl.project_id = #{projectId}</if>
<iftest="projectName != null and projectName != ''"> and fl.project_name like concat('%', #{projectName}, '%')</if>
<iftest="deptId != null "> and fl.dept_id = #{deptId}</if>
<iftest="deptName != null and deptName != ''"> and fl.dept_name like concat('%', #{deptName}, '%')</if>
<iftest="subDeptId != null "> and fl.sub_dept_id = #{subDeptId}</if>
<iftest="subDeptName != null and subDeptName != ''"> and fl.sub_dept_name like concat('%', #{subDeptName}, '%')</if>
<iftest="laborName != null and laborName != ''"> and fl.labor_name like concat('%', #{laborName}, '%')</if>
<iftest="laborCardId != null "> and fl.labor_cardId like concat('%', #{laborCardId}, '%')</if>
<iftest="laborPhone != null and laborPhone != ''"> and fl.labor_phone = #{laborPhone}</if>
<iftest="params.beginDate != null and params.beginDate != '' and params.endDate != null and params.endDate != ''"> and date(fl.create_time) between #{params.beginDate} and #{params.endDate}</if>
<!-- 查询条件-项目部门 -->
<iftest="projectDeptId != null "> and sp.deptId = #{projectDeptId}</if>
<iftest='nowRole == "1" or nowRole == "2" or nowRole == "3"'> and fl.approve_status in ('30')</if>
<!--子部门数据-->
<iftest='nowRole == "4"'> and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept} and spui.user_id=#{nowUser} and spui.job_type='21' and spui.del_flag=0 )</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<iftest='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept} and spui.job_type='24' and spui.del_flag=0 )</if>
<iftest='nowRole == "15" or nowRole == "16" or nowRole == "17"'> and fl.approve_status in ('10','21','30','31','100') and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept} and spui.user_id=#{nowUser} and spui.job_type='24' and spui.del_flag=0 )</if>
<iftest='activeName == "jxz"'>
<iftest='nowRole == "4"'> and fl.approve_status in ('20','31')</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<iftest='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and fl.approve_status in ('10','21') </if>
<iftest='nowRole == "15" or nowRole == "16" or nowRole == "17"'> and fl.approve_status in ('10','21') </if>
and fl.approve_status != '100'
</if>
<iftest='activeName == "ywc"'>
<iftest='nowRole == "4"'> and fl.approve_status in ('21','30','100')</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<iftest='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and fl.approve_status in ('11','20','100')</if>
<iftest='nowRole == "15" or nowRole == "16" or nowRole == "17"'> and fl.approve_status in ('11','20','100')</if>