2023-08-26 00:36:09 +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.project.mapper.SurProjectCheckDetectionMapper" >
2023-09-01 02:28:04 +08:00
2023-08-26 00:36:09 +08:00
<resultMap type= "SurProjectCheckDetection" id= "SurProjectCheckDetectionResult" >
<result property= "id" column= "id" />
<result property= "projectId" column= "project_id" />
2023-09-01 02:28:04 +08:00
<result property= "projectName" column= "projectName" />
2023-08-26 00:36:09 +08:00
<result property= "deptId" column= "dept_id" />
2023-09-01 02:28:04 +08:00
<result property= "deptName" column= "dept_name" />
2023-08-26 00:36:09 +08:00
<result property= "checkType" column= "check_type" />
2023-09-01 02:28:04 +08:00
<result property= "checkTypeName" column= "check_type_name" />
<result property= "materialName" column= "material_name" />
<result property= "usePosition" column= "use_position" />
<result property= "sampleNum" column= "sample_num" />
<result property= "qualifiedFlag" column= "qualified_flag" />
<result property= "represenNum" column= "represen_num" />
<result property= "sampleUser" column= "sample_user" />
<result property= "sampleUserName" column= "sample_user_name" />
<result property= "witnessUser" column= "witness_user" />
<result property= "witnessUserName" column= "witness_user_name" />
<result property= "laboratoryName" column= "laboratory_name" />
2023-08-26 00:36:09 +08:00
<result property= "checkTime" column= "check_time" />
<result property= "checkState" column= "check_state" />
<result property= "detectionResult" column= "detection_result" />
<result property= "detectionFile" column= "detection_file" />
2023-09-01 02:28:04 +08:00
<result property= "isDel" column= "is_del" />
2023-08-26 00:36:09 +08:00
<result property= "createBy" column= "create_by" />
<result property= "createTime" column= "create_time" />
<result property= "updateBy" column= "update_by" />
<result property= "updateTime" column= "update_time" />
<result property= "remark" column= "remark" />
2023-09-16 00:09:12 +08:00
<result property= "createByName" column= "create_by_name" />
<result property= "updateByName" column= "update_by_name" />
2023-09-21 23:17:09 +08:00
<result property= "approveStatus" column= "approve_status" />
2024-04-28 00:46:33 +08:00
<result property= "attachment" column= "attachment" />
<result property= "trustDeed" column= "trust_deed" />
<result property= "specimenPhoto" column= "specimen_photo" />
2023-08-26 00:36:09 +08:00
</resultMap>
<sql id= "selectSurProjectCheckDetectionVo" >
2024-04-28 00:46:33 +08:00
SELECT spcd.id, spcd.project_id, sp.projectName, spcd.dept_id, sd.dept_name, spcd.check_type, sdd.dict_label AS check_type_name, spcd.material_name, spcd.use_position, spcd.sample_num, spcd.qualified_flag, spcd.represen_num, spcd.sample_user, spcd.sample_user_name, spcd.witness_user, spcd.witness_user_name, spcd.laboratory_name, spcd.check_time, spcd.check_state, spcd.detection_result, spcd.detection_file, spcd.create_by, spcd.create_time, spcd.is_del, spcd.update_by, spcd.update_time, spcd.remark, spcd.approve_status, u1.nick_name create_by_name
,u2.nick_name update_by_name,spcd.attachment,spcd.trust_deed,spcd.specimen_photo
2023-09-16 00:09:12 +08:00
FROM sur_project_check_detection spcd
LEFT JOIN sur_project sp ON spcd.project_id = sp.id
LEFT JOIN sys_dept sd ON sd.dept_id = spcd.dept_id
LEFT JOIN sys_dict_data sdd ON sdd.dict_type = 'check_detection_check_type' AND sdd.dict_value = spcd.check_type
LEFT JOIN sys_user u1 ON spcd.create_by=u1.phonenumber
LEFT JOIN sys_user u2 ON spcd.update_by=u2.phonenumber
2023-08-26 00:36:09 +08:00
</sql>
<select id= "selectSurProjectCheckDetectionList" parameterType= "SurProjectCheckDetection" resultMap= "SurProjectCheckDetectionResult" >
<include refid= "selectSurProjectCheckDetectionVo" />
2023-09-01 02:28:04 +08:00
<where >
and spcd.is_del='0'
<if test= "projectId != null " > and spcd.project_id = #{projectId}</if>
2023-09-24 21:46:59 +08:00
<if test= "deptId != null " > and (spcd.dept_id = #{deptId} or (spcd.witness_user like concat('%', #{nowUserName}, '%') and spcd.approve_status is not null))</if>
2023-09-01 02:28:04 +08:00
<if test= "checkType != null and checkType != ''" > and spcd.check_type = #{checkType}</if>
2023-09-21 23:17:09 +08:00
<if test= "approveStatus != null and approveStatus != ''" > and spcd.approve_status = #{approveStatus}</if>
2023-09-01 02:28:04 +08:00
<if test= "materialName != null and materialName != ''" > and spcd.material_name like concat('%', #{materialName}, '%')</if>
<if test= "usePosition != null and usePosition != ''" > and spcd.use_position like concat('%', #{usePosition}, '%')</if>
<if test= "sampleNum != null and sampleNum != ''" > and spcd.sample_num = #{sampleNum}</if>
<if test= "isDel != null and isDel != ''" > and spcd.is_del = #{isDel}</if>
2023-09-01 17:31:12 +08:00
<if test= "sampleUserName != null and sampleUserName != ''" > and (spcd.sample_user like concat('%', #{sampleUserName}, '%') or spcd.sample_user_name like concat('%', #{sampleUserName}, '%'))</if>
<if test= "witnessUserName != null and witnessUserName != ''" > and (spcd.witness_user like concat('%', #{witnessUserName}, '%') or spcd.witness_user_name like concat('%', #{witnessUserName}, '%'))</if>
2023-09-01 02:28:04 +08:00
<if test= "laboratoryName != null and laboratoryName != ''" > and spcd.laboratory_name like concat('%', #{laboratoryName}, '%')</if>
<if test= "params.beginCheckTime != null and params.beginCheckTime != '' and params.endCheckTime != null and params.endCheckTime != ''" > and spcd.check_time between #{params.beginCheckTime} and #{params.endCheckTime}</if>
<if test= "checkState != null and checkState != ''" > and spcd.check_state = #{checkState}</if>
<if test= "detectionResult != null and detectionResult != ''" > and spcd.detection_result = #{detectionResult}</if>
<!-- 查询条件 - 项目部门 -->
<if test= "projectDeptId != null " > and sp.deptId = #{projectDeptId}</if>
2024-06-11 23:33:06 +08:00
<if test= "projectName != null and projectName != ''" > and sp.projectName like concat('%', #{projectName}, '%')</if>
2023-09-01 02:28:04 +08:00
<!-- 子部门数据 -->
2023-09-24 21:46:59 +08:00
<if test= 'nowRole == "4"' > and sp.deptId = #{nowDept}</if>
2023-09-01 02:28:04 +08:00
<!-- 监理单位/总包公司/分包单位查询当前关联数据 -->
2023-09-24 21:46:59 +08:00
<if test= '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>
2023-09-01 02:28:04 +08:00
<!-- 普通用户查询项目人员 -->
2023-09-24 21:46:59 +08:00
<if test= 'nowRole == "15" or nowRole == "16" or nowRole == "17" or nowRole == "99"' >
and (sp.id in (select spu.project_id from sur_project_userinfo spu where spu.user_id = #{nowUser} and spu.is_del=0)
or (spcd.witness_user like concat('%', #{nowUserName}, '%') and spcd.approve_status is not null)
)
</if>
2023-09-24 16:35:45 +08:00
<if test= 'activeName == "jxz"' > and (spcd.approve_status != '4' or spcd.approve_status is null)</if>
2023-09-23 11:30:10 +08:00
<if test= 'activeName == "ywc"' > and spcd.approve_status = '4'</if>
2023-08-26 00:36:09 +08:00
</where>
2024-04-14 23:54:46 +08:00
order by spcd.approve_status, spcd.id desc
2023-08-26 00:36:09 +08:00
</select>
2023-09-01 02:28:04 +08:00
<select id= "queryGroupCount" parameterType= "SurProjectCheckDetection" resultType= "map" >
select spcd.check_state, count(1) as total from sur_project_check_detection spcd
left join sur_project sp on spcd.project_id = sp.id
left join sys_dept sd on sd.dept_id = spcd.dept_id
<where >
and spcd.is_del='0'
<if test= "projectId != null " > and spcd.project_id = #{projectId}</if>
<if test= "deptId != null " > and spcd.dept_id = #{deptId}</if>
<if test= "checkType != null and checkType != ''" > and spcd.check_type = #{checkType}</if>
<if test= "materialName != null and materialName != ''" > and spcd.material_name like concat('%', #{materialName}, '%')</if>
<if test= "usePosition != null and usePosition != ''" > and spcd.use_position like concat('%', #{usePosition}, '%')</if>
<if test= "sampleNum != null and sampleNum != ''" > and spcd.sample_num = #{sampleNum}</if>
<if test= "isDel != null and isDel != ''" > and spcd.is_del = #{isDel}</if>
<if test= "sampleUserName != null and sampleUserName != ''" > and spcd.sample_user_name like concat('%', #{sampleUserName}, '%')</if>
<if test= "witnessUserName != null and witnessUserName != ''" > and spcd.witness_user_name like concat('%', #{witnessUserName}, '%')</if>
<if test= "laboratoryName != null and laboratoryName != ''" > and spcd.laboratory_name like concat('%', #{laboratoryName}, '%')</if>
<if test= "params.beginCheckTime != null and params.beginCheckTime != '' and params.endCheckTime != null and params.endCheckTime != ''" > and spcd.check_time between #{params.beginCheckTime} and #{params.endCheckTime}</if>
<if test= "checkState != null and checkState != ''" > and spcd.check_state = #{checkState}</if>
<if test= "detectionResult != null and detectionResult != ''" > and spcd.detection_result = #{detectionResult}</if>
<!-- 查询条件 - 项目部门 -->
<if test= "projectDeptId != null " > and sp.deptId = #{projectDeptId}</if>
<!-- 子部门数据 -->
2023-09-24 21:46:59 +08:00
<if test= 'nowRole == "4"' > and sp.deptId = #{nowDept}</if>
2023-09-01 02:28:04 +08:00
<!-- 监理单位/总包公司/分包单位查询当前关联数据 -->
2023-09-24 21:46:59 +08:00
<if test= '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>
2023-09-01 02:28:04 +08:00
<!-- 普通用户查询项目人员 -->
2023-09-24 21:46:59 +08:00
<if test= 'nowRole == "15" or nowRole == "16" or nowRole == "17" or nowRole == "99"' >
and (sp.id in (select spu.project_id from sur_project_userinfo spu where spu.user_id = #{nowUser} and spu.is_del=0)
or spcd.witness_user like concat('%', #{nowUserName}, '%')
)
</if>
2023-09-01 02:28:04 +08:00
GROUP BY check_state
</where>
</select>
2023-09-03 14:07:36 +08:00
<select id= "findGroupCountByProjectId" parameterType= "Long" resultType= "map" >
select spcd.check_type as checkType,sdd.dict_label as checkTypeName, count(1) as total,checks.checkTotal,pass.passTotal from sur_project_check_detection spcd
left join sys_dict_data sdd on sdd.dict_type='check_detection_check_type' and sdd.dict_value = spcd.check_type
left join (select cd1.check_type as checks,count(1) as checkTotal from sur_project_check_detection cd1 where cd1.project_id=#{projectId} and cd1.check_state = '2' and cd1.is_del=0 GROUP BY cd1.check_type)checks on checks.checks=spcd.check_type
left join (select cd2.check_type as pass,count(1) as passTotal from sur_project_check_detection cd2 where cd2.project_id=#{projectId} and cd2.detection_result = '1' and cd2.is_del=0 GROUP BY cd2.check_type)pass on pass.pass=spcd.check_type
where spcd.project_id=#{projectId} and spcd.is_del=0
GROUP BY spcd.check_type
</select>
2023-08-26 00:36:09 +08:00
<select id= "selectSurProjectCheckDetectionById" parameterType= "Long" resultMap= "SurProjectCheckDetectionResult" >
<include refid= "selectSurProjectCheckDetectionVo" />
2023-09-01 02:28:04 +08:00
where spcd.id = #{id}
2023-08-26 00:36:09 +08:00
</select>
2023-09-01 02:28:04 +08:00
2023-08-26 00:36:09 +08:00
<insert id= "insertSurProjectCheckDetection" parameterType= "SurProjectCheckDetection" useGeneratedKeys= "true" keyProperty= "id" >
insert into sur_project_check_detection
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "projectId != null" > project_id,</if>
<if test= "deptId != null" > dept_id,</if>
<if test= "checkType != null" > check_type,</if>
2023-09-01 02:28:04 +08:00
<if test= "materialName != null" > material_name,</if>
<if test= "usePosition != null" > use_position,</if>
<if test= "sampleNum != null" > sample_num,</if>
<if test= "qualifiedFlag != null" > qualified_flag,</if>
<if test= "represenNum != null" > represen_num,</if>
<if test= "sampleUser != null" > sample_user,</if>
<if test= "sampleUserName != null" > sample_user_name,</if>
<if test= "witnessUser != null" > witness_user,</if>
<if test= "witnessUserName != null" > witness_user_name,</if>
<if test= "laboratoryName != null" > laboratory_name,</if>
2023-08-26 00:36:09 +08:00
<if test= "checkTime != null" > check_time,</if>
<if test= "checkState != null" > check_state,</if>
<if test= "detectionResult != null" > detection_result,</if>
<if test= "detectionFile != null" > detection_file,</if>
2023-09-01 02:28:04 +08:00
<if test= "isDel != null" > is_del,</if>
2023-08-26 00:36:09 +08:00
<if test= "createBy != null" > create_by,</if>
<if test= "createTime != null" > create_time,</if>
<if test= "updateBy != null" > update_by,</if>
<if test= "updateTime != null" > update_time,</if>
<if test= "remark != null" > remark,</if>
2023-09-21 23:17:09 +08:00
<if test= "approveStatus != null" > approve_status,</if>
2024-04-28 00:46:33 +08:00
<if test= "attachment != null" > attachment,</if>
<if test= "trustDeed != null" > trust_deed,</if>
<if test= "specimenPhoto != null" > specimen_photo,</if>
2023-09-01 02:28:04 +08:00
</trim>
2023-08-26 00:36:09 +08:00
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "projectId != null" > #{projectId},</if>
<if test= "deptId != null" > #{deptId},</if>
<if test= "checkType != null" > #{checkType},</if>
2023-09-01 02:28:04 +08:00
<if test= "materialName != null" > #{materialName},</if>
<if test= "usePosition != null" > #{usePosition},</if>
<if test= "sampleNum != null" > #{sampleNum},</if>
<if test= "qualifiedFlag != null" > #{qualifiedFlag},</if>
<if test= "represenNum != null" > #{represenNum},</if>
<if test= "sampleUser != null" > #{sampleUser},</if>
<if test= "sampleUserName != null" > #{sampleUserName},</if>
<if test= "witnessUser != null" > #{witnessUser},</if>
<if test= "witnessUserName != null" > #{witnessUserName},</if>
<if test= "laboratoryName != null" > #{laboratoryName},</if>
2023-08-26 00:36:09 +08:00
<if test= "checkTime != null" > #{checkTime},</if>
<if test= "checkState != null" > #{checkState},</if>
<if test= "detectionResult != null" > #{detectionResult},</if>
<if test= "detectionFile != null" > #{detectionFile},</if>
2023-09-01 02:28:04 +08:00
<if test= "isDel != null" > #{isDel},</if>
2023-08-26 00:36:09 +08:00
<if test= "createBy != null" > #{createBy},</if>
<if test= "createTime != null" > #{createTime},</if>
<if test= "updateBy != null" > #{updateBy},</if>
<if test= "updateTime != null" > #{updateTime},</if>
<if test= "remark != null" > #{remark},</if>
2023-09-21 23:17:09 +08:00
<if test= "approveStatus != null" > #{approveStatus},</if>
2024-04-28 00:46:33 +08:00
<if test= "attachment != null" > #{attachment},</if>
<if test= "trustDeed != null" > #{trustDeed},</if>
<if test= "specimenPhoto != null" > #{specimenPhoto},</if>
2023-09-01 02:28:04 +08:00
</trim>
2023-08-26 00:36:09 +08:00
</insert>
<update id= "updateSurProjectCheckDetection" parameterType= "SurProjectCheckDetection" >
update sur_project_check_detection
<trim prefix= "SET" suffixOverrides= "," >
<if test= "projectId != null" > project_id = #{projectId},</if>
<if test= "deptId != null" > dept_id = #{deptId},</if>
<if test= "checkType != null" > check_type = #{checkType},</if>
2023-09-01 02:28:04 +08:00
<if test= "materialName != null" > material_name = #{materialName},</if>
<if test= "usePosition != null" > use_position = #{usePosition},</if>
<if test= "sampleNum != null" > sample_num = #{sampleNum},</if>
<if test= "qualifiedFlag != null" > qualified_flag = #{qualifiedFlag},</if>
<if test= "represenNum != null" > represen_num = #{represenNum},</if>
<if test= "sampleUser != null" > sample_user = #{sampleUser},</if>
<if test= "sampleUserName != null" > sample_user_name = #{sampleUserName},</if>
<if test= "witnessUser != null" > witness_user = #{witnessUser},</if>
<if test= "witnessUserName != null" > witness_user_name = #{witnessUserName},</if>
<if test= "laboratoryName != null" > laboratory_name = #{laboratoryName},</if>
2023-08-26 00:36:09 +08:00
<if test= "checkTime != null" > check_time = #{checkTime},</if>
<if test= "checkState != null" > check_state = #{checkState},</if>
<if test= "detectionResult != null" > detection_result = #{detectionResult},</if>
<if test= "detectionFile != null" > detection_file = #{detectionFile},</if>
2023-09-01 02:28:04 +08:00
<if test= "isDel != null" > is_del = #{isDel},</if>
2023-08-26 00:36:09 +08:00
<if test= "createBy != null" > create_by = #{createBy},</if>
<if test= "createTime != null" > create_time = #{createTime},</if>
<if test= "updateBy != null" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "remark != null" > remark = #{remark},</if>
2023-09-21 23:17:09 +08:00
<if test= "approveStatus != null" > approve_status = #{approveStatus},</if>
2024-04-28 00:46:33 +08:00
<if test= "attachment != null" > attachment = #{attachment},</if>
<if test= "trustDeed != null" > trust_deed = #{trustDeed},</if>
<if test= "specimenPhoto != null" > specimen_photo = #{specimenPhoto},</if>
2023-08-26 00:36:09 +08:00
</trim>
where id = #{id}
</update>
<delete id= "deleteSurProjectCheckDetectionById" parameterType= "Long" >
delete from sur_project_check_detection where id = #{id}
</delete>
<delete id= "deleteSurProjectCheckDetectionByIds" parameterType= "String" >
2023-09-01 02:28:04 +08:00
delete from sur_project_check_detection where id in
2023-08-26 00:36:09 +08:00
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
2023-09-01 02:28:04 +08:00
2023-08-26 01:22:51 +08:00
<select id= "groupByCheckType" parameterType= "SurProjectCheckDetection" resultMap= "SurProjectCheckDetectionResult" >
SELECT 1 id,COUNT(1) project_id,'送检数' check_type
2024-04-06 01:31:05 +08:00
FROM sur_project_check_detection spcd
left join sur_project sp on sp.id = spcd.project_id
2024-04-06 23:25:16 +08:00
WHERE spcd.is_del='0' and sp.isDel=0 and sp.progressVisible=0
2023-09-03 23:26:50 +08:00
<if test= 'checkType !=null and checkType !="0"' >
2024-04-06 01:31:05 +08:00
and spcd.check_type= #{checkType}
2023-09-03 23:26:50 +08:00
</if>
<if test= "deptId !=null and deptId > 0 " >
2024-04-06 01:31:05 +08:00
and sp.deptId=#{deptId}
2023-08-26 01:22:51 +08:00
</if>
2024-04-06 01:31:05 +08:00
<if test= 'proType != null and proType != "" and proType != "0"' > and sp.projectType = #{proType}</if>
2023-10-11 23:24:45 +08:00
<if test= "prjIds !=null and prjIds.size()>0" >
2024-04-06 01:31:05 +08:00
and spcd.project_id in
2023-10-11 23:24:45 +08:00
<foreach collection= "prjIds" item= "item" index= "index" open= "(" close= ")" separator= "," >
#{item}
</foreach>
</if>
2023-09-03 23:26:50 +08:00
<if test= "projectId !=null and projectId > 0 " >
2024-04-06 01:31:05 +08:00
and spcd.project_id=#{projectId}
2023-08-26 01:22:51 +08:00
</if>
UNION
SELECT 2 id,COUNT(1) project_id,'待检数' check_type
2024-04-06 01:31:05 +08:00
FROM sur_project_check_detection spcd
left join sur_project sp on sp.id = spcd.project_id
WHERE spcd.check_state='1'
and spcd.is_del='0'
2023-09-03 23:26:50 +08:00
<if test= 'checkType !=null and checkType !="0"' >
2024-04-06 01:31:05 +08:00
and spcd.check_type= #{checkType}
2023-09-03 23:26:50 +08:00
</if>
<if test= "deptId !=null and deptId > 0 " >
2024-04-06 01:31:05 +08:00
and sp.deptId=#{deptId}
2023-08-26 01:22:51 +08:00
</if>
2024-04-06 01:31:05 +08:00
<if test= 'proType != null and proType != "" and proType != "0"' > and sp.projectType = #{proType}</if>
2023-10-11 23:24:45 +08:00
<if test= "prjIds !=null and prjIds.size()>0" >
2024-04-06 01:31:05 +08:00
and spcd.project_id in
2023-10-11 23:24:45 +08:00
<foreach collection= "prjIds" item= "item" index= "index" open= "(" close= ")" separator= "," >
#{item}
</foreach>
</if>
2023-09-03 23:26:50 +08:00
<if test= "projectId !=null and projectId > 0 " >
2024-04-06 01:31:05 +08:00
and spcd.project_id=#{projectId}
2023-08-26 01:22:51 +08:00
</if>
UNION
SELECT 3 id,COUNT(1) project_id,'合格数' check_type
2024-04-06 01:31:05 +08:00
FROM sur_project_check_detection spcd
left join sur_project sp on sp.id = spcd.project_id
WHERE spcd.detection_result='1'
and spcd.is_del='0'
2023-09-03 23:26:50 +08:00
<if test= 'checkType !=null and checkType !="0"' >
2024-04-06 01:31:05 +08:00
and spcd.check_type= #{checkType}
2023-09-03 23:26:50 +08:00
</if>
<if test= "deptId !=null and deptId > 0 " >
2024-04-06 01:31:05 +08:00
and sp.deptId=#{deptId}
2023-08-26 01:22:51 +08:00
</if>
2024-04-06 01:31:05 +08:00
<if test= 'proType != null and proType != "" and proType != "0"' > and sp.projectType = #{proType}</if>
2023-10-11 23:24:45 +08:00
<if test= "prjIds !=null and prjIds.size()>0" >
2024-04-06 01:31:05 +08:00
and spcd.project_id in
2023-10-11 23:24:45 +08:00
<foreach collection= "prjIds" item= "item" index= "index" open= "(" close= ")" separator= "," >
#{item}
</foreach>
</if>
2023-09-03 23:26:50 +08:00
<if test= "projectId !=null and projectId > 0 " >
2024-04-06 01:31:05 +08:00
and spcd.project_id=#{projectId}
2023-08-26 01:22:51 +08:00
</if>
</select>
2023-09-16 00:09:12 +08:00
<select id= "getList" parameterType= "SurProjectCheckDetection" resultMap= "SurProjectCheckDetectionResult" >
<include refid= "selectSurProjectCheckDetectionVo" />
2024-05-09 22:02:20 +08:00
WHERE spcd.is_del=0 and sp.isDel=0 and sp.progressVisible=0
2024-05-09 00:26:18 +08:00
<if test= "detectionResult==1" > and spcd.detection_result=1</if>
<if test= "detectionResult==0" > and spcd.detection_result < > 1</if>
2024-04-06 01:31:05 +08:00
<if test= "checkType!=null and checkType>0" > and spcd.check_type= #{checkType}</if>
2023-09-16 00:09:12 +08:00
<if test= "deptId !=null and deptId > 0 " >
2024-04-06 01:31:05 +08:00
and sp.deptId=#{deptId}
2023-09-16 00:09:12 +08:00
</if>
2024-04-06 01:31:05 +08:00
<if test= 'proType != null and proType != "" and proType != "0"' > and sp.projectType = #{proType}</if>
2023-10-11 23:24:45 +08:00
<if test= "prjIds !=null and prjIds.size()>0" >
and spcd.project_id in
<foreach collection= "prjIds" item= "item" index= "index" open= "(" close= ")" separator= "," >
#{item}
</foreach>
</if>
2023-09-16 00:09:12 +08:00
<if test= "projectId !=null and projectId > 0 " >
and spcd.project_id=#{projectId}
</if>
2024-05-09 22:02:20 +08:00
ORDER BY detection_result
</select>
<select id= "groupCheckType" parameterType= "SurProjectCheckDetection" resultMap= "SurProjectCheckDetectionResult" >
SELECT spcd.check_type id,count(1) project_id
FROM sur_project_check_detection spcd
LEFT JOIN sur_project sp ON spcd.project_id = sp.id
where spcd.is_del=0 and sp.isDel=0 and sp.progressVisible=0
<if test= "deptId !=null and deptId > 0 " >
and sp.deptId=#{deptId}
</if>
<if test= 'proType != null and proType != "" and proType != "0"' > and sp.projectType = #{proType}</if>
<if test= "prjIds !=null and prjIds.size()>0" >
and spcd.project_id in
<foreach collection= "prjIds" item= "item" index= "index" open= "(" close= ")" separator= "," >
#{item}
</foreach>
</if>
<if test= "projectId !=null and projectId > 0 " >
and spcd.project_id=#{projectId}
</if>
group by spcd.check_type
2023-09-16 00:09:12 +08:00
</select>
2023-08-26 00:36:09 +08:00
</mapper>