2276 lines
76 KiB
XML
Executable File
2276 lines
76 KiB
XML
Executable File
<?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.cm.systemcity.dao.reportcase.IReportCaseDao">
|
||
|
||
<resultMap id="reportCaseDTO" type="com.cm.systemcity.pojo.dtos.reportcase.ReportCaseDTO">
|
||
<id property="reportCaseId" column="report_case_id"/>
|
||
<result property="caseNumber" column="case_number"/>
|
||
<result property="areaId" column="area_id"/>
|
||
<result property="areaName" column="area_name"/>
|
||
<result property="casePhotos" column="case_photos"/>
|
||
<result property="caseAudio" column="case_audio"/>
|
||
<result property="communityId" column="community_id"/>
|
||
<result property="communityName" column="community_name"/>
|
||
<result property="caseSource" column="case_source"/>
|
||
<result property="caseStatus" column="case_status"/>
|
||
<result property="caseTypeId" column="case_type_id"/>
|
||
<result property="caseTypeName" column="case_type_name"/>
|
||
<result property="caseContent" column="case_content"/>
|
||
<result property="caseLongitude" column="case_longitude"/>
|
||
<result property="caseLatitude" column="case_latitude"/>
|
||
<result property="casePosition" column="case_position"/>
|
||
<result property="isAccept" column="is_accept"/>
|
||
<result property="isDeny" column="is_deny"/>
|
||
<result property="isSelf" column="is_self"/>
|
||
<result property="caseFlowType" column="case_flow_type"/>
|
||
<result property="caseFlowForward" column="case_flow_forward"/>
|
||
<result property="grade" column="grade"/>
|
||
<result property="reportDate" column="gmt_create"/>
|
||
<result property="caseReporter" column="case_reporter"/>
|
||
<result property="readTime" column="read_time"/>
|
||
<result property="gmtModified" column="gmt_modified"/>
|
||
<result property="handleUserDepartmentName" column="handle_user_department_name"/>
|
||
<result property="handleUserCommunityName" column="handle_user_community_name"/>
|
||
<result property="handleUserUsername" column="handle_user_username"/>
|
||
<result property="handleUserName" column="handle_user_name"/>
|
||
</resultMap>
|
||
|
||
<resultMap id="reportCaseRegisterDTO" type="com.cm.systemcity.pojo.dtos.reportcase.ReportCaseRegisterDTO" extends="reportCaseDTO">
|
||
<result property="communityBossId" column="community_boss_id"/>
|
||
<result property="communityBossName" column="community_boss_name"/>
|
||
<result property="acceptUserName" column="accept_user_name"/>
|
||
<result property="acceptDate" column="accept_date"/>
|
||
</resultMap>
|
||
|
||
<resultMap id="reportCaseAssignDTO" type="com.cm.systemcity.pojo.dtos.reportcase.ReportCaseAssignDTO" extends="reportCaseDTO">
|
||
<result property="registerUserName" column="register_user_name"/>
|
||
<result property="registerDate" column="register_date"/>
|
||
</resultMap>
|
||
|
||
<resultMap id="reportCaseHandleDTO" type="com.cm.systemcity.pojo.dtos.reportcase.ReportCaseHandleDTO" extends="reportCaseDTO">
|
||
<result property="caseId" column="case_id"/>
|
||
<result property="handleUserId" column="handle_user_id"/>
|
||
<result property="handleUserName" column="handle_user_name"/>
|
||
<result property="handleTime" column="handle_time"/>
|
||
<result property="assignDate" column="assign_date"/>
|
||
</resultMap>
|
||
|
||
<resultMap id="reportCaseInspectDTO" type="com.cm.systemcity.pojo.dtos.reportcase.ReportCaseInspectDTO" extends="reportCaseDTO">
|
||
<result property="handleUserId" column="handle_user_id"/>
|
||
<result property="handleUserName" column="handle_user_name"/>
|
||
<result property="handleTime" column="handle_time"/>
|
||
<result property="handleTimeout" column="handle_timeout"/>
|
||
<result property="handleOpinion" column="handle_opinion"/>
|
||
<result property="handlePhotos" column="handle_photos"/>
|
||
<result property="handleDate" column="handle_date"/>
|
||
</resultMap>
|
||
|
||
<resultMap id="reportCaseCloseDTO" type="com.cm.systemcity.pojo.dtos.reportcase.ReportCaseCloseDTO" extends="reportCaseDTO">
|
||
<result property="handleUserId" column="inspect_user_id"/>
|
||
<result property="handleUserName" column="handle_user_name"/>
|
||
<result property="handleTime" column="handle_time"/>
|
||
<result property="handleTimeout" column="handle_timeout"/>
|
||
<result property="handleOpinion" column="handle_opinion"/>
|
||
<result property="handlePhotos" column="handle_photos"/>
|
||
<result property="handleDate" column="handle_date"/>
|
||
<result property="inspectUserId" column="inspect_user_id"/>
|
||
<result property="inspectUserName" column="inspect_user_name"/>
|
||
<result property="inspectPhotos" column="inspect_photos"/>
|
||
<result property="inspectOpinion" column="inspect_opinion"/>
|
||
<result property="isPass" column="is_pass"/>
|
||
<result property="inspectDate" column="inspect_date"/>
|
||
</resultMap>
|
||
|
||
<resultMap id="reportCaseLogDTO" type="com.cm.systemcity.pojo.dtos.reportcase.ReportCaseLogDTO">
|
||
<result property="caseId" column="case_id"/>
|
||
<result property="optionType" column="option_type"/>
|
||
<result property="userId" column="user_id"/>
|
||
<result property="userName" column="user_name"/>
|
||
<result property="userPhone" column="user_phone"/>
|
||
<result property="userOpinion" column="user_opinion"/>
|
||
<result property="userPhotos" column="user_photos"/>
|
||
<result property="userAudio" column="user_audio"/>
|
||
<result property="handleUserId" column="handle_user_id"/>
|
||
<result property="handleUserName" column="handle_user_name"/>
|
||
<result property="handleTime" column="handle_time"/>
|
||
<result property="handleStatus" column="handle_status"/>
|
||
<result property="gmtCreate" column="gmt_create"/>
|
||
</resultMap>
|
||
|
||
<resultMap id="caseStatisticDTO" type="com.cm.systemcity.pojo.dtos.reportcase.CaseStatisticDTO">
|
||
<result property="areaId" column="area_id"/>
|
||
<result property="areaName" column="area_name"/>
|
||
<result property="communityId" column="community_id"/>
|
||
<result property="communityName" column="community_name"/>
|
||
<result property="caseTotalCount" column="counts"/>
|
||
</resultMap>
|
||
|
||
<resultMap id="handleDepartmentDTO" type="com.cm.systemcity.pojo.dtos.reportcase.HandleDepartmentDTO">
|
||
<id property="departmentId" column="department_id"/>
|
||
<result property="departmentName" column="department_name"/>
|
||
</resultMap>
|
||
|
||
<select id="listPageReportDelete" parameterType="map" resultMap="reportCaseDTO">
|
||
SELECT
|
||
t1.report_case_id,
|
||
t1.case_number,
|
||
t1.area_id,
|
||
t1.area_name,
|
||
t1.case_photos,
|
||
t1.case_audio,
|
||
t1.community_id,
|
||
t1.community_name,
|
||
t1.case_source,
|
||
t1.case_status,
|
||
t1.case_type_id,
|
||
t1.case_type_name,
|
||
t1.case_content,
|
||
t1.case_longitude,
|
||
t1.case_latitude,
|
||
t1.case_position,
|
||
t1.grade,
|
||
t1.is_accept,
|
||
t1.is_self,
|
||
t1.case_reporter,
|
||
t1.creator,
|
||
LEFT(t1.gmt_create, 19) gmt_create,
|
||
LEFT(t1.gmt_modified, 19) gmt_modified,
|
||
t2.handle_user_name,
|
||
t3.user_username handle_user_username
|
||
FROM
|
||
city_report_case t1
|
||
LEFT JOIN
|
||
city_report_case_handle t2
|
||
ON
|
||
t1.report_case_id = t2.case_id
|
||
LEFT JOIN
|
||
sys_user t3
|
||
ON
|
||
t2.creator = t3.user_id
|
||
WHERE
|
||
t1.is_delete = 1
|
||
<if test="caseNumber != null and caseNumber != ''">
|
||
AND t1.case_number = #{caseNumber}
|
||
</if>
|
||
<if test="areaId != null and areaId != ''">
|
||
AND t1.area_id = #{areaId}
|
||
</if>
|
||
<if test="communityId != null and communityId != ''">
|
||
AND t1.community_id = #{communityId}
|
||
</if>
|
||
<if test="caseTypeId != null and caseTypeId != ''">
|
||
AND t1.case_type_id IN (
|
||
SELECT
|
||
cd.dict_id
|
||
FROM
|
||
city_dict cd
|
||
WHERE
|
||
cd.is_delete = 0
|
||
AND (
|
||
dict_id = #{caseTypeId}
|
||
OR
|
||
dict_parent_id = #{caseTypeId}
|
||
)
|
||
)
|
||
</if>
|
||
<if test="caseStatus != null">
|
||
AND t1.case_status = #{caseStatus}
|
||
</if>
|
||
<if test="caseStatusNot != null">
|
||
AND t1.case_status != #{caseStatus}
|
||
</if>
|
||
<if test="startTime != null and startTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||
</if>
|
||
<if test="endTime != null and endTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||
</if>
|
||
<!-- 专管员(N员)区域(上报的)案件 -->
|
||
<!-- <if test="isNPersonArea != null and isNPersonArea == 'true'">-->
|
||
<!-- AND-->
|
||
<!-- t1.creator IN (-->
|
||
<!-- SELECT-->
|
||
<!-- user_id-->
|
||
<!-- FROM-->
|
||
<!-- sys_role_user-->
|
||
<!-- WHERE-->
|
||
<!-- <!– 专管员角色ID –>-->
|
||
<!-- role_id = 'bc405346-8714-4ded-89ac-9cc4d755f66a'-->
|
||
<!-- )-->
|
||
<!-- </if>-->
|
||
<if test="isNPersonArea != null and isNPersonArea == 'true'">
|
||
AND
|
||
t1.report_case_id IN (
|
||
SELECT
|
||
st1.case_id
|
||
FROM
|
||
city_report_case_assign st1
|
||
WHERE
|
||
st1.is_delete = 0
|
||
AND
|
||
st1.handle_user_id IN (
|
||
SELECT
|
||
sst1.user_id
|
||
FROM
|
||
sys_department_user sst1
|
||
)
|
||
)
|
||
</if>
|
||
<if test="departmentId != null and departmentId != ''">
|
||
AND
|
||
t1.report_case_id IN (
|
||
SELECT
|
||
st1.case_id
|
||
FROM
|
||
city_report_case_assign st1
|
||
WHERE
|
||
st1.is_delete = 0
|
||
AND
|
||
st1.handle_user_id IN (
|
||
SELECT
|
||
sst1.user_id
|
||
FROM
|
||
sys_department_user sst1
|
||
WHERE
|
||
sst1.department_id = #{departmentId}
|
||
)
|
||
)
|
||
</if>
|
||
ORDER BY t1.gmt_modified DESC
|
||
</select>
|
||
|
||
<!-- 新增上报案件 -->
|
||
<insert id="saveReportCase" parameterType="map">
|
||
INSERT INTO city_report_case(
|
||
report_case_id,
|
||
case_number,
|
||
area_id,
|
||
area_name,
|
||
case_photos,
|
||
case_audio,
|
||
community_id,
|
||
community_name,
|
||
case_source,
|
||
case_status,
|
||
case_type_id,
|
||
case_type_name,
|
||
case_content,
|
||
case_longitude,
|
||
case_latitude,
|
||
case_position,
|
||
is_accept,
|
||
is_deny,
|
||
is_self,
|
||
case_flow_type,
|
||
case_flow_forward,
|
||
case_reporter,
|
||
creator,
|
||
gmt_create,
|
||
modifier,
|
||
gmt_modified,
|
||
is_delete
|
||
) VALUES(
|
||
#{reportCaseId},
|
||
#{caseNumber},
|
||
#{areaId},
|
||
#{areaName},
|
||
#{casePhotos},
|
||
#{caseAudio},
|
||
#{communityId},
|
||
#{communityName},
|
||
#{caseSource},
|
||
#{caseStatus},
|
||
#{caseTypeId},
|
||
#{caseTypeName},
|
||
#{caseContent},
|
||
#{caseLongitude},
|
||
#{caseLatitude},
|
||
#{casePosition},
|
||
#{isAccept},
|
||
#{isDeny},
|
||
#{isSelf},
|
||
#{caseFlowType},
|
||
#{caseFlowForward},
|
||
#{caseReporter},
|
||
#{creator},
|
||
#{gmtCreate},
|
||
#{modifier},
|
||
#{gmtModified},
|
||
#{isDelete}
|
||
)
|
||
</insert>
|
||
|
||
<!-- 删除上报案件 -->
|
||
<update id="removeReportCase" parameterType="map">
|
||
UPDATE
|
||
city_report_case
|
||
SET
|
||
is_delete = 1,
|
||
modifier = #{modifier},
|
||
gmt_modified = #{gmtModified}
|
||
WHERE
|
||
report_case_id IN
|
||
<foreach collection="reportCaseIds" index="index" open="(" separator="," close=")">
|
||
#{reportCaseIds[${index}]}
|
||
</foreach>
|
||
</update>
|
||
|
||
<!-- 删除上报案件 -->
|
||
<update id="removeToDisputedCases" parameterType="map">
|
||
UPDATE
|
||
city_report_case
|
||
SET
|
||
is_delete = 1,
|
||
case_status = #{caseStatus},
|
||
modifier = #{modifier},
|
||
gmt_modified = #{gmtModified}
|
||
WHERE
|
||
report_case_id IN
|
||
<foreach collection="reportCaseIds" index="index" open="(" separator="," close=")">
|
||
#{reportCaseIds[${index}]}
|
||
</foreach>
|
||
</update>
|
||
|
||
<!-- 修改上报案件 -->
|
||
<update id="updateReportCase" parameterType="map">
|
||
UPDATE
|
||
city_report_case
|
||
SET
|
||
<if test="caseNumber != null">
|
||
case_number = #{caseNumber},
|
||
</if>
|
||
<if test="areaId != null and areaId != ''">
|
||
area_id = #{areaId},
|
||
</if>
|
||
<if test="areaName != null and areaName != ''">
|
||
area_name = #{areaName},
|
||
</if>
|
||
<if test="casePhotos != null and casePhotos != ''">
|
||
case_photos = #{casePhotos},
|
||
</if>
|
||
<if test="caseAudio != null and caseAudio != ''">
|
||
case_audio = #{caseAudio},
|
||
</if>
|
||
<if test="communityId != null and communityId != ''">
|
||
community_id = #{communityId},
|
||
</if>
|
||
<if test="communityName != null and communityName != ''">
|
||
community_name = #{communityName},
|
||
</if>
|
||
<if test="caseSource != null and caseSource != ''">
|
||
case_source = #{caseSource},
|
||
</if>
|
||
<if test="caseStatus != null and caseStatus != ''">
|
||
case_status = #{caseStatus},
|
||
</if>
|
||
<if test="caseTypeId != null and caseTypeId != ''">
|
||
case_type_id = #{caseTypeId},
|
||
</if>
|
||
<if test="caseTypeName != null and caseTypeName != ''">
|
||
case_type_name = #{caseTypeName},
|
||
</if>
|
||
<if test="caseContent != null and caseContent != ''">
|
||
case_content = #{caseContent},
|
||
</if>
|
||
<if test="caseLongitude != null and caseLongitude != ''">
|
||
case_longitude = #{caseLongitude},
|
||
</if>
|
||
<if test="caseLatitude != null and caseLatitude != ''">
|
||
case_latitude = #{caseLatitude},
|
||
</if>
|
||
<if test="casePosition != null and casePosition != ''">
|
||
case_position = #{casePosition},
|
||
</if>
|
||
<if test="isAccept != null">
|
||
is_accept = #{isAccept},
|
||
</if>
|
||
<if test="isDeny != null">
|
||
is_deny = #{isDeny},
|
||
</if>
|
||
<if test="isSelf != null">
|
||
is_self = #{isSelf},
|
||
</if>
|
||
/*添加检查后案件得分*/
|
||
<if test="grade != null and grade !=''">
|
||
grade = #{grade},
|
||
</if>
|
||
<if test="caseReport != null">
|
||
case_report = #{caseReport},
|
||
</if>
|
||
<if test="caseFlowType != null and caseFlowType != ''">
|
||
case_flow_type = #{caseFlowType},
|
||
</if>
|
||
<if test="isDelete != null and isDelete != ''">
|
||
is_delete = #{isDelete},
|
||
</if>
|
||
modifier = #{modifier},
|
||
gmt_modified = #{gmtModified}
|
||
WHERE
|
||
report_case_id = #{reportCaseId}
|
||
</update>
|
||
|
||
<!-- 上报案件列表 -->
|
||
<select id="listReportCase" parameterType="map" resultMap="reportCaseDTO">
|
||
SELECT
|
||
t1.report_case_id,
|
||
t1.case_number,
|
||
t1.area_id,
|
||
t1.area_name,
|
||
t1.case_photos,
|
||
t1.case_audio,
|
||
t1.community_id,
|
||
t1.community_name,
|
||
t1.case_source,
|
||
t1.case_status,
|
||
t1.case_type_id,
|
||
t1.case_type_name,
|
||
t1.case_content,
|
||
t1.case_longitude,
|
||
t1.case_latitude,
|
||
t1.case_position,
|
||
t1.grade,
|
||
t1.is_accept,
|
||
t1.is_deny,
|
||
t1.is_self,
|
||
t1.case_flow_type,
|
||
t1.case_flow_forward,
|
||
t1.case_reporter,
|
||
t1.creator,
|
||
LEFT(t1.gmt_create, 19) gmt_create
|
||
FROM
|
||
city_report_case t1
|
||
LEFT JOIN city_report_case_assign t2 ON t1.report_case_id = t2.case_id
|
||
WHERE
|
||
t1.is_delete = 0
|
||
<if test="caseFlowType != null and caseFlowType != ''">
|
||
AND FIND_IN_SET(t1.case_flow_type, #{caseFlowType})
|
||
</if>
|
||
<if test="caseNumber != null and caseNumber != ''">
|
||
AND t1.case_number = #{caseNumber}
|
||
</if>
|
||
<if test="areaId != null and areaId != ''">
|
||
AND t1.area_id = #{areaId}
|
||
</if>
|
||
<if test="communityId != null and communityId != ''">
|
||
AND t1.community_id = #{communityId}
|
||
</if>
|
||
<if test="reporterId != null and reporterId != ''">
|
||
AND t1.creator = #{reporterId}
|
||
</if>
|
||
<if test="reporterIds != null and reporterIds.size > 0">
|
||
AND t1.creator IN
|
||
<foreach collection="reporterIds" index="index" open="(" separator="," close=")">
|
||
#{reporterIds[${index}]}
|
||
</foreach>
|
||
</if>
|
||
<if test="caseTypeId != null and caseTypeId != ''">
|
||
AND t1.case_type_id = #{caseTypeId}
|
||
</if>
|
||
<if test="caseStatus != null and caseStatus != ''">
|
||
AND FIND_IN_SET(t1.case_status, #{caseStatus})
|
||
</if>
|
||
<if test="isAccept != null and isAccept != ''">
|
||
AND t1.is_accept = #{isAccept}
|
||
</if>
|
||
<if test="startTime != null and startTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||
</if>
|
||
<if test="endTime != null and endTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||
</if>
|
||
<if test="reportCaseIds != null and reportCaseIds.size > 0">
|
||
AND t1.report_case_id IN
|
||
<foreach collection="reportCaseIds" index="index" open="(" separator="," close=")">
|
||
#{reportCaseIds[${index}]}
|
||
</foreach>
|
||
</if>
|
||
<if test="isException != null and isException == 'true'">
|
||
AND t1.case_status <![CDATA[ < ]]> 0
|
||
</if>
|
||
<!-- 职能部门案件 -->
|
||
<if test="deptCase != null and deptCase !=''">
|
||
AND (
|
||
t1.case_flow_forward = '0'
|
||
)
|
||
</if>
|
||
<!-- 镇街案件 -->
|
||
<if test="streetCase != null and streetCase !=''">
|
||
AND (t1.case_flow_type = '2' OR t1.case_flow_forward = '1')
|
||
</if>
|
||
<if test="userId != null and userId != ''">
|
||
AND (
|
||
t1.creator = #{userId}
|
||
OR
|
||
FIND_IN_SET( #{userId}, t2.handle_user_id)
|
||
)
|
||
</if>
|
||
<!-- 专管员(N员)区域(上报的)案件 -->
|
||
<!-- <if test="isNPersonArea != null and isNPersonArea == 'true'">-->
|
||
<!-- AND-->
|
||
<!-- t1.creator IN (-->
|
||
<!-- SELECT-->
|
||
<!-- user_id-->
|
||
<!-- FROM-->
|
||
<!-- sys_role_user-->
|
||
<!-- WHERE-->
|
||
<!-- <!– 专管员角色ID –>-->
|
||
<!-- role_id = 'bc405346-8714-4ded-89ac-9cc4d755f66a'-->
|
||
<!-- )-->
|
||
<!-- </if>-->
|
||
<!-- 专管员处理的案件 -->
|
||
<if test="isNPersonArea != null and isNPersonArea == 'true'">
|
||
AND
|
||
t1.report_case_id IN (
|
||
SELECT
|
||
st1.case_id
|
||
FROM
|
||
city_report_case_assign st1
|
||
WHERE
|
||
st1.is_delete = 0
|
||
AND
|
||
st1.handle_user_id IN (
|
||
SELECT
|
||
sst1.user_id
|
||
FROM
|
||
sys_department_user sst1
|
||
INNER JOIN
|
||
sys_role_user sst2
|
||
ON
|
||
sst1.user_id = sst2.user_id
|
||
AND
|
||
sst2.role_id = 'bc405346-8714-4ded-89ac-9cc4d755f66a'
|
||
)
|
||
)
|
||
</if>
|
||
<if test="handleDepartmentId != null and handleDepartmentId != ''">
|
||
AND
|
||
t1.report_case_id IN (
|
||
SELECT
|
||
st1.case_id
|
||
FROM
|
||
city_report_case_assign st1
|
||
WHERE
|
||
st1.is_delete = 0
|
||
AND
|
||
st1.handle_user_id IN (
|
||
SELECT
|
||
sst1.user_id
|
||
FROM
|
||
sys_department_user sst1
|
||
WHERE
|
||
sst1.department_id = #{handleDepartmentId}
|
||
)
|
||
)
|
||
</if>
|
||
<if test="departmentId != null and departmentId != ''">
|
||
AND (
|
||
t1.creator IN (
|
||
SELECT
|
||
sdu.user_id
|
||
FROM
|
||
sys_department_user sdu
|
||
INNER JOIN
|
||
sys_user su
|
||
ON
|
||
sdu.user_id = su.user_id
|
||
AND
|
||
su.is_delete = 0
|
||
INNER JOIN
|
||
sys_department sd
|
||
ON
|
||
sdu.department_id = sd.department_id
|
||
WHERE
|
||
sdu.department_id = #{departmentId}
|
||
)
|
||
OR
|
||
t1.report_case_id IN (
|
||
SELECT
|
||
st1.case_id
|
||
FROM
|
||
city_report_case_assign st1
|
||
WHERE
|
||
st1.is_delete = 0
|
||
AND
|
||
st1.handle_user_id IN (
|
||
SELECT
|
||
sst1.user_id
|
||
FROM
|
||
sys_department_user sst1
|
||
WHERE
|
||
sst1.department_id = #{departmentId}
|
||
)
|
||
)
|
||
)
|
||
</if>
|
||
ORDER BY t1.gmt_create DESC
|
||
</select>
|
||
|
||
<!-- 上报案件详情 -->
|
||
<select id="getReportCase" parameterType="map" resultMap="reportCaseDTO">
|
||
SELECT
|
||
t1.*
|
||
FROM
|
||
city_report_case t1
|
||
WHERE
|
||
t1.is_delete = 0
|
||
<if test="reportCaseId != null and reportCaseId != ''">
|
||
AND t1.report_case_id = #{reportCaseId}
|
||
</if>
|
||
<if test="caseNumber != null and caseNumber != ''">
|
||
AND t1.case_number = #{caseNumber}
|
||
</if>
|
||
</select>
|
||
|
||
<select id="getReportCaseForDel" parameterType="map" resultMap="reportCaseDTO">
|
||
SELECT
|
||
t1.*
|
||
FROM
|
||
city_report_case t1
|
||
WHERE
|
||
t1.report_case_id = #{reportCaseId}
|
||
LIMIT 1
|
||
</select>
|
||
|
||
<!-- 新增上报案件受理信息 -->
|
||
<insert id="saveReportCaseAccept" parameterType="map">
|
||
INSERT INTO city_report_case_accept(
|
||
case_id,
|
||
community_boss_id,
|
||
community_boss_name,
|
||
accept_status,
|
||
accept_opinion,
|
||
accept_user_name,
|
||
is_register,
|
||
creator,
|
||
gmt_create,
|
||
modifier,
|
||
gmt_modified,
|
||
is_delete
|
||
) VALUES(
|
||
#{caseId},
|
||
#{communityBossId},
|
||
#{communityBossName},
|
||
#{acceptStatus},
|
||
#{acceptOpinion},
|
||
#{acceptUserName},
|
||
#{isRegister},
|
||
#{creator},
|
||
#{gmtCreate},
|
||
#{modifier},
|
||
#{gmtModified},
|
||
#{isDelete}
|
||
)
|
||
</insert>
|
||
|
||
<!-- 修改上报案件受理信息 -->
|
||
<update id="updateReportCaseAccept" parameterType="map">
|
||
UPDATE
|
||
city_report_case_accept
|
||
SET
|
||
<if test="communityBossId != null and communityBossId != ''">
|
||
community_boss_id = #{communityBossId},
|
||
</if>
|
||
<if test="communityBossName != null and communityBossName != ''">
|
||
community_boss_name = #{communityBossName},
|
||
</if>
|
||
<if test="acceptStatus != null and acceptStatus != ''">
|
||
accept_status = #{acceptStatus},
|
||
</if>
|
||
<if test="acceptOpinion != null and acceptOpinion != ''">
|
||
accept_opinion = #{acceptOpinion},
|
||
</if>
|
||
<if test="acceptUserName != null and acceptUserName != ''">
|
||
accept_user_name = #{acceptUserName},
|
||
</if>
|
||
<if test="isRegister != null">
|
||
is_register = #{isRegister},
|
||
</if>
|
||
modifier = #{modifier},
|
||
gmt_modified = #{gmtModified}
|
||
WHERE
|
||
case_id = #{caseId}
|
||
</update>
|
||
|
||
<!-- 新增案件立案信息 -->
|
||
<insert id="saveReportCaseRegister" parameterType="map">
|
||
INSERT INTO city_report_case_register(
|
||
case_id,
|
||
register_opinion,
|
||
register_user_name,
|
||
is_assign,
|
||
creator,
|
||
gmt_create,
|
||
modifier,
|
||
gmt_modified,
|
||
is_delete
|
||
) VALUES(
|
||
#{caseId},
|
||
#{registerOpinion},
|
||
#{registerUserName},
|
||
#{isAssign},
|
||
#{creator},
|
||
#{gmtCreate},
|
||
#{modifier},
|
||
#{gmtModified},
|
||
#{isDelete}
|
||
)
|
||
</insert>
|
||
|
||
<!-- 修改案件立案信息 -->
|
||
<update id="updateReportCaseRegister" parameterType="map">
|
||
UPDATE
|
||
city_report_case_register
|
||
SET
|
||
<if test="registerOpinion != null and registerOpinion != ''">
|
||
register_opinion = #{registerOpinion},
|
||
</if>
|
||
<if test="registerUserName != null and registerUserName != ''">
|
||
register_user_name = #{registerUserName},
|
||
</if>
|
||
<if test="isAssign != null and isAssign != ''">
|
||
is_assign = #{isAssign},
|
||
</if>
|
||
modifier = #{modifier},
|
||
gmt_modified = #{gmtModified}
|
||
WHERE
|
||
case_id = #{caseId}
|
||
</update>
|
||
|
||
<!-- 新增案件下派信息 -->
|
||
<insert id="saveReportCaseAssign" parameterType="map">
|
||
INSERT INTO city_report_case_assign(
|
||
case_id,
|
||
handle_user_type,
|
||
handle_user_id,
|
||
handle_user_name,
|
||
handle_time,
|
||
assign_opinion,
|
||
assign_user_name,
|
||
is_handle,
|
||
creator,
|
||
gmt_create,
|
||
modifier,
|
||
gmt_modified,
|
||
is_delete
|
||
) VALUE(
|
||
#{caseId},
|
||
#{handleUserType},
|
||
#{handleUserId},
|
||
#{handleUserName},
|
||
#{handleTime},
|
||
#{assignOpinion},
|
||
#{assignUserName},
|
||
#{isHandle},
|
||
#{creator},
|
||
#{gmtCreate},
|
||
#{modifier},
|
||
#{gmtModified},
|
||
#{isDelete}
|
||
)
|
||
</insert>
|
||
|
||
<!-- 修改案件下派状态 -->
|
||
<update id="updateReportCaseAssign" parameterType="map">
|
||
UPDATE
|
||
city_report_case_assign
|
||
SET
|
||
<if test="handleUserType != null">
|
||
handle_user_type = #{handleUserType},
|
||
</if>
|
||
<if test="handleUserId != null and handleUserId != ''">
|
||
handle_user_id = #{handleUserId},
|
||
</if>
|
||
<if test="handleUserName != null and handleUserName != ''">
|
||
handle_user_name = #{handleUserName},
|
||
</if>
|
||
<if test="assignOpinion != null and assignOpinion != ''">
|
||
assign_opinion = #{assignOpinion},
|
||
</if>
|
||
<if test="assignUserName != null and assignUserName != ''">
|
||
assign_user_name = #{assignUserName},
|
||
</if>
|
||
<if test="isHandle != null">
|
||
is_handle = #{isHandle},
|
||
</if>
|
||
modifier = #{modifier},
|
||
gmt_modified = #{gmtModified}
|
||
WHERE
|
||
case_id = #{caseId}
|
||
</update>
|
||
|
||
<select id="countReportCaseAssign" parameterType="map" resultType="java.lang.Integer">
|
||
SELECT
|
||
COUNT(*)
|
||
FROM
|
||
city_report_case_assign
|
||
WHERE
|
||
is_delete = 0
|
||
AND
|
||
case_id = #{caseId}
|
||
</select>
|
||
|
||
|
||
<!-- 案件待受理列表 -->
|
||
<select id="listPageReportCaseRegister" parameterType="map" resultMap="reportCaseRegisterDTO">
|
||
SELECT
|
||
t1.report_case_id,
|
||
t1.case_number,
|
||
t1.area_id,
|
||
t1.area_name,
|
||
t1.case_photos,
|
||
t1.case_audio,
|
||
t1.community_id,
|
||
t1.community_name,
|
||
t1.case_source,
|
||
t1.case_status,
|
||
t1.case_type_id,
|
||
t1.case_type_name,
|
||
t1.case_content,
|
||
t1.case_longitude,
|
||
t1.case_latitude,
|
||
t1.case_position,
|
||
t1.grade,
|
||
t1.is_accept,
|
||
t1.is_deny,
|
||
t1.is_self,
|
||
t1.case_reporter,
|
||
t1.creator,
|
||
LEFT(t1.gmt_create, 19) gmt_create,
|
||
t2.community_boss_id,
|
||
t2.community_boss_name,
|
||
t2.accept_user_name,
|
||
LEFT(t2.gmt_create, 19) accept_date
|
||
FROM
|
||
city_report_case t1
|
||
INNER JOIN
|
||
city_report_case_accept t2
|
||
ON
|
||
t1.report_case_id = t2.case_id
|
||
AND
|
||
t2.is_delete = 0
|
||
WHERE
|
||
t1.is_delete = 0
|
||
AND
|
||
t1.case_status = 1
|
||
<if test="areaId != null and areaId != ''">
|
||
AND
|
||
t1.area_id = #{areaId}
|
||
</if>
|
||
<if test="caseTypeId != null and caseTypeId != ''">
|
||
AND
|
||
t1.case_type_id = #{caseTypeId}
|
||
</if>
|
||
<if test="caseStatus != null and caseStatus != ''">
|
||
AND
|
||
t1.case_status = #{caseStatus}
|
||
</if>
|
||
<if test="isAccept != null and isAccept != ''">
|
||
AND
|
||
t1.is_accept = #{isAccept}
|
||
</if>
|
||
<if test="startTime != null and startTime != ''">
|
||
AND
|
||
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||
</if>
|
||
<if test="endTime != null and endTime != ''">
|
||
AND
|
||
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||
</if>
|
||
<if test="reportCaseIds != null and reportCaseIds.size > 0">
|
||
AND
|
||
t1.report_case_id IN
|
||
<foreach collection="reportCaseIds" index="index" open="(" separator="," close=")">
|
||
#{reportCaseIds[${index}]}
|
||
</foreach>
|
||
</if>
|
||
ORDER BY
|
||
t1.gmt_create DESC
|
||
</select>
|
||
|
||
<!-- 案件待下派列表 -->
|
||
<select id="listPageReportCaseAssign" parameterType="map" resultMap="reportCaseAssignDTO">
|
||
SELECT
|
||
t1.report_case_id,
|
||
t1.case_flow_type,
|
||
t1.case_number,
|
||
t1.area_id,
|
||
t1.area_name,
|
||
t1.case_photos,
|
||
t1.case_audio,
|
||
t1.community_id,
|
||
t1.community_name,
|
||
t1.case_source,
|
||
t1.case_status,
|
||
t1.case_type_id,
|
||
t1.case_type_name,
|
||
t1.case_content,
|
||
t1.case_longitude,
|
||
t1.case_latitude,
|
||
t1.case_position,
|
||
t1.grade,
|
||
t1.is_accept,
|
||
t1.is_deny,
|
||
t1.is_self,
|
||
t1.case_reporter,
|
||
t1.creator,
|
||
LEFT(t1.gmt_create, 19) gmt_create,
|
||
t2.register_user_name,
|
||
LEFT(t2.gmt_create, 19) register_date
|
||
FROM
|
||
city_report_case t1
|
||
INNER JOIN city_report_case_register t2 ON t1.report_case_id = t2.case_id AND t2.is_delete = 0
|
||
WHERE
|
||
t1.is_delete = 0
|
||
AND t1.case_status = 2
|
||
<if test="areaId != null and areaId != ''">
|
||
AND t1.area_id = #{areaId}
|
||
</if>
|
||
<if test="caseNumber != null and caseNumber != ''">
|
||
AND t1.case_number Like CONCAT('%', #{caseNumber}, '%')
|
||
</if>
|
||
<if test="caseFlowType != null and caseFlowType != ''">
|
||
AND t1.case_flow_type = #{caseFlowType}
|
||
</if>
|
||
<if test="caseTypeId != null and caseTypeId != ''">
|
||
AND t1.case_type_id = #{caseTypeId}
|
||
</if>
|
||
<if test="caseStatus != null and caseStatus != ''">
|
||
AND t1.case_status = #{caseStatus}
|
||
</if>
|
||
<if test="isAccept != null and isAccept != ''">
|
||
AND t1.is_accept = #{isAccept}
|
||
</if>
|
||
<if test="startTime != null and startTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||
</if>
|
||
<if test="endTime != null and endTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||
</if>
|
||
<if test="reportCaseIds != null and reportCaseIds.size > 0">
|
||
AND
|
||
t1.report_case_id IN
|
||
<foreach collection="reportCaseIds" index="index" open="(" separator="," close=")">
|
||
#{reportCaseIds[${index}]}
|
||
</foreach>
|
||
</if>
|
||
<!-- 专管员(N员)区域(上报的)案件 -->
|
||
<!-- <if test="isNPersonArea != null and isNPersonArea == 'true'">-->
|
||
<!-- AND-->
|
||
<!-- t1.creator IN (-->
|
||
<!-- SELECT-->
|
||
<!-- user_id-->
|
||
<!-- FROM-->
|
||
<!-- sys_role_user-->
|
||
<!-- WHERE-->
|
||
<!-- <!– 专管员角色ID –>-->
|
||
<!-- role_id = 'bc405346-8714-4ded-89ac-9cc4d755f66a'-->
|
||
<!-- )-->
|
||
<!-- </if>-->
|
||
<!-- 专管员处理的案件 -->
|
||
<if test="isNPersonArea != null and isNPersonArea == 'true'">
|
||
AND
|
||
t1.report_case_id IN (
|
||
SELECT
|
||
st1.case_id
|
||
FROM
|
||
city_report_case_assign st1
|
||
WHERE
|
||
st1.is_delete = 0
|
||
AND
|
||
st1.handle_user_id IN (
|
||
SELECT
|
||
sst1.user_id
|
||
FROM
|
||
sys_department_user sst1
|
||
INNER JOIN
|
||
sys_role_user sst2
|
||
ON
|
||
sst1.user_id = sst2.user_id
|
||
AND
|
||
sst2.role_id = 'bc405346-8714-4ded-89ac-9cc4d755f66a'
|
||
)
|
||
)
|
||
</if>
|
||
ORDER BY
|
||
t1.gmt_modified DESC
|
||
</select>
|
||
|
||
<!-- 案件待处理列表 -->
|
||
<select id="listPageReportCaseHandle" parameterType="map" resultMap="reportCaseHandleDTO">
|
||
SELECT
|
||
t1.report_case_id,
|
||
t1.case_number,
|
||
t1.area_id,
|
||
t1.area_name,
|
||
t1.case_photos,
|
||
t1.case_audio,
|
||
t1.community_id,
|
||
t1.community_name,
|
||
t1.case_source,
|
||
t1.case_status,
|
||
t1.case_type_id,
|
||
t1.case_type_name,
|
||
t1.case_content,
|
||
t1.case_longitude,
|
||
t1.case_latitude,
|
||
t1.case_position,
|
||
t1.grade,
|
||
t1.is_accept,
|
||
t1.is_deny,
|
||
t1.is_self,
|
||
t1.case_reporter,
|
||
t1.creator,
|
||
t1.case_flow_type,
|
||
LEFT(t1.gmt_create, 19) gmt_create,
|
||
t2.handle_user_id,
|
||
t2.handle_user_name,
|
||
t2.handle_time,
|
||
LEFT(t2.gmt_create, 19) assign_date
|
||
FROM
|
||
city_report_case t1
|
||
INNER JOIN city_report_case_assign t2 ON t1.report_case_id = t2.case_id AND t2.is_delete = 0
|
||
WHERE
|
||
t1.is_delete = 0
|
||
<if test="handleUserId != null and handleUserId != ''">
|
||
AND t2.handle_user_id = #{handleUserId}
|
||
</if>
|
||
<if test="caseNumber != null and caseNumber != ''">
|
||
AND t1.case_number Like CONCAT('%', #{caseNumber}, '%')
|
||
</if>
|
||
<if test="caseFlowType != null and caseFlowType != ''">
|
||
AND t1.case_flow_type = #{caseFlowType}
|
||
</if>
|
||
<if test="areaId != null and areaId != ''">
|
||
AND t1.area_id = #{areaId}
|
||
</if>
|
||
<if test="caseTypeId != null and caseTypeId != ''">
|
||
AND t1.case_type_id = #{caseTypeId}
|
||
</if>
|
||
<if test="caseTypeIds != null and caseTypeIds.size > 0">
|
||
AND t1.case_type_id IN
|
||
<foreach collection="caseTypeIds" index="index" open="(" separator="," close=")">
|
||
#{caseTypeIds[${index}]}
|
||
</foreach>
|
||
</if>
|
||
<if test="caseStatus != null and caseStatus != ''">
|
||
AND t1.case_status = #{caseStatus}
|
||
</if>
|
||
<if test="isAccept != null and isAccept != ''">
|
||
AND t1.is_accept = #{isAccept}
|
||
</if>
|
||
<if test="startTime != null and startTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||
</if>
|
||
<if test="endTime != null and endTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||
</if>
|
||
<if test="reportCaseIds != null and reportCaseIds.size > 0">
|
||
AND t1.report_case_id IN
|
||
<foreach collection="reportCaseIds" index="index" open="(" separator="," close=")">
|
||
#{reportCaseIds[${index}]}
|
||
</foreach>
|
||
</if>
|
||
<!-- 专管员(N员)区域(上报的)案件 -->
|
||
<!-- <if test="isNPersonArea != null and isNPersonArea == 'true'">-->
|
||
<!-- AND-->
|
||
<!-- t1.creator IN (-->
|
||
<!-- SELECT-->
|
||
<!-- user_id-->
|
||
<!-- FROM-->
|
||
<!-- sys_role_user-->
|
||
<!-- WHERE-->
|
||
<!-- <!– 专管员角色ID –>-->
|
||
<!-- role_id = 'bc405346-8714-4ded-89ac-9cc4d755f66a'-->
|
||
<!-- )-->
|
||
<!-- </if>-->
|
||
<!-- 专管员处理的案件 -->
|
||
<if test="isNPersonArea != null and isNPersonArea == 'true'">
|
||
AND
|
||
t1.report_case_id IN (
|
||
SELECT
|
||
st1.case_id
|
||
FROM
|
||
city_report_case_assign st1
|
||
WHERE
|
||
st1.is_delete = 0
|
||
AND
|
||
st1.handle_user_id IN (
|
||
SELECT
|
||
sst1.user_id
|
||
FROM
|
||
sys_department_user sst1
|
||
INNER JOIN
|
||
sys_role_user sst2
|
||
ON
|
||
sst1.user_id = sst2.user_id
|
||
AND
|
||
sst2.role_id = 'bc405346-8714-4ded-89ac-9cc4d755f66a'
|
||
)
|
||
)
|
||
</if>
|
||
<if test="departmentId != null and departmentId != ''">
|
||
AND (
|
||
t1.creator IN (
|
||
SELECT
|
||
sdu.user_id
|
||
FROM
|
||
sys_department_user sdu
|
||
INNER JOIN
|
||
sys_user su
|
||
ON
|
||
sdu.user_id = su.user_id
|
||
AND
|
||
su.is_delete = 0
|
||
INNER JOIN
|
||
sys_department sd
|
||
ON
|
||
sdu.department_id = sd.department_id
|
||
WHERE
|
||
sdu.department_id = #{departmentId}
|
||
)
|
||
OR
|
||
t2.handle_user_id IN (
|
||
SELECT
|
||
sdu.user_id
|
||
FROM
|
||
sys_department_user sdu
|
||
INNER JOIN
|
||
sys_user su
|
||
ON
|
||
sdu.user_id = su.user_id
|
||
AND
|
||
su.is_delete = 0
|
||
INNER JOIN
|
||
sys_department sd
|
||
ON
|
||
sdu.department_id = sd.department_id
|
||
WHERE
|
||
sdu.department_id = #{departmentId}
|
||
)
|
||
)
|
||
</if>
|
||
ORDER BY t1.gmt_modified DESC
|
||
</select>
|
||
|
||
<!-- 案件待处理详情 -->
|
||
<select id="getReportCaseHandle" parameterType="map" resultMap="reportCaseHandleDTO">
|
||
SELECT
|
||
t1.report_case_id,
|
||
t1.case_number,
|
||
t1.area_id,
|
||
t1.area_name,
|
||
t1.case_photos,
|
||
t1.case_audio,
|
||
t1.community_id,
|
||
t1.community_name,
|
||
t1.case_source,
|
||
t1.case_status,
|
||
t1.case_type_id,
|
||
t1.case_type_name,
|
||
t1.case_content,
|
||
t1.case_longitude,
|
||
t1.case_latitude,
|
||
t1.case_position,
|
||
t1.grade,
|
||
t1.is_accept,
|
||
t1.is_deny,
|
||
t1.is_self,
|
||
t1.case_reporter,
|
||
t1.creator,
|
||
LEFT(t1.gmt_create, 19) gmt_create,
|
||
t2.handle_user_id,
|
||
t2.handle_user_name,
|
||
t2.handle_time,
|
||
LEFT(t2.gmt_create, 19) assign_date
|
||
FROM
|
||
city_report_case t1
|
||
INNER JOIN
|
||
city_report_case_assign t2
|
||
ON
|
||
t1.report_case_id = t2.case_id
|
||
AND
|
||
t2.is_delete = 0
|
||
WHERE
|
||
t1.is_delete = 0
|
||
AND
|
||
t1.case_status = 3
|
||
AND
|
||
t1.report_case_id = #{caseId}
|
||
ORDER BY
|
||
t1.gmt_create DESC
|
||
</select>
|
||
|
||
<!-- 新增案件处理 -->
|
||
<insert id="saveReportCaseHandle" parameterType="map">
|
||
INSERT INTO city_report_case_handle(
|
||
case_id,
|
||
handle_user_name,
|
||
handle_time,
|
||
handle_timeout,
|
||
handle_opinion,
|
||
handle_photos,
|
||
is_inspect,
|
||
creator,
|
||
gmt_create,
|
||
modifier,
|
||
gmt_modified,
|
||
is_delete
|
||
) VALUES(
|
||
#{caseId},
|
||
#{handleUserName},
|
||
#{handleTime},
|
||
#{handleTimeout},
|
||
#{handleOpinion},
|
||
#{handlePhotos},
|
||
#{isInspect},
|
||
#{creator},
|
||
#{gmtCreate},
|
||
#{modifier},
|
||
#{gmtModified},
|
||
#{isDelete}
|
||
)
|
||
</insert>
|
||
|
||
<!-- 待检查案件列表 -->
|
||
<select id="listPageReportCaseInspect" parameterType="map" resultMap="reportCaseInspectDTO">
|
||
SELECT
|
||
t1.report_case_id,
|
||
t1.case_number,
|
||
t1.area_id,
|
||
t1.area_name,
|
||
t1.case_photos,
|
||
t1.case_audio,
|
||
t1.community_id,
|
||
t1.community_name,
|
||
t1.case_source,
|
||
t1.case_status,
|
||
t1.case_type_id,
|
||
t1.case_type_name,
|
||
t1.case_content,
|
||
t1.case_longitude,
|
||
t1.case_latitude,
|
||
t1.case_position,
|
||
t1.grade,
|
||
t1.is_accept,
|
||
t1.is_deny,
|
||
t1.is_self,
|
||
t1.case_reporter,
|
||
t1.creator,
|
||
LEFT(t1.gmt_create, 19) gmt_create,
|
||
t2.creator handle_user_id,
|
||
t2.handle_user_name,
|
||
t2.handle_time,
|
||
t2.handle_timeout,
|
||
t2.handle_opinion,
|
||
t2.handle_photos,
|
||
LEFT(t2.gmt_create, 19) handle_date
|
||
FROM
|
||
city_report_case t1
|
||
INNER JOIN
|
||
city_report_case_handle t2 ON t1.report_case_id = t2.case_id AND t2.is_delete = 0
|
||
WHERE
|
||
t1.is_delete = 0
|
||
<if test="reporterId != null and reportedId != ''">
|
||
AND t1.creator = #{reporterId}
|
||
</if>
|
||
<if test="handleUserId != null and handleUserId != ''">
|
||
AND t2.handle_user_id = #{handleUserId}
|
||
</if>
|
||
<if test="areaId != null and areaId != ''">
|
||
AND t1.area_id = #{areaId}
|
||
</if>
|
||
<if test="caseTypeId != null and caseTypeId != ''">
|
||
AND t1.case_type_id = #{caseTypeId}
|
||
</if>
|
||
<if test="caseStatus != null and caseStatus != ''">
|
||
AND t1.case_status = #{caseStatus}
|
||
</if>
|
||
<if test="isAccept != null and isAccept != ''">
|
||
AND t1.is_accept = #{isAccept}
|
||
</if>
|
||
<if test="startTime != null and startTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||
</if>
|
||
<if test="endTime != null and endTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||
</if>
|
||
<if test="reportCaseIds != null and reportCaseIds.size > 0">
|
||
AND t1.report_case_id IN
|
||
<foreach collection="reportCaseIds" index="index" open="(" separator="," close=")">
|
||
#{reportCaseIds[${index}]}
|
||
</foreach>
|
||
</if>
|
||
<!-- 专管员(N员)区域(上报的)案件 -->
|
||
<!-- <if test="isNPersonArea != null and isNPersonArea == 'true'">-->
|
||
<!-- AND-->
|
||
<!-- t1.creator IN (-->
|
||
<!-- SELECT-->
|
||
<!-- user_id-->
|
||
<!-- FROM-->
|
||
<!-- sys_role_user-->
|
||
<!-- WHERE-->
|
||
<!-- <!– 专管员角色ID –>-->
|
||
<!-- role_id = 'bc405346-8714-4ded-89ac-9cc4d755f66a'-->
|
||
<!-- )-->
|
||
<!-- </if>-->
|
||
<!-- 专管员处理的案件 -->
|
||
<if test="isNPersonArea != null and isNPersonArea == 'true'">
|
||
AND
|
||
t1.report_case_id IN (
|
||
SELECT
|
||
st1.case_id
|
||
FROM
|
||
city_report_case_assign st1
|
||
WHERE
|
||
st1.is_delete = 0
|
||
AND
|
||
st1.handle_user_id IN (
|
||
SELECT
|
||
sst1.user_id
|
||
FROM
|
||
sys_department_user sst1
|
||
INNER JOIN
|
||
sys_role_user sst2
|
||
ON
|
||
sst1.user_id = sst2.user_id
|
||
AND
|
||
sst2.role_id = 'bc405346-8714-4ded-89ac-9cc4d755f66a'
|
||
)
|
||
)
|
||
</if>
|
||
<if test="departmentId != null and departmentId != ''">
|
||
AND (
|
||
t1.creator IN (
|
||
SELECT
|
||
sdu.user_id
|
||
FROM
|
||
sys_department_user sdu
|
||
INNER JOIN
|
||
sys_user su
|
||
ON
|
||
sdu.user_id = su.user_id
|
||
AND
|
||
su.is_delete = 0
|
||
INNER JOIN
|
||
sys_department sd
|
||
ON
|
||
sdu.department_id = sd.department_id
|
||
WHERE
|
||
sdu.department_id = #{departmentId}
|
||
)
|
||
OR
|
||
t2.creator IN (
|
||
SELECT
|
||
sdu.user_id
|
||
FROM
|
||
sys_department_user sdu
|
||
INNER JOIN
|
||
sys_user su
|
||
ON
|
||
sdu.user_id = su.user_id
|
||
AND
|
||
su.is_delete = 0
|
||
INNER JOIN
|
||
sys_department sd
|
||
ON
|
||
sdu.department_id = sd.department_id
|
||
WHERE
|
||
sdu.department_id = #{departmentId}
|
||
)
|
||
)
|
||
</if>
|
||
ORDER BY
|
||
t1.gmt_modified DESC
|
||
</select>
|
||
|
||
<!-- 修改案件处理 -->
|
||
<update id="updateReportCaseHandle" parameterType="map">
|
||
UPDATE
|
||
city_report_case_handle
|
||
SET
|
||
<if test="handleTime != null and handleTime != ''">
|
||
handle_time = #{handleTime},
|
||
</if>
|
||
<if test="handleUserName != null and handleUserName != ''">
|
||
handle_user_name = #{handleUserName},
|
||
</if>
|
||
<if test="handleTimeout != null and handleTimeout != ''">
|
||
handle_timeout = #{handleTimeout},
|
||
</if>
|
||
<if test="handleOpinion != null and handleOpinion != ''">
|
||
handle_opinion = #{handleOpinion},
|
||
</if>
|
||
<if test="handlePhotos != null and handlePhotos != ''">
|
||
handle_photos = #{handlePhotos},
|
||
</if>
|
||
<if test="isInspect != null and isInspect != ''">
|
||
is_inspect = #{isInspect},
|
||
</if>
|
||
<if test="grade != null and grade != ''">
|
||
grade = #{grade},
|
||
</if>
|
||
modifier = #{modifier},
|
||
gmt_modified = #{gmtModified}
|
||
WHERE
|
||
case_id = #{caseId}
|
||
</update>
|
||
|
||
<!-- 新增案件检查 -->
|
||
<insert id="saveReportCaseInspect" parameterType="map">
|
||
INSERT INTO city_report_case_inspect(
|
||
case_id,
|
||
inspect_user_name,
|
||
inspect_photos,
|
||
inspect_opinion,
|
||
is_pass,
|
||
is_close,
|
||
creator,
|
||
gmt_create,
|
||
modifier,
|
||
gmt_modified,
|
||
is_delete
|
||
) VALUES(
|
||
#{caseId},
|
||
#{inspectUserName},
|
||
#{inspectPhotos},
|
||
#{inspectOpinion},
|
||
#{isPass},
|
||
#{isClose},
|
||
#{creator},
|
||
#{gmtCreate},
|
||
#{modifier},
|
||
#{gmtModified},
|
||
#{isDelete}
|
||
)
|
||
</insert>
|
||
|
||
<!-- 删除案件下派信息 -->
|
||
<delete id="removeReportCaseAssign" parameterType="map">
|
||
DELETE FROM
|
||
city_report_case_assign
|
||
WHERE
|
||
case_id = #{caseId}
|
||
</delete>
|
||
|
||
<!-- 删除案件处理信息 -->
|
||
<delete id="removeReportCaseHandle" parameterType="map">
|
||
DELETE FROM
|
||
city_report_case_handle
|
||
WHERE
|
||
case_id = #{caseId}
|
||
</delete>
|
||
|
||
<!-- 删除立案信息 -->
|
||
<delete id="removeReportCaseRegister" parameterType="map">
|
||
DELETE FROM
|
||
city_report_case_register
|
||
WHERE
|
||
case_id = #{caseId}
|
||
</delete>
|
||
|
||
<!-- 删除受理信息 -->
|
||
<delete id="removeReportCaseAccept" parameterType="map">
|
||
DELETE FROM
|
||
city_report_case_accept
|
||
WHERE
|
||
case_id = #{caseId}
|
||
</delete>
|
||
|
||
<!-- 待结案案件列表 -->
|
||
<select id="listPageReportCaseClose" parameterType="map" resultMap="reportCaseCloseDTO">
|
||
SELECT
|
||
t1.report_case_id,
|
||
t1.case_number,
|
||
t1.area_id,
|
||
t1.area_name,
|
||
t1.case_photos,
|
||
t1.case_audio,
|
||
t1.community_id,
|
||
t1.community_name,
|
||
t1.case_source,
|
||
t1.case_status,
|
||
t1.case_type_id,
|
||
t1.case_type_name,
|
||
t1.case_content,
|
||
t1.case_longitude,
|
||
t1.case_latitude,
|
||
t1.case_position,
|
||
t1.grade,
|
||
t1.is_accept,
|
||
t1.is_deny,
|
||
t1.is_self,
|
||
t1.case_reporter,
|
||
t1.creator,
|
||
LEFT(t1.gmt_create, 19) gmt_create,
|
||
t2.creator inspect_user_id,
|
||
t2.inspect_user_name,
|
||
t2.inspect_photos,
|
||
t2.inspect_opinion,
|
||
t2.is_pass,
|
||
LEFT(t2.gmt_create, 19) inspect_date,
|
||
t3.creator handle_user_id,
|
||
t3.handle_user_name,
|
||
t3.handle_time,
|
||
t3.handle_timeout,
|
||
t3.handle_opinion,
|
||
t3.handle_photos,
|
||
LEFT(t3.gmt_create, 19) handle_date
|
||
FROM
|
||
city_report_case t1
|
||
INNER JOIN
|
||
city_report_case_inspect t2
|
||
ON
|
||
t1.report_case_id = t2.case_id
|
||
AND
|
||
t2.is_delete = 0
|
||
INNER JOIN
|
||
city_report_case_handle t3
|
||
ON
|
||
t1.report_case_id = t3.case_id
|
||
AND
|
||
t3.is_delete = 0
|
||
WHERE
|
||
t1.is_delete = 0
|
||
AND
|
||
t1.case_status = 5
|
||
<if test="reporterId != null and reportedId != ''">
|
||
AND
|
||
t1.creator = #{reporterId}
|
||
</if>
|
||
<if test="inspectUserId != null and inspectUserId != ''">
|
||
AND
|
||
t2.inspect_user_id = #{inspectUserId}
|
||
</if>
|
||
<if test="areaId != null and areaId != ''">
|
||
AND
|
||
t1.area_id = #{areaId}
|
||
</if>
|
||
<if test="caseTypeId != null and caseTypeId != ''">
|
||
AND
|
||
t1.case_type_id = #{caseTypeId}
|
||
</if>
|
||
<if test="caseStatus != null and caseStatus != ''">
|
||
AND
|
||
t1.case_status = #{caseStatus}
|
||
</if>
|
||
<if test="isAccept != null and isAccept != ''">
|
||
AND
|
||
t1.is_accept = #{isAccept}
|
||
</if>
|
||
<if test="startTime != null and startTime != ''">
|
||
AND
|
||
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||
</if>
|
||
<if test="endTime != null and endTime != ''">
|
||
AND
|
||
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||
</if>
|
||
<if test="reportCaseIds != null and reportCaseIds.size > 0">
|
||
AND
|
||
t1.report_case_id IN
|
||
<foreach collection="reportCaseIds" index="index" open="(" separator="," close=")">
|
||
#{reportCaseIds[${index}]}
|
||
</foreach>
|
||
</if>
|
||
<!-- 专管员(N员)区域(上报的)案件 -->
|
||
<!-- <if test="isNPersonArea != null and isNPersonArea == 'true'">-->
|
||
<!-- AND-->
|
||
<!-- t1.creator IN (-->
|
||
<!-- SELECT-->
|
||
<!-- user_id-->
|
||
<!-- FROM-->
|
||
<!-- sys_role_user-->
|
||
<!-- WHERE-->
|
||
<!-- <!– 专管员角色ID –>-->
|
||
<!-- role_id = 'bc405346-8714-4ded-89ac-9cc4d755f66a'-->
|
||
<!-- )-->
|
||
<!-- </if>-->
|
||
<!-- 专管员处理的案件 -->
|
||
<if test="isNPersonArea != null and isNPersonArea == 'true'">
|
||
AND
|
||
t1.report_case_id IN (
|
||
SELECT
|
||
st1.case_id
|
||
FROM
|
||
city_report_case_assign st1
|
||
WHERE
|
||
st1.is_delete = 0
|
||
AND
|
||
st1.handle_user_id IN (
|
||
SELECT
|
||
sst1.user_id
|
||
FROM
|
||
sys_department_user sst1
|
||
INNER JOIN
|
||
sys_role_user sst2
|
||
ON
|
||
sst1.user_id = sst2.user_id
|
||
AND
|
||
sst2.role_id = 'bc405346-8714-4ded-89ac-9cc4d755f66a'
|
||
)
|
||
)
|
||
</if>
|
||
ORDER BY
|
||
t1.gmt_create DESC
|
||
</select>
|
||
|
||
<!-- 修改案件检查 -->
|
||
<update id="updateReportCaseInspect" parameterType="map">
|
||
UPDATE
|
||
city_report_case_inspect
|
||
SET
|
||
<if test="inspectUserName != null and inspectUserName != ''">
|
||
inspect_user_name = #{inspectUserName},
|
||
</if>
|
||
<if test="inspectPhotos != null and inspectPhotos != ''">
|
||
inspect_photos = #{inspectPhotos},
|
||
</if>
|
||
<if test="inspectOpinion != null and inspectOpinion != ''">
|
||
inspect_opinion = #{inspectOpinion},
|
||
</if>
|
||
<if test="isPass != null">
|
||
is_pass = #{isPass}
|
||
</if>
|
||
<if test="isClose != null">
|
||
is_close = #{isClose},
|
||
</if>
|
||
modifier = #{modifier},
|
||
gmt_modified = #{gmtModified}
|
||
</update>
|
||
|
||
<!-- 新增案件结案 -->
|
||
<insert id="saveReportCaseClose" parameterType="map">
|
||
INSERT INTO city_report_case_close(
|
||
case_id,
|
||
close_user_name,
|
||
close_opinion,
|
||
is_placeonfile,
|
||
creator,
|
||
gmt_create,
|
||
modifier,
|
||
gmt_modified,
|
||
is_delete
|
||
) VALUE (
|
||
#{caseId},
|
||
#{closeUserName},
|
||
#{closeOpinion},
|
||
#{isPlaceonfile},
|
||
#{creator},
|
||
#{gmtCreate},
|
||
#{modifier},
|
||
#{gmtModified},
|
||
#{isDelete}
|
||
)
|
||
</insert>
|
||
|
||
<!-- 保存案件日志 -->
|
||
<insert id="saveReportCaseLog" parameterType="map">
|
||
INSERT INTO city_report_case_log(
|
||
case_id,
|
||
option_type,
|
||
user_id,
|
||
user_name,
|
||
user_phone,
|
||
user_opinion,
|
||
user_photos,
|
||
user_audio,
|
||
handle_user_id,
|
||
handle_user_name,
|
||
handle_time,
|
||
handle_status,
|
||
gmt_create
|
||
) VALUES(
|
||
#{caseId},
|
||
#{optionType},
|
||
#{userId},
|
||
#{userName},
|
||
#{userPhone},
|
||
#{userOpinion},
|
||
#{userPhotos},
|
||
#{userAudio},
|
||
#{handleUserId},
|
||
#{handleUserName},
|
||
#{handleTime},
|
||
#{handleStatus},
|
||
#{gmtCreate}
|
||
)
|
||
</insert>
|
||
|
||
<!-- 统计我的案件 -->
|
||
<select id="countCaseOfMine" parameterType="map" resultType="Integer">
|
||
SELECT
|
||
COUNT(*)
|
||
FROM
|
||
city_report_case t1
|
||
LEFT JOIN city_report_case_assign t2 ON t1.report_case_id = t2.case_id
|
||
WHERE
|
||
t1.is_delete = 0
|
||
<if test="userId != null and userId != ''">
|
||
AND (
|
||
t1.creator = #{userId}
|
||
OR
|
||
FIND_IN_SET( #{userId}, t2.handle_user_id)
|
||
)
|
||
</if>
|
||
<if test="reporterIds != null and reporterIds.size > 0">
|
||
AND
|
||
t1.creator IN
|
||
<foreach collection="reporterIds" index="index" open="(" separator="," close=")">
|
||
#{reporterIds[${index}]}
|
||
</foreach>
|
||
</if>
|
||
</select>
|
||
|
||
<!-- 我的代办案件列表(包括待办和待检查) -->
|
||
<select id="listPageTotalReportCaseHandleOfMine" parameterType="map" resultMap="reportCaseInspectDTO">
|
||
SELECT
|
||
t1.report_case_id,
|
||
t1.case_number,
|
||
t1.area_id,
|
||
t1.area_name,
|
||
t1.case_photos,
|
||
t1.case_audio,
|
||
t1.community_id,
|
||
t1.community_name,
|
||
t1.case_source,
|
||
t1.case_status,
|
||
t1.case_type_id,
|
||
t1.case_type_name,
|
||
t1.case_content,
|
||
t1.case_longitude,
|
||
t1.case_latitude,
|
||
t1.case_position,
|
||
t1.is_accept,
|
||
t1.is_deny,
|
||
t1.is_self,
|
||
t1.case_reporter,
|
||
t1.creator,
|
||
LEFT(t1.gmt_create, 19) gmt_create,
|
||
t3.creator handle_user_id,
|
||
t3.handle_user_name,
|
||
t3.handle_time,
|
||
t3.handle_timeout,
|
||
t3.handle_opinion,
|
||
t3.handle_photos,
|
||
LEFT(t3.gmt_create, 19) handle_date
|
||
FROM city_report_case t1
|
||
LEFT JOIN city_report_case_assign t2 ON t1.report_case_id = t2.case_id AND t2.is_delete = 0
|
||
LEFT JOIN city_report_case_handle t3 ON t1.report_case_id = t3.case_id AND t3.is_delete = 0
|
||
WHERE
|
||
t1.is_delete = 0
|
||
AND (
|
||
t1.case_status = 3 AND FIND_IN_SET(#{userId}, t2.handle_user_id)
|
||
OR
|
||
t1.case_status = 4 AND t1.creator = #{userId}
|
||
)
|
||
ORDER BY
|
||
t1.gmt_create DESC
|
||
</select>
|
||
|
||
<!-- 统计我的待办(包括待办和检查) -->
|
||
<select id="countTotalHandleOfMine" parameterType="map" resultType="Integer">
|
||
SELECT
|
||
COUNT(*)
|
||
FROM
|
||
city_report_case t1
|
||
LEFT JOIN city_report_case_assign t2 ON t1.report_case_id = t2.case_id AND t2.is_delete = 0
|
||
WHERE
|
||
t1.is_delete = 0
|
||
AND (
|
||
t1.case_status = 3 AND FIND_IN_SET(#{userId}, t2.handle_user_id)
|
||
OR
|
||
t1.case_status = 4 AND t1.creator = #{userId}
|
||
)
|
||
</select>
|
||
|
||
<!-- 案件日志列表 -->
|
||
<select id="listReportCaseLog" parameterType="map" resultMap="reportCaseLogDTO">
|
||
SELECT
|
||
case_id,
|
||
option_type,
|
||
user_id,
|
||
user_name,
|
||
user_phone,
|
||
user_opinion,
|
||
user_photos,
|
||
user_audio,
|
||
handle_user_id,
|
||
handle_user_name,
|
||
handle_time,
|
||
handle_status,
|
||
LEFT(gmt_create, 19) gmt_create
|
||
FROM
|
||
city_report_case_log
|
||
WHERE
|
||
case_id = #{caseId}
|
||
ORDER BY
|
||
id DESC
|
||
</select>
|
||
|
||
<!-- 分组(按社区分组)统计案件数量-->
|
||
<select id="listCaseStatisticRatio" parameterType="map" resultMap="caseStatisticDTO">
|
||
SELECT
|
||
t1.area_id,
|
||
t1.area_name,
|
||
t1.community_id,
|
||
t2.community_name,
|
||
COUNT(*) counts
|
||
FROM
|
||
city_report_case t1
|
||
LEFT JOIN city_community t2 ON t1.community_id = t2.community_id
|
||
WHERE
|
||
t1.is_delete = '0'
|
||
<if test="areaId != null and areaId !=''">
|
||
AND t1.area_id = #{areaId}
|
||
</if>
|
||
<if test="communityId != null and communityId !=''">
|
||
AND t1.community_id = #{communityId}
|
||
</if>
|
||
<if test="caseTypeId != null and caseTypeId != ''">
|
||
AND t1.case_type_id IN (
|
||
SELECT
|
||
cd.dict_id
|
||
FROM
|
||
city_dict cd
|
||
WHERE
|
||
cd.is_delete = 0
|
||
AND (
|
||
dict_id = #{caseTypeId}
|
||
OR
|
||
dict_parent_id = #{caseTypeId}
|
||
)
|
||
)
|
||
</if>
|
||
<if test="startTime != null and startTime != ''">
|
||
AND t1.gmt_create <![CDATA[ >= ]]> #{startTime}
|
||
</if>
|
||
<if test="endTime != null and endTime != ''">
|
||
AND t1.gmt_create <![CDATA[ <= ]]> #{endTime}
|
||
</if>
|
||
GROUP BY
|
||
t1.area_id,
|
||
t1.area_name,
|
||
t1.community_id,
|
||
t2.community_name
|
||
ORDER BY
|
||
t1.area_name,counts desc
|
||
</select>
|
||
|
||
<!-- 统计案件数量 -->
|
||
<select id="countReportCase" parameterType="map" resultType="Integer">
|
||
SELECT
|
||
COUNT(*)
|
||
FROM
|
||
city_report_case
|
||
WHERE
|
||
is_delete = 0
|
||
<if test="caseStatusOne != null and caseStatusOne !=''">
|
||
AND case_status = #{caseStatusOne}
|
||
</if>
|
||
<if test="caseStatus != null and caseStatus !=''">
|
||
AND case_status >= #{caseStatus}
|
||
</if>
|
||
<if test="exception != null and exception !=''">
|
||
AND case_status = '-1'
|
||
</if>
|
||
<if test="areaId != null and areaId !=''">
|
||
AND area_id = #{areaId}
|
||
</if>
|
||
<if test="communityId != null and communityId !=''">
|
||
AND community_id = #{communityId}
|
||
</if>
|
||
<if test="caseTypeId != null and caseTypeId !=''">
|
||
AND case_type_id = #{caseTypeId}
|
||
</if>
|
||
<if test="startTime != null and startTime != ''">
|
||
AND gmt_create <![CDATA[ >= ]]> #{startTime}
|
||
</if>
|
||
<if test="endTime != null and endTime != ''">
|
||
AND gmt_create <![CDATA[ <= ]]> #{endTime}
|
||
</if>
|
||
<if test="handleDepartmentId != null and handleDepartmentId != ''">
|
||
AND (
|
||
report_case_id IN (
|
||
SELECT
|
||
st1.case_id
|
||
FROM
|
||
city_report_case_assign st1
|
||
WHERE
|
||
st1.is_delete = 0
|
||
AND
|
||
st1.handle_user_id IN (
|
||
SELECT
|
||
sst1.user_id
|
||
FROM
|
||
sys_department_user sst1
|
||
INNER JOIN
|
||
sys_role_user sst2
|
||
ON
|
||
sst1.user_id = sst2.user_id
|
||
AND
|
||
sst2.role_id = 'bc405346-8714-4ded-89ac-9cc4d755f66a'
|
||
WHERE
|
||
sst1.department_id = #{handleDepartmentId}
|
||
)
|
||
)
|
||
)
|
||
</if>
|
||
</select>
|
||
|
||
<!-- 统计处理案件数量 -->
|
||
<select id="countHandleReportCase" parameterType="map" resultType="Integer">
|
||
SELECT
|
||
COUNT(*)
|
||
FROM
|
||
city_report_case_handle
|
||
WHERE
|
||
is_delete = 0
|
||
</select>
|
||
|
||
<!-- 异常案件数量 -->
|
||
<select id="countExceptionReportCase" parameterType="map" resultType="Integer">
|
||
SELECT
|
||
COUNT(*)
|
||
FROM
|
||
city_report_case
|
||
WHERE
|
||
case_status <![CDATA[ < ]]> 0
|
||
</select>
|
||
|
||
<!-- 案件转发-->
|
||
<update id="forwardReportCase" parameterType="map">
|
||
UPDATE city_report_case SET
|
||
case_flow_forward = #{caseFlowForward}
|
||
WHERE
|
||
report_case_id = #{reportCaseId}
|
||
</update>
|
||
|
||
<!-- 查询案件已处理列表-->
|
||
<select id="listReportCaseHandle" parameterType="map" resultType="map">
|
||
SELECT
|
||
t1.case_id,
|
||
t1.handle_user_name,
|
||
t1.handle_timeout,
|
||
t1.handle_opinion,
|
||
t1.handle_photos,
|
||
t1.is_inspect,
|
||
t1.creator,
|
||
t1.gmt_create,
|
||
t1.modifier,
|
||
t1.gmt_modified,
|
||
t2.gmt_create assignGmtCreate,
|
||
t2.handle_time
|
||
FROM
|
||
city_report_case_handle t1
|
||
LEFT JOIN city_report_case_assign t2 ON t1.case_id = t2.case_id AND t2.is_delete = '0'
|
||
WHERE
|
||
t1.is_delete = '0'
|
||
<if test="userIds != null">
|
||
AND FIND_IN_SET(t1.creator,#{userIds})
|
||
</if>
|
||
<if test="handleTimeout != null and handleTimeout != ''">
|
||
AND t1.handle_timeout = #{handleTimeout}
|
||
</if>
|
||
<if test="startTime != null and startTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||
</if>
|
||
<if test="endTime != null and endTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||
</if>
|
||
<if test="caseIds != null and caseIds.size > 0">
|
||
AND
|
||
t1.case_id IN
|
||
<foreach collection="caseIds" item="item" open="(" separator="," close=")">
|
||
#{item}
|
||
</foreach>
|
||
</if>
|
||
</select>
|
||
|
||
<!--查询已下派但未处理的案件-->
|
||
<select id="listReportCaseWaitHandle" parameterType="map" resultType="map">
|
||
SELECT
|
||
t1.case_id,
|
||
t1.handle_user_type,
|
||
t1.handle_user_id,
|
||
t1.handle_user_name,
|
||
t1.handle_time,
|
||
t1.handle_timeout,
|
||
t1.assign_opinion,
|
||
t1.assign_user_name,
|
||
t1.is_handle,
|
||
t1.creator,
|
||
t1.gmt_create,
|
||
t1.modifier,
|
||
t1.gmt_modified
|
||
FROM
|
||
city_report_case_assign t1
|
||
LEFT JOIN city_report_case_handle t2 ON t1.case_id = t2.case_id AND t2.is_delete = '0'
|
||
WHERE
|
||
t1.is_delete = '0'
|
||
AND t2.case_id IS NULL
|
||
<if test="userIds != null">
|
||
AND FIND_IN_SET(t1.handle_user_id,#{userIds})
|
||
</if>
|
||
<if test="startTime != null and startTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||
</if>
|
||
<if test="endTime != null and endTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||
</if>
|
||
</select>
|
||
|
||
<select id="getReportCaseScore" parameterType="map" resultType="map">
|
||
SELECT
|
||
t1.case_id,
|
||
t2.grade
|
||
FROM
|
||
city_report_case_inspect t1
|
||
LEFT JOIN city_report_case t2 ON t2.report_case_id = t1.case_id AND t2.is_delete = '0'
|
||
LEFT JOIN city_report_case_handle t3 ON t3.case_id = t1.case_id
|
||
WHERE
|
||
t1.is_delete = '0'
|
||
/* 以案件处理人为准*/
|
||
<if test="userIds != null">
|
||
AND FIND_IN_SET(t3.creator,#{userIds})
|
||
</if>
|
||
/* 以检查完成时间为准*/
|
||
<if test="startTime != null and startTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||
</if>
|
||
<if test="endTime != null and endTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||
</if>
|
||
</select>
|
||
|
||
<!-- 查询案件检查情况(街镇督查) -->
|
||
<select id="listInspectOverseer" parameterType="map" resultType="map">
|
||
SELECT
|
||
t2.case_id,
|
||
t2.gmt_create handleGmtCreate,
|
||
t3.case_id inspectCaseId,
|
||
t3.gmt_create inspectGmtCreate,
|
||
t1.creator
|
||
FROM
|
||
city_report_case t1
|
||
LEFT JOIN city_report_case_handle t2 ON t1.report_case_id = t2.case_id AND t2.is_delete = '0'
|
||
LEFT JOIN city_report_case_inspect t3 ON t1.report_case_id = t3.case_id AND t2.is_delete = '0'
|
||
WHERE
|
||
t1.is_delete = '0'
|
||
AND t1.case_flow_type != '1'
|
||
AND t1.case_status >= '4'
|
||
<if test="areaId != null and areaId != ''">
|
||
AND t1.area_id = #{areaId}
|
||
</if>
|
||
/* 以案件处理完成时间为准*/
|
||
<if test="startTime != null and startTime != ''">
|
||
AND LEFT(t2.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||
</if>
|
||
<if test="endTime != null and endTime != ''">
|
||
AND LEFT(t2.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||
</if>
|
||
</select>
|
||
|
||
<select id="listCloseOverseer" parameterType="map" resultType="map">
|
||
SELECT
|
||
t1.area_id,
|
||
t2.case_id,
|
||
t2.gmt_create inspectGmtCreate,
|
||
t3.case_id closeCaseId,
|
||
t3.gmt_create closeGmtCreate,
|
||
t1.creator
|
||
FROM
|
||
city_report_case t1
|
||
LEFT JOIN city_report_case_inspect t2 ON t1.report_case_id = t2.case_id AND t2.is_delete = '0'
|
||
LEFT JOIN city_report_case_close t3 ON t1.report_case_id = t3.case_id AND t3.is_delete = '0'
|
||
WHERE
|
||
t1.is_delete = '0'
|
||
AND t1.case_flow_type != '1'
|
||
AND t1.case_status >= '5'
|
||
<if test="areaId != null and areaId != ''">
|
||
AND t1.area_id = #{areaId}
|
||
</if>
|
||
/* 以案件检查完成时间为准*/
|
||
<if test="startTime != null and startTime != ''">
|
||
AND LEFT(t2.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||
</if>
|
||
<if test="endTime != null and endTime != ''">
|
||
AND LEFT(t2.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||
</if>
|
||
</select>
|
||
|
||
<!--获取案件检查人的信息-->
|
||
<select id="getCaseHandleByCaseId" parameterType="map" resultType="map">
|
||
SELECT
|
||
handle_user_name handleUserName,
|
||
gmt_create handleCreateTime,
|
||
handle_opinion handleOpinion,
|
||
handle_photos handlePhotos
|
||
FROM
|
||
city_report_case_handle
|
||
WHERE is_delete = '0' AND case_id = #{caseId}
|
||
</select>
|
||
|
||
<select id="listRoleByUserId" parameterType="string" resultType="map">
|
||
SELECT
|
||
role_id roleId
|
||
FROM
|
||
sys_role_user
|
||
WHERE
|
||
user_id = #{userId}
|
||
</select>
|
||
|
||
<select id="listRoleByUserIdRoleId" parameterType="map" resultType="map">
|
||
SELECT
|
||
role_id roleId
|
||
FROM
|
||
sys_role_user
|
||
WHERE
|
||
user_id = #{userId}
|
||
AND role_id = #{roleId}
|
||
</select>
|
||
|
||
<select id="listDeptByUserId" parameterType="string" resultType="map">
|
||
SELECT
|
||
department_id departmentId,
|
||
user_id userId
|
||
FROM
|
||
sys_department_user
|
||
WHERE
|
||
user_id = #{userId}
|
||
</select>
|
||
|
||
<select id="listUserByDeptId" parameterType="string" resultType="map">
|
||
SELECT
|
||
t1.department_id departmentId,
|
||
t1.user_id userId,
|
||
t2.user_name userName,
|
||
t2.user_avatar userAvatar,
|
||
t2.user_phone userPhone
|
||
FROM
|
||
sys_department_user t1
|
||
LEFT JOIN sys_user t2 ON t1.user_id = t2.user_id
|
||
WHERE
|
||
t2.is_delete = '0'
|
||
AND t2.user_id IS NOT NULL
|
||
AND t1.department_id = #{departmentId}
|
||
</select>
|
||
|
||
<select id="listUserFromCommunityBoss" parameterType="map" resultType="map">
|
||
SELECT
|
||
t1.community_boss_id communityBossId,
|
||
t1.community_boss_user_id userId,
|
||
t2.user_name userName,
|
||
t2.user_avatar userAvatar,
|
||
t2.user_phone userPhone,
|
||
t2.user_username userUsername
|
||
FROM
|
||
city_community_boss t1
|
||
LEFT JOIN sys_user t2 ON t1.community_boss_user_id = t2.user_id
|
||
LEFT JOIN city_community_boss_community t3 ON t1.community_boss_id = t3.community_boss_id
|
||
WHERE
|
||
t1.is_delete = '0'
|
||
AND t2.is_delete = '0'
|
||
AND t1.community_boss_level = #{communityBossLevel}
|
||
AND t1.area_id = #{areaId}
|
||
AND t2.user_id IS NOT NULL
|
||
AND t3.community_id = #{communityId}
|
||
</select>
|
||
|
||
<insert id="saveNPersonRole" parameterType="map">
|
||
INSERT INTO sys_role_user (
|
||
role_id, user_id
|
||
) values (
|
||
#{roleId}, #{userId}
|
||
)
|
||
</insert>
|
||
|
||
<!-- 案件待处理列表 -->
|
||
<select id="listReportByCaseTypes" parameterType="map" resultMap="reportCaseHandleDTO">
|
||
SELECT
|
||
t1.report_case_id,
|
||
t1.case_longitude,
|
||
t1.case_latitude
|
||
FROM
|
||
city_report_case t1
|
||
WHERE
|
||
t1.is_delete = 0
|
||
AND t1.case_status = 6
|
||
<if test="caseTypeIds != null and caseTypeIds.size > 0">
|
||
AND t1.case_type_id IN
|
||
<foreach collection="caseTypeIds" index="index" open="(" separator="," close=")">
|
||
#{caseTypeIds[${index}]}
|
||
</foreach>
|
||
</if>
|
||
ORDER BY t1.gmt_create DESC
|
||
limit 0, #{limitNumber}
|
||
</select>
|
||
|
||
<select id="listReportCaseHandleDTO" parameterType="map" resultMap="reportCaseHandleDTO">
|
||
SELECT
|
||
t1.case_id,
|
||
t1.handle_user_name,
|
||
t1.handle_timeout,
|
||
t1.handle_opinion,
|
||
t1.handle_photos,
|
||
t1.is_inspect,
|
||
t1.creator,
|
||
t1.gmt_create,
|
||
t1.modifier,
|
||
t1.gmt_modified,
|
||
jt2.department_name handle_user_department_name,
|
||
jt5.community_name handle_user_community_name,
|
||
jt6.user_username handle_user_username
|
||
FROM
|
||
city_report_case_handle t1
|
||
LEFT JOIN
|
||
sys_department_user jt1 ON t1.creator = jt1.user_id
|
||
LEFT JOIN
|
||
sys_department jt2 ON jt1.department_id = jt2.department_id
|
||
LEFT JOIN
|
||
city_community_boss jt3 ON t1.creator = jt3.community_boss_user_id
|
||
LEFT JOIN
|
||
city_community_boss_community jt4 ON jt3.community_boss_id = jt4.community_boss_id
|
||
LEFT JOIN
|
||
city_community jt5 ON jt4.community_id = jt5.community_id
|
||
LEFT JOIN
|
||
sys_user jt6 ON t1.creator = jt6.user_id
|
||
WHERE
|
||
t1.is_delete = '0'
|
||
<if test="userIds != null">
|
||
AND FIND_IN_SET(t1.creator,#{userIds})
|
||
</if>
|
||
<if test="handleTimeout != null and handleTimeout != ''">
|
||
AND t1.handle_timeout = #{handleTimeout}
|
||
</if>
|
||
<if test="startTime != null and startTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||
</if>
|
||
<if test="endTime != null and endTime != ''">
|
||
AND LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||
</if>
|
||
<if test="caseIds != null and caseIds.size > 0">
|
||
AND
|
||
t1.case_id IN
|
||
<foreach collection="caseIds" item="item" open="(" separator="," close=")">
|
||
#{item}
|
||
</foreach>
|
||
</if>
|
||
</select>
|
||
|
||
<!-- 部门列表 -->
|
||
<select id="listDept" parameterType="map" resultMap="handleDepartmentDTO">
|
||
SELECT
|
||
department_id,
|
||
department_name
|
||
FROM
|
||
sys_department
|
||
WHERE
|
||
is_delete = 0
|
||
<if test="departmentParentId != null and departmentParentId != ''">
|
||
AND
|
||
department_parent_id = #{departmentParentId}
|
||
</if>
|
||
</select>
|
||
|
||
|
||
</mapper> |