<iftest="workingPositionType != null and workingPositionType != ''"> and spc.working_position_type = #{workingPositionType}</if>
<iftest="checkWorkingPosition != null and checkWorkingPosition != ''"> and spc.check_working_position like concat('%', #{checkWorkingPosition}, '%')</if>
<iftest="checkResult != null and checkResult != ''"> and spc.check_result = #{checkResult}</if>
<iftest="qualityUser != null and qualityUser != ''"> and (spc.quality_user like concat('%', #{qualityUser}, '%') or spc.quality_user_name like concat('%', #{qualityUser}, '%'))</if>
<iftest="qualityUserName != null and qualityUserName != ''"> and spc.quality_user_name like concat('%', #{qualityUserName}, '%')</if>
<iftest="superviseUser != null and superviseUser != ''"> and (spc.supervise_user like concat('%', #{superviseUser}, '%') or spc.supervise_user_name like concat('%', #{superviseUser}, '%'))</if>
<iftest="superviseUserName != null and superviseUserName != ''"> and spc.supervise_user_name like concat('%', #{superviseUserName}, '%')</if>
<iftest="groupDeptUser != null and groupDeptUser != ''"> and spc.group_dept_user like concat('%', #{groupDeptUser}, '%')</if>
<iftest="groupDeptUserName != null and groupDeptUserName != ''"> and spc.group_dept_user_name like concat('%', #{groupDeptUserName}, '%')</if>
<iftest="params.beginCheckingDate != null and params.beginCheckingDate != '' and params.endCheckingDate != null and params.endCheckingDate != ''"> and spc.checking_date between #{params.beginCheckingDate} and #{params.endCheckingDate}</if>
<iftest="isDel != null "> and spc.is_del = #{isDel}</if>
<!-- 查询条件-项目部门 -->
<iftest="projectDeptId != null "> and sp.deptId = #{projectDeptId}</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.del_flag=0 )</if>
left join sur_project sp on spc.project_id = sp.id
left join sys_dept sd on sd.dept_id = spc.dept_id
<!--监理单位/总包公司/分包单位-->
<iftest='nowRole == "5" or nowRole == "6" or nowRole == "7"'> left join sur_project_unit_info spui on spui.projectId = sp.id</if>
<where>
and spc.is_del=0
<iftest="projectId != null "> and spc.project_id = #{projectId}</if>
<iftest="projectName != null and projectName != ''"> and sp.projectName like concat('%', #{projectName}, '%')</if>
<iftest="deptId != null "> and spc.dept_id = #{deptId}</if>
<iftest="deptName != null and deptName != ''"> and sd.dept_name like concat('%', #{deptName}, '%')</if>
<iftest="groupDeptId != null "> and spc.group_dept_id = #{groupDeptId}</if>
<iftest="checkType != null and checkType != ''"> and spc.check_type = #{checkType}</if>
<iftest="workingPositionType != null and workingPositionType != ''"> and spc.working_position_type = #{workingPositionType}</if>
<iftest="checkWorkingPosition != null and checkWorkingPosition != ''"> and spc.check_working_position like concat('%', #{checkWorkingPosition}, '%')</if>
<iftest="checkResult != null and checkResult != ''"> and spc.check_result = #{checkResult}</if>
<iftest="qualityUser != null and qualityUser != ''"> and (spc.quality_user like concat('%', #{qualityUser}, '%') or spc.quality_user_name like concat('%', #{qualityUser}, '%'))</if>
<iftest="qualityUserName != null and qualityUserName != ''"> and spc.quality_user_name like concat('%', #{qualityUserName}, '%')</if>
<iftest="superviseUser != null and superviseUser != ''"> and (spc.supervise_user like concat('%', #{superviseUser}, '%') or spc.supervise_user_name like concat('%', #{superviseUser}, '%'))</if>
<iftest="superviseUserName != null and superviseUserName != ''"> and spc.supervise_user_name like concat('%', #{superviseUserName}, '%')</if>
<iftest="groupDeptUser != null and groupDeptUser != ''"> and spc.group_dept_user like concat('%', #{groupDeptUser}, '%')</if>
<iftest="groupDeptUserName != null and groupDeptUserName != ''"> and spc.group_dept_user_name like concat('%', #{groupDeptUserName}, '%')</if>
<iftest="params.beginCheckingDate != null and params.beginCheckingDate != '' and params.endCheckingDate != null and params.endCheckingDate != ''"> and spc.checking_date between #{params.beginCheckingDate} and #{params.endCheckingDate}</if>
<iftest="isDel != null "> and spc.is_del = #{isDel}</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 spui.unitId = #{nowDept}</if>