<iftest="problemArea != null and problemArea != ''"> and ssp.problemArea like concat('%', #{problemArea}, '%')</if>
<iftest="workParts != null and workParts != ''"> and ssp.workParts like concat('%', #{workParts}, '%')</if>
<iftest="changeInfo != null and changeInfo != ''"> and ssp.changeInfo like concat('%', #{changeInfo}, '%')</if>
<iftest="lordSent != null and lordSent != ''"> and ssp.lordSent = #{lordSent}</if>
<iftest="lordSentUser != null and lordSentUser != ''"> and ssp.lordSentUser = #{lordSentUser}</if>
<iftest="copySend != null and copySend != ''"> and ssp.copySend = #{copySend}</if>
<iftest="copySendUser != null and copySendUser != ''"> and ssp.copySendUser = #{copySendUser}</if>
<iftest="checkState != null "> and ssp.checkState = #{checkState}</if>
<iftest="nickedArea != null and nickedArea != ''"> and nickedArea = #{nickedArea}</if>
<iftest="nickedTime != null "> and ssp.nickedTime = #{nickedTime}</if>
<iftest="projectType != null and projectType != ''"> and ssp.projectType = #{projectType}</if>
<iftest="processName != null and processName != ''"> and ssp.processName like concat('%', #{processName}, '%')</if>
<iftest="projectName != null and projectName != ''"> and ssp.projectName like concat('%', #{projectName}, '%')</if>
<iftest="nickedInfo != null and nickedInfo != ''"> and ssp.nickedInfo = #{nickedInfo}</if>
<iftest="checkUser != null and checkUser != ''"> and ssp.checkUser = #{checkUser}</if>
<iftest="checkUserPhone != null and checkUserPhone != ''"> and ssp.checkUserPhone = #{checkUserPhone}</if>
<iftest="isDel != null "> and ssp.isDel = #{isDel}</if>
<iftest="createUser != null and createUser != ''"> and ssp.createUser like concat('%', #{createUser}, '%')</if>
<iftest="createTime != null "> and ssp.createTime = #{createTime}</if>
<iftest="updateUser != null and updateUser != ''"> and ssp.updateUser = #{updateUser}</if>
<iftest="updateTime != null "> and ssp.updateTime = #{updateTime}</if>
<iftest="dangerType != null and dangerType != ''"> and ssp.danger_type = #{dangerType}</if>
<iftest="params.beginMarksTime != null and params.beginMarksTime != '' and params.endMarksTime != null and params.endMarksTime != ''"> and ssp.createTime between #{params.beginMarksTime} and #{params.endMarksTime}</if>
<iftest='nowRole == "99"'> and (ssp.lordSentUser = #{nowUser} or ssp.copySendUser like concat('%', #{nowUser}, '%') or ssp.recheckSendUser = #{nowUser} or ssp.createUser = #{nowUser} )</if>
<iftest='activeName == "zgcs"'> and (date(NOW())<![CDATA[ > ]]> date(ssp.nickedTime) and (ssp.updateTime is null or date(ssp.updateTime) <![CDATA[ > ]]> date(ssp.nickedTime))) </if>
case when ud.type_flag in (1,11) then sd.dept_name else ud.dept_name end as deptName,
sdd.dict_label as danger_type_name,
case when ssp.recheckSendUser = #{nowUser} and ssp.checkState=1 then 0
when ssp.lordSentUser = #{nowUser} then 1
else 2 end sort
from vw_smz_ssp_problemmodify_audit ssp
left join sur_project sp on ssp.projectId = sp.id
LEFT JOIN sys_user su ON ssp.createUser = su.phonenumber
left join sys_dept ud on ud.dept_id = su.dept_id
left join sys_dept sd on sd.dept_id = sp.deptId
<iftest='infoType == "0" '> left join sys_dict_data sdd on sdd.dict_type = 'ssp_aqyhlx' and sdd.dict_value = ssp.danger_type</if>
<iftest='infoType == "1" '> left join sys_dict_data sdd on sdd.dict_type = 'ssp_zlyhlx' and sdd.dict_value = ssp.danger_type</if>
<!--监理单位/总包公司/分包单位-->
<iftest='nowRole == "5" or nowRole == "6" or nowRole == "7"'> left join sur_project_unit_info spui on spui.projectId = sp.id</if>
<where>
and ssp.isDel=0
<iftest="projectId != null "> and ssp.projectId = #{projectId}</if>
<iftest="infoType != null "> and ssp.infoType = #{infoType}</if>
<iftest="roleType != null and roleType >0 "> and ssp.roleType = #{roleType}</if>
<iftest="problemArea != null and problemArea != ''"> and ssp.problemArea like concat('%', #{problemArea}, '%')</if>
<iftest="workParts != null and workParts != ''"> and ssp.workParts like concat('%', #{workParts}, '%')</if>
<iftest="changeInfo != null and changeInfo != ''"> and ssp.changeInfo like concat('%', #{changeInfo}, '%')</if>
<iftest="lordSent != null and lordSent != ''"> and ssp.lordSent = #{lordSent}</if>
<iftest="lordSentUser != null and lordSentUser != ''"> and ssp.lordSentUser = #{lordSentUser}</if>
<iftest="copySend != null and copySend != ''"> and ssp.copySend = #{copySend}</if>
<iftest="copySendUser != null and copySendUser != ''"> and ssp.copySendUser = #{copySendUser}</if>
<iftest="checkState != null "> and ssp.checkState = #{checkState}</if>
<iftest="nickedArea != null and nickedArea != ''"> and nickedArea = #{nickedArea}</if>
<iftest="nickedTime != null "> and ssp.nickedTime = #{nickedTime}</if>
<iftest="projectType != null and projectType != ''"> and ssp.projectType = #{projectType}</if>
<iftest="processName != null and processName != ''"> and ssp.processName like concat('%', #{processName}, '%')</if>
<iftest="projectName != null and projectName != ''"> and ssp.projectName like concat('%', #{projectName}, '%')</if>
<iftest="nickedInfo != null and nickedInfo != ''"> and ssp.nickedInfo = #{nickedInfo}</if>
<iftest="checkUser != null and checkUser != ''"> and ssp.checkUser = #{checkUser}</if>
<iftest="checkUserPhone != null and checkUserPhone != ''"> and ssp.checkUserPhone = #{checkUserPhone}</if>
<iftest="isDel != null "> and ssp.isDel = #{isDel}</if>
<iftest="createUser != null and createUser != ''"> and ssp.createUser like concat('%', #{createUser}, '%')</if>
<iftest="createTime != null "> and ssp.createTime = #{createTime}</if>
<iftest="updateUser != null and updateUser != ''"> and ssp.updateUser = #{updateUser}</if>
<iftest="updateTime != null "> and ssp.updateTime = #{updateTime}</if>
<iftest="dangerType != null and dangerType != ''"> and ssp.danger_type = #{dangerType}</if>
<iftest="params.beginMarksTime != null and params.beginMarksTime != '' and params.endMarksTime != null and params.endMarksTime != ''"> and ssp.createTime between #{params.beginMarksTime} and #{params.endMarksTime}</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>
<!--普通整改人是我,复检人是我,抄送人是我,提交人是我的数据-->
<iftest='nowRole == "99"'> and (ssp.lordSentUser = #{nowUser} or ssp.copySendUser like concat('%', #{nowUser}, '%') or ssp.recheckSendUser = #{nowUser} or ssp.createUser = #{nowUser} )</if>
<iftest='activeName == "dzg"'> and ssp.checkState in (0,1,3)</if>
<iftest='activeName == "ycl"'> and ssp.checkState = 4 </if>
<iftest='activeName == "zgcs"'> and (date(NOW())<![CDATA[ > ]]> date(ssp.nickedTime) and (ssp.updateTime is null or date(ssp.updateTime) <![CDATA[ > ]]> date(ssp.nickedTime))) </if>
<iftest="problemArea != null and problemArea != ''"> and ssp.problemArea like concat('%', #{problemArea}, '%')</if>
<iftest="workParts != null and workParts != ''"> and ssp.workParts like concat('%', #{workParts}, '%')</if>
<iftest="createUser != null and createUser != ''"> and ssp.createUser like concat('%', #{createUser}, '%')</if>
<iftest="dangerType != null and dangerType != ''"> and ssp.danger_type = #{dangerType}</if>
<iftest="params.beginMarksTime != null and params.beginMarksTime != '' and params.endMarksTime != null and params.endMarksTime != ''"> and ssp.createTime between #{params.beginMarksTime} and #{params.endMarksTime}</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>
<iftest='nowRole == "99"'> and (ssp.lordSentUser = #{nowUser} or ssp.copySendUser like concat('%', #{nowUser}, '%') or ssp.recheckSendUser = #{nowUser} or ssp.createUser = #{nowUser} )</if>
<iftest="problemArea != null and problemArea != ''"> and ssp.problemArea like concat('%', #{problemArea}, '%')</if>
<iftest="workParts != null and workParts != ''"> and ssp.workParts like concat('%', #{workParts}, '%')</if>
<iftest="createUser != null and createUser != ''"> and ssp.createUser like concat('%', #{createUser}, '%')</if>
<iftest="dangerType != null and dangerType != ''"> and ssp.danger_type = #{dangerType}</if>
<iftest="params.beginMarksTime != null and params.beginMarksTime != '' and params.endMarksTime != null and params.endMarksTime != ''"> and ssp.createTime between #{params.beginMarksTime} and #{params.endMarksTime}</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>
<iftest='nowRole == "99"'> and (ssp.lordSentUser = #{nowUser} or ssp.copySendUser like concat('%', #{nowUser}, '%') or ssp.recheckSendUser = #{nowUser} or ssp.createUser = #{nowUser} )</if>