jhprjv2/yanzhu-jh/src/main/resources/mapper/trouble/SmzSspProblemmodifyMapper.xml

493 lines
33 KiB
XML
Raw Normal View History

2023-08-10 21:09:49 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yanzhu.jh.trouble.mapper.SmzSspProblemmodifyMapper">
<resultMap type="SmzSspProblemmodify" id="SmzSspProblemmodifyResult">
<result property="id" column="id" />
<result property="projectId" column="projectId" />
<result property="infoType" column="infoType" />
<result property="problemArea" column="problemArea" />
<result property="workParts" column="workParts" />
<result property="changeInfo" column="changeInfo" />
<result property="lordSent" column="lordSent" />
<result property="lordSentUser" column="lordSentUser" />
<result property="copySend" column="copySend" />
<result property="copySendUser" column="copySendUser" />
<result property="checkState" column="checkState" />
<result property="nickedArea" column="nickedArea" />
<result property="nickedTime" column="nickedTime" />
<result property="projectType" column="projectType" />
<result property="processName" column="processName" />
<result property="projectName" column="projectName" />
<result property="nickedInfo" column="nickedInfo" />
<result property="checkUser" column="checkUser" />
<result property="checkUserPhone" column="checkUserPhone" />
<result property="isDel" column="isDel" />
<result property="createUser" column="createUser" />
<result property="createTime" column="createTime" />
<result property="updateUser" column="updateUser" />
<result property="updateTime" column="updateTime" />
<result property="marksPicture" column="marks_picture" />
<result property="marksVideo" column="marks_video" />
<result property="smarkUrl" column="smark_url" />
<result property="dangerType" column="danger_type" />
2023-08-24 18:42:44 +08:00
<result property="dangerTypeName" column="danger_type_name" />
2023-08-10 21:09:49 +08:00
<result property="recheckSend" column="recheckSend" />
<result property="recheckSendUser" column="recheckSendUser" />
<result property="roleType" column="roleType" />
<result property="vDel" column="v_del" />
2023-08-16 23:41:57 +08:00
<result property="createBy" column="createBy"/>
2023-08-24 18:42:44 +08:00
<result property="deptName" column="deptName"/>
<result property="createUserName" column="createUserName"/>
<result property="flag" column="flag"/>
2023-08-10 21:09:49 +08:00
</resultMap>
<sql id="selectSmzSspProblemmodifyVo">
select id, projectId, infoType, problemArea, workParts, changeInfo, lordSent, lordSentUser, copySend, copySendUser, checkState, nickedArea, nickedTime, projectType, processName, projectName, nickedInfo, checkUser, checkUserPhone, isDel, createUser, createTime, updateUser, updateTime, marks_picture, marks_video, smark_url, danger_type, recheckSend, recheckSendUser, roleType from smz_ssp_problemmodify
</sql>
2023-08-27 17:53:55 +08:00
<select id="selectSmzSspProblemmodifyList" parameterType="SmzSspProblemmodifyWhere" resultMap="SmzSspProblemmodifyResult">
2023-08-16 23:41:57 +08:00
select ssp.id, ssp.projectId, ssp.infoType, ssp.problemArea, ssp.workParts, ssp.changeInfo, ssp.lordSent, ssp.lordSentUser, ssp.copySend, ssp.copySendUser, ssp.checkState, ssp.nickedArea, ssp.nickedTime, ssp.projectType, ssp.processName, ssp.projectName, ssp.nickedInfo, ssp.checkUser, ssp.checkUserPhone, ssp.isDel, ssp.createUser, ssp.createTime, ssp.updateUser, ssp.updateTime, ssp.marks_picture, ssp.marks_video, ssp.smark_url, ssp.danger_type, ssp.recheckSend, ssp.recheckSendUser, ssp.roleType,ssp.createBy,
2023-08-12 12:18:27 +08:00
CASE WHEN(ssp.createUser = #{nowUser}
or #{nowRole} in ('1','2','3','4') ) and ssp.checkState &lt; 4
THEN 0 ELSE 1
2023-08-10 21:09:49 +08:00
END AS v_del
2023-08-16 23:41:57 +08:00
from vw_smz_ssp_problemmodify_audit ssp
2023-08-10 21:09:49 +08:00
left join sur_project sp on ssp.projectId = sp.id
2023-08-17 23:39:50 +08:00
<!--监理单位/总包公司/分包单位-->
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> left join sur_project_unit_info spui on spui.projectId = sp.id</if>
2023-08-10 21:09:49 +08:00
<where>
2023-08-12 12:18:27 +08:00
and ssp.isDel=0
2023-08-10 21:09:49 +08:00
<if test="projectId != null "> and ssp.projectId = #{projectId}</if>
<if test="infoType != null "> and ssp.infoType = #{infoType}</if>
2023-08-20 19:11:56 +08:00
<if test="roleType != null and roleType >0 "> and ssp.roleType = #{roleType}</if>
2023-08-10 21:09:49 +08:00
<if test="problemArea != null and problemArea != ''"> and ssp.problemArea like concat('%', #{problemArea}, '%')</if>
<if test="workParts != null and workParts != ''"> and ssp.workParts like concat('%', #{workParts}, '%')</if>
<if test="changeInfo != null and changeInfo != ''"> and ssp.changeInfo like concat('%', #{changeInfo}, '%')</if>
<if test="lordSent != null and lordSent != ''"> and ssp.lordSent = #{lordSent}</if>
<if test="lordSentUser != null and lordSentUser != ''"> and ssp.lordSentUser = #{lordSentUser}</if>
<if test="copySend != null and copySend != ''"> and ssp.copySend = #{copySend}</if>
<if test="copySendUser != null and copySendUser != ''"> and ssp.copySendUser = #{copySendUser}</if>
<if test="checkState != null "> and ssp.checkState = #{checkState}</if>
<if test="nickedArea != null and nickedArea != ''"> and nickedArea = #{nickedArea}</if>
<if test="nickedTime != null "> and ssp.nickedTime = #{nickedTime}</if>
<if test="projectType != null and projectType != ''"> and ssp.projectType = #{projectType}</if>
<if test="processName != null and processName != ''"> and ssp.processName like concat('%', #{processName}, '%')</if>
<if test="projectName != null and projectName != ''"> and ssp.projectName like concat('%', #{projectName}, '%')</if>
<if test="nickedInfo != null and nickedInfo != ''"> and ssp.nickedInfo = #{nickedInfo}</if>
<if test="checkUser != null and checkUser != ''"> and ssp.checkUser = #{checkUser}</if>
<if test="checkUserPhone != null and checkUserPhone != ''"> and ssp.checkUserPhone = #{checkUserPhone}</if>
<if test="isDel != null "> and ssp.isDel = #{isDel}</if>
2023-08-27 17:53:55 +08:00
<if test="startDate!=null">and DATE(ssp.createtime)>=DATE(#{startDate})</if>
<if test="endDate!=null">and DATE(ssp.createtime) &lt;= DATE(#{endDate})</if>
2023-08-10 21:09:49 +08:00
<if test="createUser != null and createUser != ''"> and ssp.createUser like concat('%', #{createUser}, '%')</if>
<if test="createTime != null "> and ssp.createTime = #{createTime}</if>
<if test="updateUser != null and updateUser != ''"> and ssp.updateUser = #{updateUser}</if>
<if test="updateTime != null "> and ssp.updateTime = #{updateTime}</if>
<if test="dangerType != null and dangerType != ''"> and ssp.danger_type = #{dangerType}</if>
<if test="params.beginMarksTime != null and params.beginMarksTime != '' and params.endMarksTime != null and params.endMarksTime != ''"> and ssp.createTime between #{params.beginMarksTime} and #{params.endMarksTime}</if>
2023-08-12 12:18:27 +08:00
<!-- 查询条件-项目部门 -->
<if test="projectDeptId != null "> and sp.deptId = #{projectDeptId}</if>
2023-08-10 21:09:49 +08:00
<!--子部门数据-->
<if test='nowRole == "4"'> and sp.deptId = #{nowDept}</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and spui.unitId = #{nowDept}</if>
2023-08-15 17:48:24 +08:00
<!--普通整改人是我,复检人是我,抄送人是我,提交人是我的数据-->
2023-08-24 18:42:44 +08:00
<if test='nowRole == "99"'> and (ssp.lordSentUser = #{nowUser} or ssp.copySendUser like concat('%', #{nowUser}, '%') or ssp.recheckSendUser = #{nowUser} or ssp.createUser = #{nowUser} )</if>
2023-08-10 21:09:49 +08:00
<if test='activeName == "dzg"'> and ssp.checkState in (0,3)</if>
<if test='activeName == "dqr"'> and ssp.checkState in (1)</if>
<if test='activeName == "ycl"'> and ssp.checkState = 4 </if>
2023-08-16 23:46:29 +08:00
<if test='activeName == "zgcs"'> and (date(NOW())<![CDATA[ > ]]> date(ssp.nickedTime) and (ssp.updateTime is null or date(ssp.updateTime) <![CDATA[ > ]]> date(ssp.nickedTime))) </if>
2023-08-10 21:09:49 +08:00
</where>
order by createTime desc
</select>
2023-08-17 23:39:50 +08:00
2023-08-24 18:42:44 +08:00
<select id="selectWechatSmzSspProblemmodifyList" parameterType="SmzSspProblemmodify" resultMap="SmzSspProblemmodifyResult">
select ssp.id, ssp.projectId, ssp.infoType, ssp.problemArea, ssp.workParts, ssp.changeInfo, ssp.lordSent, ssp.lordSentUser, ssp.copySend, ssp.copySendUser, ssp.checkState, ssp.nickedArea, ssp.nickedTime, ssp.projectType, ssp.processName, ssp.projectName, ssp.nickedInfo, ssp.checkUser, ssp.checkUserPhone, ssp.isDel, ssp.createUser, ssp.createTime, ssp.updateUser, ssp.updateTime, ssp.marks_picture, ssp.marks_video, ssp.smark_url, ssp.danger_type, ssp.recheckSend, ssp.recheckSendUser, ssp.roleType, ssp.createBy,
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
<if test='infoType == "0" '> left join sys_dict_data sdd on sdd.dict_type = 'ssp_aqyhlx' and sdd.dict_value = ssp.danger_type</if>
<if test='infoType == "1" '> left join sys_dict_data sdd on sdd.dict_type = 'ssp_zlyhlx' and sdd.dict_value = ssp.danger_type</if>
<!--监理单位/总包公司/分包单位-->
<if test='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
<if test="projectId != null "> and ssp.projectId = #{projectId}</if>
<if test="infoType != null "> and ssp.infoType = #{infoType}</if>
<if test="roleType != null and roleType >0 "> and ssp.roleType = #{roleType}</if>
<if test="problemArea != null and problemArea != ''"> and ssp.problemArea like concat('%', #{problemArea}, '%')</if>
<if test="workParts != null and workParts != ''"> and ssp.workParts like concat('%', #{workParts}, '%')</if>
<if test="changeInfo != null and changeInfo != ''"> and ssp.changeInfo like concat('%', #{changeInfo}, '%')</if>
<if test="lordSent != null and lordSent != ''"> and ssp.lordSent = #{lordSent}</if>
<if test="lordSentUser != null and lordSentUser != ''"> and ssp.lordSentUser = #{lordSentUser}</if>
<if test="copySend != null and copySend != ''"> and ssp.copySend = #{copySend}</if>
<if test="copySendUser != null and copySendUser != ''"> and ssp.copySendUser = #{copySendUser}</if>
<if test="checkState != null "> and ssp.checkState = #{checkState}</if>
<if test="nickedArea != null and nickedArea != ''"> and nickedArea = #{nickedArea}</if>
<if test="nickedTime != null "> and ssp.nickedTime = #{nickedTime}</if>
<if test="projectType != null and projectType != ''"> and ssp.projectType = #{projectType}</if>
<if test="processName != null and processName != ''"> and ssp.processName like concat('%', #{processName}, '%')</if>
<if test="projectName != null and projectName != ''"> and ssp.projectName like concat('%', #{projectName}, '%')</if>
<if test="nickedInfo != null and nickedInfo != ''"> and ssp.nickedInfo = #{nickedInfo}</if>
<if test="checkUser != null and checkUser != ''"> and ssp.checkUser = #{checkUser}</if>
<if test="checkUserPhone != null and checkUserPhone != ''"> and ssp.checkUserPhone = #{checkUserPhone}</if>
<if test="isDel != null "> and ssp.isDel = #{isDel}</if>
<if test="createUser != null and createUser != ''"> and ssp.createUser like concat('%', #{createUser}, '%')</if>
<if test="createTime != null "> and ssp.createTime = #{createTime}</if>
<if test="updateUser != null and updateUser != ''"> and ssp.updateUser = #{updateUser}</if>
<if test="updateTime != null "> and ssp.updateTime = #{updateTime}</if>
<if test="dangerType != null and dangerType != ''"> and ssp.danger_type = #{dangerType}</if>
<if test="params.beginMarksTime != null and params.beginMarksTime != '' and params.endMarksTime != null and params.endMarksTime != ''"> and ssp.createTime between #{params.beginMarksTime} and #{params.endMarksTime}</if>
<!-- 查询条件-项目部门 -->
<if test="projectDeptId != null "> and sp.deptId = #{projectDeptId}</if>
<!--子部门数据-->
<if test='nowRole == "4"'> and sp.deptId = #{nowDept}</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and spui.unitId = #{nowDept}</if>
<!--普通整改人是我,复检人是我,抄送人是我,提交人是我的数据-->
<if test='nowRole == "99"'> and (ssp.lordSentUser = #{nowUser} or ssp.copySendUser like concat('%', #{nowUser}, '%') or ssp.recheckSendUser = #{nowUser} or ssp.createUser = #{nowUser} )</if>
<if test='activeName == "dzg"'> and ssp.checkState in (0,1,3)</if>
<if test='activeName == "ycl"'> and ssp.checkState = 4 </if>
<if test='activeName == "zgcs"'> and (date(NOW())<![CDATA[ > ]]> date(ssp.nickedTime) and (ssp.updateTime is null or date(ssp.updateTime) <![CDATA[ > ]]> date(ssp.nickedTime))) </if>
</where>
order by sort,ssp.createTime desc
</select>
2023-08-17 23:39:50 +08:00
<!--根据状态分组查询-->
<select id="findProblemmodifyGroupByCheckState" parameterType="SmzSspProblemmodify" resultType="map">
SELECT ssp.checkState,COUNT(ssp.id) total FROM smz_ssp_problemmodify ssp
left join sur_project sp on ssp.projectId = sp.id
<!--监理单位/总包公司/分包单位-->
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> left join sur_project_unit_info spui on spui.projectId = sp.id</if>
WHERE ssp.isDel=0
2023-08-24 18:42:44 +08:00
<if test="projectId != null "> and ssp.projectId = #{projectId}</if>
2023-08-17 23:39:50 +08:00
<if test="infoType !=null">and infoType=#{infoType}</if>
<if test="problemArea != null and problemArea != ''"> and ssp.problemArea like concat('%', #{problemArea}, '%')</if>
<if test="workParts != null and workParts != ''"> and ssp.workParts like concat('%', #{workParts}, '%')</if>
<if test="createUser != null and createUser != ''"> and ssp.createUser like concat('%', #{createUser}, '%')</if>
<if test="dangerType != null and dangerType != ''"> and ssp.danger_type = #{dangerType}</if>
<if test="params.beginMarksTime != null and params.beginMarksTime != '' and params.endMarksTime != null and params.endMarksTime != ''"> and ssp.createTime between #{params.beginMarksTime} and #{params.endMarksTime}</if>
<!-- 查询条件-项目部门 -->
<if test="projectDeptId != null "> and sp.deptId = #{projectDeptId}</if>
<!--子部门数据-->
<if test='nowRole == "4"'> and sp.deptId = #{nowDept}</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and spui.unitId = #{nowDept}</if>
<!--普通整改人是我,复检人是我,抄送人是我,提交人是我的数据-->
2023-08-24 18:42:44 +08:00
<if test='nowRole == "99"'> and (ssp.lordSentUser = #{nowUser} or ssp.copySendUser like concat('%', #{nowUser}, '%') or ssp.recheckSendUser = #{nowUser} or ssp.createUser = #{nowUser} )</if>
2023-08-17 23:39:50 +08:00
GROUP BY checkState
</select>
<!--整改超时数-->
<select id="findProblemmodifyTimeoutCount" parameterType="SmzSspProblemmodify" resultType="Integer">
2023-08-18 17:58:35 +08:00
SELECT COUNT(ssp.id) total FROM smz_ssp_problemmodify ssp
2023-08-17 23:39:50 +08:00
left join sur_project sp on ssp.projectId = sp.id
<!--监理单位/总包公司/分包单位-->
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> left join sur_project_unit_info spui on spui.projectId = sp.id</if>
WHERE ssp.isDel=0
2023-08-24 18:42:44 +08:00
<if test="projectId != null "> and ssp.projectId = #{projectId}</if>
2023-08-17 23:39:50 +08:00
and (date(NOW())<![CDATA[ > ]]> date(ssp.nickedTime) and (ssp.updateTime is null or date(ssp.updateTime) <![CDATA[ > ]]> date(ssp.nickedTime)))
<if test="infoType !=null">and infoType=#{infoType}</if>
<if test="problemArea != null and problemArea != ''"> and ssp.problemArea like concat('%', #{problemArea}, '%')</if>
<if test="workParts != null and workParts != ''"> and ssp.workParts like concat('%', #{workParts}, '%')</if>
<if test="createUser != null and createUser != ''"> and ssp.createUser like concat('%', #{createUser}, '%')</if>
<if test="dangerType != null and dangerType != ''"> and ssp.danger_type = #{dangerType}</if>
<if test="params.beginMarksTime != null and params.beginMarksTime != '' and params.endMarksTime != null and params.endMarksTime != ''"> and ssp.createTime between #{params.beginMarksTime} and #{params.endMarksTime}</if>
<!-- 查询条件-项目部门 -->
<if test="projectDeptId != null "> and sp.deptId = #{projectDeptId}</if>
<!--子部门数据-->
<if test='nowRole == "4"'> and sp.deptId = #{nowDept}</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and spui.unitId = #{nowDept}</if>
<!--普通整改人是我,复检人是我,抄送人是我,提交人是我的数据-->
2023-08-24 18:42:44 +08:00
<if test='nowRole == "99"'> and (ssp.lordSentUser = #{nowUser} or ssp.copySendUser like concat('%', #{nowUser}, '%') or ssp.recheckSendUser = #{nowUser} or ssp.createUser = #{nowUser} )</if>
2023-08-17 23:39:50 +08:00
</select>
2023-08-10 21:09:49 +08:00
<select id="selectSmzSspProblemmodifyById" parameterType="Long" resultMap="SmzSspProblemmodifyResult">
<include refid="selectSmzSspProblemmodifyVo"/>
where id = #{id}
</select>
2023-08-24 18:42:44 +08:00
<select id="selectSmzSspProblemmodifyInfoById" parameterType="Long" resultMap="SmzSspProblemmodifyResult">
select ssp.id, ssp.projectId, ssp.infoType, ssp.problemArea, ssp.workParts, ssp.changeInfo, ssp.lordSent, ssp.lordSentUser, ssp.copySend, ssp.copySendUser, ssp.checkState, ssp.nickedArea, ssp.nickedTime, ssp.projectType, ssp.processName, ssp.projectName, ssp.nickedInfo, ssp.checkUser, ssp.checkUserPhone, ssp.isDel, ssp.createUser, ssp.createTime, ssp.updateUser, ssp.updateTime, ssp.marks_picture, ssp.marks_video, ssp.smark_url, ssp.danger_type, ssp.recheckSend, ssp.recheckSendUser, ssp.roleType, ssp.createBy,
case when ud.type_flag in (1,11) then concat(sd.dept_name,' ', '[责任主体]') else concat(ud.dept_name, ' ', '[', sdd3.dict_label ,']') end as deptName,
IFNULL(sdd1.dict_label,sdd2.dict_label) as danger_type_name,
su.nick_name as createUserName
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
left join sys_dict_data sdd1 on sdd1.dict_type = 'ssp_aqyhlx' and sdd1.dict_value = ssp.danger_type
left join sys_dict_data sdd2 on sdd2.dict_type = 'ssp_zlyhlx' and sdd2.dict_value = ssp.danger_type
left join sur_project_unit_info spui on spui.projectId = sp.id and spui.unitId = su.dept_id
left join sys_dict_data sdd3 on sdd3.dict_type = 'sys_dept_type' and sdd3.dict_value = spui.unitType
where ssp.id = #{id}
</select>
2023-08-10 21:09:49 +08:00
<insert id="insertSmzSspProblemmodify" parameterType="SmzSspProblemmodify" useGeneratedKeys="true" keyProperty="id">
insert into smz_ssp_problemmodify
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="projectId != null">projectId,</if>
<if test="infoType != null">infoType,</if>
2023-08-24 18:42:44 +08:00
<if test="marksPicture != null">marks_picture,</if>
<if test="marksVideo != null">marks_video,</if>
2023-08-10 21:09:49 +08:00
<if test="problemArea != null">problemArea,</if>
<if test="workParts != null">workParts,</if>
<if test="changeInfo != null">changeInfo,</if>
<if test="lordSent != null">lordSent,</if>
<if test="lordSentUser != null">lordSentUser,</if>
<if test="copySend != null">copySend,</if>
<if test="copySendUser != null">copySendUser,</if>
<if test="checkState != null">checkState,</if>
<if test="nickedArea != null">nickedArea,</if>
<if test="nickedTime != null">nickedTime,</if>
<if test="projectType != null">projectType,</if>
<if test="processName != null">processName,</if>
<if test="projectName != null">projectName,</if>
<if test="nickedInfo != null">nickedInfo,</if>
<if test="checkUser != null">checkUser,</if>
<if test="checkUserPhone != null">checkUserPhone,</if>
2023-08-24 18:42:44 +08:00
<if test="smarkUrl != null">smark_url,</if>
2023-08-10 21:09:49 +08:00
<if test="isDel != null">isDel,</if>
<if test="createUser != null">createUser,</if>
<if test="createTime != null">createTime,</if>
<if test="updateUser != null">updateUser,</if>
<if test="updateTime != null">updateTime,</if>
2023-08-24 18:42:44 +08:00
<if test="dangerType != null">danger_type,</if>
<if test="recheckSend != null">recheckSend,</if>
<if test="recheckSendUser != null">recheckSendUser,</if>
<if test="roleType != null">roleType,</if>
2023-08-10 21:09:49 +08:00
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectId != null">#{projectId},</if>
<if test="infoType != null">#{infoType},</if>
2023-08-24 18:42:44 +08:00
<if test="marksPicture != null">#{marksPicture},</if>
<if test="marksVideo != null">#{marksVideo},</if>
2023-08-10 21:09:49 +08:00
<if test="problemArea != null">#{problemArea},</if>
<if test="workParts != null">#{workParts},</if>
<if test="changeInfo != null">#{changeInfo},</if>
<if test="lordSent != null">#{lordSent},</if>
<if test="lordSentUser != null">#{lordSentUser},</if>
<if test="copySend != null">#{copySend},</if>
<if test="copySendUser != null">#{copySendUser},</if>
<if test="checkState != null">#{checkState},</if>
<if test="nickedArea != null">#{nickedArea},</if>
<if test="nickedTime != null">#{nickedTime},</if>
<if test="projectType != null">#{projectType},</if>
<if test="processName != null">#{processName},</if>
<if test="projectName != null">#{projectName},</if>
<if test="nickedInfo != null">#{nickedInfo},</if>
<if test="checkUser != null">#{checkUser},</if>
<if test="checkUserPhone != null">#{checkUserPhone},</if>
2023-08-24 18:42:44 +08:00
<if test="smarkUrl != null">#{smarkUrl},</if>
2023-08-10 21:09:49 +08:00
<if test="isDel != null">#{isDel},</if>
<if test="createUser != null">#{createUser},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateUser != null">#{updateUser},</if>
<if test="updateTime != null">#{updateTime},</if>
2023-08-24 18:42:44 +08:00
<if test="dangerType != null">#{dangerType},</if>
<if test="recheckSend != null">#{recheckSend},</if>
<if test="recheckSendUser != null">#{recheckSendUser},</if>
<if test="roleType != null">#{roleType},</if>
2023-08-10 21:09:49 +08:00
</trim>
</insert>
<update id="updateSmzSspProblemmodify" parameterType="SmzSspProblemmodify">
update smz_ssp_problemmodify
<trim prefix="SET" suffixOverrides=",">
<if test="projectId != null">projectId = #{projectId},</if>
<if test="infoType != null">infoType = #{infoType},</if>
2023-08-24 18:42:44 +08:00
<if test="marksPicture != null">marks_picture = #{marksPicture},</if>
<if test="marksVideo != null">marks_video = #{marksVideo},</if>
2023-08-10 21:09:49 +08:00
<if test="problemArea != null">problemArea = #{problemArea},</if>
<if test="workParts != null">workParts = #{workParts},</if>
<if test="changeInfo != null">changeInfo = #{changeInfo},</if>
<if test="lordSent != null">lordSent = #{lordSent},</if>
<if test="lordSentUser != null">lordSentUser = #{lordSentUser},</if>
<if test="copySend != null">copySend = #{copySend},</if>
<if test="copySendUser != null">copySendUser = #{copySendUser},</if>
<if test="checkState != null">checkState = #{checkState},</if>
<if test="nickedArea != null">nickedArea = #{nickedArea},</if>
<if test="nickedTime != null">nickedTime = #{nickedTime},</if>
<if test="projectType != null">projectType = #{projectType},</if>
<if test="processName != null">processName = #{processName},</if>
<if test="projectName != null">projectName = #{projectName},</if>
<if test="nickedInfo != null">nickedInfo = #{nickedInfo},</if>
<if test="checkUser != null">checkUser = #{checkUser},</if>
<if test="checkUserPhone != null">checkUserPhone = #{checkUserPhone},</if>
2023-08-24 18:42:44 +08:00
<if test="smarkUrl != null">smark_url = #{smarkUrl},</if>
2023-08-10 21:09:49 +08:00
<if test="isDel != null">isDel = #{isDel},</if>
<if test="createUser != null">createUser = #{createUser},</if>
<if test="createTime != null">createTime = #{createTime},</if>
<if test="updateUser != null">updateUser = #{updateUser},</if>
<if test="updateTime != null">updateTime = #{updateTime},</if>
2023-08-24 18:42:44 +08:00
<if test="dangerType != null">danger_type = #{dangerType},</if>
<if test="recheckSend != null">recheckSend = #{recheckSend},</if>
<if test="recheckSendUser != null">recheckSendUser = #{recheckSendUser},</if>
<if test="roleType != null">roleType = #{roleType},</if>
2023-08-10 21:09:49 +08:00
</trim>
where id = #{id}
</update>
<delete id="deleteSmzSspProblemmodifyById" parameterType="Long">
2023-08-12 12:18:27 +08:00
update smz_ssp_problemmodify set isDel=1 where id = #{id}
2023-08-10 21:09:49 +08:00
</delete>
<delete id="deleteSmzSspProblemmodifyByIds" parameterType="String">
2023-08-12 12:18:27 +08:00
update smz_ssp_problemmodify set isDel=1 where id in
2023-08-10 21:09:49 +08:00
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
2023-08-26 23:35:59 +08:00
<select id="selectSummary" parameterType="SmzSspProblemmodifyWhere" resultMap="SmzSspProblemmodifyResult">
2023-08-10 21:09:49 +08:00
SELECT a.dict_value id,a.dict_label problemArea,b.cnt roleType FROM (SELECT * FROM sys_dict_data
<where>
<if test="infoType==0">and dict_type='ssp_aqyhlx'</if>
<if test="infoType>0">and dict_type='ssp_zlyhlx'</if>
</where>
) a
LEFT JOIN ( SELECT danger_type,COUNT(1) cnt FROM smz_ssp_problemmodify WHERE projectId IN(
SELECT id FROM sur_project
2023-08-13 12:31:20 +08:00
where isDel=0
2023-08-17 22:47:17 +08:00
<if test="projectId>0">and projectId=#{projectId}</if>
2023-08-26 23:35:59 +08:00
<if test="deptId >0 ">AND deptid = #{deptId}</if>
2023-08-13 12:31:20 +08:00
) AND infotype=#{infoType} and isDel=0
2023-08-10 21:09:49 +08:00
<if test="roleType > 0">AND roletype=#{roleType}</if>
2023-08-26 23:35:59 +08:00
<if test="startDate!=null">and DATE(createtime)>=DATE(#{startDate})</if>
<if test="endDate!=null">and DATE(createtime) &lt;= DATE(#{endDate})</if>
2023-08-10 21:09:49 +08:00
GROUP BY danger_type) b
2023-08-10 23:37:19 +08:00
ON a.dict_value=b.danger_type ORDER BY cnt DESC,a.dict_value+0
2023-08-10 21:09:49 +08:00
</select>
2023-08-26 23:35:59 +08:00
<select id="selectSummaryByProject" parameterType="SmzSspProblemmodifyWhere" resultMap="SmzSspProblemmodifyResult">
2023-08-27 13:50:15 +08:00
select a.projectId,a.prjName projectName,a.proble id,if(b.timoutNoComp is null,0,b.timoutNoComp) infoType,
if(c.timoutComp is null,0,c.timoutComp) checkState,
if(d.comp is null,0,d.comp) isDel
from
2023-08-15 00:48:20 +08:00
(
select projectId,prjName,count(1) proble from vw_smz_ssp_problemmodify_audit
where infoType=#{infoType}
2023-08-17 22:47:17 +08:00
<if test="projectId>0">and projectId=#{projectId}</if>
2023-08-26 23:35:59 +08:00
<if test="deptId >0 ">AND deptid = #{deptId}</if>
2023-08-15 00:48:20 +08:00
<if test="roleType > 0">AND roletype=#{roleType}</if>
2023-08-26 23:35:59 +08:00
<if test="startDate!=null">and DATE(createtime)>=DATE(#{startDate})</if>
<if test="endDate!=null">and DATE(createtime) &lt;= DATE(#{endDate})</if>
2023-08-15 00:48:20 +08:00
group by projectId,prjName
)
a
left join(
select projectid,count(1) timoutNoComp from vw_smz_ssp_problemmodify_audit where
2023-08-16 23:41:57 +08:00
((updateTime is null and date(nickedTime) &lt; date(now()) ) or date(updateTime )>date(nickedTime))
2023-08-15 00:48:20 +08:00
and infoType=#{infoType}
2023-08-17 22:47:17 +08:00
<if test="projectId>0">and projectId=#{projectId}</if>
2023-08-26 23:35:59 +08:00
<if test="deptId >0 ">AND deptid = #{deptId}</if>
2023-08-15 00:48:20 +08:00
<if test="roleType > 0">AND roletype=#{roleType}</if>
2023-08-26 23:35:59 +08:00
<if test="startDate!=null">and DATE(createtime)>=DATE(#{startDate})</if>
<if test="endDate!=null">and DATE(createtime) &lt;= DATE(#{endDate})</if>
2023-08-15 00:48:20 +08:00
group by projectId
2023-08-10 21:09:49 +08:00
2023-08-15 00:48:20 +08:00
) b on a.projectId=b.projectId
2023-08-27 13:50:15 +08:00
2023-08-15 00:48:20 +08:00
left join (
2023-08-16 23:41:57 +08:00
SELECT projectid,COUNT(1) timoutComp FROM vw_smz_ssp_problemmodify_audit WHERE (updateTime is null and date(nickedTime) &lt; date(now()) )
2023-08-15 00:48:20 +08:00
and infoType=#{infoType}
2023-08-17 22:47:17 +08:00
<if test="projectId>0">and projectId=#{projectId}</if>
2023-08-26 23:35:59 +08:00
<if test="deptId >0 ">AND deptid = #{deptId}</if>
2023-08-10 21:09:49 +08:00
<if test="roleType > 0">AND roletype=#{roleType}</if>
2023-08-26 23:35:59 +08:00
<if test="startDate!=null">and DATE(createtime)>=DATE(#{startDate})</if>
<if test="endDate!=null">and DATE(createtime) &lt;= DATE(#{endDate})</if>
2023-08-15 00:48:20 +08:00
GROUP BY projectid
) c on a.projectId=c.projectId
2023-08-27 13:50:15 +08:00
left join(
select projectid,count(1) comp from vw_smz_ssp_problemmodify_audit where
checkState=4
and infoType=#{infoType}
<if test="projectId>0">and projectId=#{projectId}</if>
<if test="deptId >0 ">AND deptid = #{deptId}</if>
<if test="roleType > 0">AND roletype=#{roleType}</if>
<if test="startDate!=null">and DATE(createtime)>=DATE(#{startDate})</if>
<if test="endDate!=null">and DATE(createtime) &lt;= DATE(#{endDate})</if>
group by projectId
) d on a.projectId=d.projectId
2023-08-15 00:48:20 +08:00
order by a.proble desc
2023-08-10 21:09:49 +08:00
</select>
2023-08-13 12:31:20 +08:00
<select id="countByDate" parameterType="SmzSspProblemmodifyWhere" resultMap="SmzSspProblemmodifyResult">
SELECT infotype,COUNT(1) id FROM smz_ssp_problemmodify WHERE isDel=0
<if test="projectId > 0"> and projectId=#{projectId}</if>
<if test="projectId &lt;= 0">
AND projectId IN (
SELECT id FROM sur_project WHERE isdel=0
2023-08-26 23:35:59 +08:00
<if test="deptId >0 ">AND deptid = #{deptId}</if>
2023-08-13 12:31:20 +08:00
)
</if>
and DATE(createTime)=Date(#{startDate})
GROUP BY infotype
2023-08-15 00:48:20 +08:00
2023-08-13 12:31:20 +08:00
</select>
2023-08-10 21:09:49 +08:00
2023-08-13 12:31:20 +08:00
<select id="countByDateRange" parameterType="SmzSspProblemmodifyWhere" resultMap="SmzSspProblemmodifyResult">
2023-08-15 00:48:20 +08:00
SELECT infotype,COUNT(1) id FROM smz_ssp_problemmodify WHERE isDel=0 and infoType=#{infoType}
2023-08-13 12:31:20 +08:00
<if test="projectId > 0"> and projectId=#{projectId}</if>
<if test="projectId &lt;= 0">
AND projectId IN (
SELECT id FROM sur_project WHERE isdel=0
<if test="deptId >0 ">AND deptid = #{id}</if>
)
</if>
<![CDATA[
and DATE(createTime)>=Date(#{startDate}) and Date(createTime)<=Date(#{endDate})
]]>
GROUP BY infotype
</select>
<select id="groupByInfotypeCheckState" parameterType="SmzSspProblemmodifyWhere" resultMap="SmzSspProblemmodifyResult">
2023-08-20 19:11:56 +08:00
SELECT infotype,checkState,COUNT(1) id FROM vw_smz_ssp_problemmodify_audit WHERE isDel=0
2023-08-16 23:41:57 +08:00
<if test="infoType !=null">and infoType=#{infoType}</if>
2023-08-20 19:11:56 +08:00
<if test="roleType !=null and roleType>0">and roleType=#{roleType}</if>
2023-08-27 17:53:55 +08:00
<if test="startDate!=null">and DATE(createtime)>=DATE(#{startDate})</if>
<if test="endDate!=null">and DATE(createtime) &lt;= DATE(#{endDate})</if>
2023-08-13 12:31:20 +08:00
<if test="projectId > 0"> and projectId=#{projectId}</if>
<if test="projectId &lt;= 0">
AND projectId IN (
SELECT id FROM sur_project WHERE isdel=0
<if test="deptId >0 ">AND deptid = #{deptId}</if>
)
</if>
GROUP BY infotype,checkState
</select>
2023-08-16 23:41:57 +08:00
<select id="countTimeout" parameterType="SmzSspProblemmodifyWhere" resultType="Integer">
select count(1) cnt
FROM vw_smz_ssp_problemmodify_audit WHERE isDel=0
<if test="infoType !=null">and infoType=#{infoType}</if>
2023-08-20 19:11:56 +08:00
<if test="roleType !=null and roleType>0">and roleType=#{roleType}</if>
2023-08-27 17:53:55 +08:00
<if test="startDate!=null">and DATE(createtime)>=DATE(#{startDate})</if>
<if test="endDate!=null">and DATE(createtime) &lt;= DATE(#{endDate})</if>
2023-08-20 19:11:56 +08:00
and ((updateTime is null and date(nickedTime) &lt; date(now()) ) or date(updateTime )>date(nickedTime))
2023-08-16 23:41:57 +08:00
<if test="projectId > 0"> and projectId=#{projectId}</if>
<if test="projectId &lt;= 0">
AND projectId IN (
SELECT id FROM sur_project WHERE isdel=0
<if test="deptId >0 ">AND deptid = #{deptId}</if>
)
</if>
</select>
2023-08-10 21:09:49 +08:00
</mapper>