btxtgxq-system-bigdata/src/main/resources/mybatis/db2-mapper/kpi/report-case-mapper.xml
2023-08-29 15:52:50 +08:00

287 lines
10 KiB
XML

<?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.bigdata.dao2.kpi.IReportCaseDao">
<resultMap id="reportCasePO" type="com.cm.bigdata.pojo.pos.kpi.ReportCasePO">
<id column="report_case_id" property="reportCaseId"/>
<result column="area_id" property="areaId"/>
<result column="area_name" property="areaName"/>
<result column="community_id" property="communityId"/>
<result column="community_name" property="communityName"/>
<result column="case_type_id" property="caseTypeId"/>
<result column="case_type_name" property="caseTypeName"/>
<result column="is_self" property="isSelf"/>
<result column="grade" property="grade"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="modifier" property="modifier"/>
<result column="is_delete" property="isDelete"/>
<result column="case_status" property="caseStatus"/>
<result column="case_source" property="caseSource"/>
</resultMap>
<resultMap id="reportCaseDTO" type="com.cm.bigdata.pojo.dtos.kpi.ReportCaseDTO">
<id column="report_case_id" property="reportCaseId"/>
<result column="case_number" property="caseNumber"/>
<result column="area_id" property="areaId"/>
<result column="area_name" property="areaName"/>
<result column="case_photos" property="casePhotos"/>
<result column="case_audio" property="caseAudio"/>
<result column="community_id" property="communityId"/>
<result column="community_name" property="communityName"/>
<result column="case_source" property="caseSource"/>
<result column="case_status" property="caseStatus"/>
<result column="case_type_id" property="caseTypeId"/>
<result column="case_type_name" property="caseTypeName"/>
<result column="case_content" property="caseContent"/>
<result column="case_longitude" property="caseLongitude"/>
<result column="case_latitude" property="caseLatitude"/>
<result column="case_position" property="casePosition"/>
<result column="is_accept" property="isAccept"/>
<result column="is_deny" property="isDeny"/>
<result column="is_self" property="isSelf"/>
<result column="grade" property="grade"/>
<result column="case_reporter" property="caseReporter"/>
<result column="case_flow_type" property="caseFlowType"/>
<result column="case_flow_forward" property="caseFlowForward"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
</resultMap>
<resultMap id="reportCaseAcceptPO" type="com.cm.bigdata.pojo.pos.kpi.ReportCaseAcceptPO">
<id column="case_id" property="caseId"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
</resultMap>
<resultMap id="reportCaseAssignPO" type="com.cm.bigdata.pojo.pos.kpi.ReportCaseAssignPO">
<id column="case_id" property="caseId"/>
<result column="handle_user_id" property="handleUserId"/>
<result column="handle_time" property="handleTime"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
</resultMap>
<resultMap id="reportCaseHandlePO" type="com.cm.bigdata.pojo.pos.kpi.ReportCaseHandlePO">
<id column="case_id" property="caseId"/>
<result column="handle_time" property="handleTime"/>
<result column="handle_timeout" property="handleTimeout"/>
<result column="is_inspect" property="isInspect"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="modifier" property="modifier"/>
</resultMap>
<resultMap id="reportCaseInspectPO" type="com.cm.bigdata.pojo.pos.kpi.ReportCaseInspectPO">
<id column="case_id" property="caseId"/>
<result column="is_pass" property="isPass"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="modifier" property="modifier"/>
</resultMap>
<resultMap id="reportCaseLogDTO" type="com.cm.bigdata.pojo.dtos.kpi.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>
<select id="listPO" parameterType="map" resultMap="reportCasePO">
SELECT
report_case_id,
area_id,
area_name,
community_id,
community_name,
case_type_id,
case_type_name,
is_self,
grade,
gmt_create,
creator,
gmt_modified,
modifier,
is_delete,
case_status,
case_source
FROM
city_report_case
<where>
<if test="caseStatus != null">
AND
case_status = #{caseStatus}
</if>
</where>
</select>
<select id="listAcceptPO" parameterType="map" resultMap="reportCaseAcceptPO">
SELECT
case_id,
gmt_create,
creator
FROM
city_report_case_accept
</select>
<select id="listAssignPO" parameterType="map" resultMap="reportCaseAssignPO">
SELECT
case_id,
handle_user_id,
handle_time,
gmt_create,
creator
FROM
city_report_case_assign
</select>
<select id="listHandlePO" parameterType="map" resultMap="reportCaseHandlePO">
SELECT
case_id,
handle_time,
handle_timeout,
is_inspect,
gmt_create,
creator,
gmt_modified,
modifier
FROM
city_report_case_handle
</select>
<select id="listInspectPO" parameterType="map" resultMap="reportCaseInspectPO">
SELECT
case_id,
is_pass,
gmt_create,
creator,
gmt_modified,
modifier
FROM
city_report_case_inspect
</select>
<select id="list" parameterType="map" resultMap="reportCaseDTO">
SELECT
crc.report_case_id,
crc.case_number,
crc.area_id,
crc.area_name,
crc.case_photos,
crc.case_audio,
crc.community_id,
crc.community_name,
crc.case_source,
crc.case_status,
crc.case_type_id,
crc.case_type_name,
crc.case_content,
crc.case_longitude,
crc.case_latitude,
crc.case_position,
crc.is_accept,
crc.is_deny,
crc.is_self,
crc.grade,
crc.case_reporter,
crc.case_flow_type,
crc.case_flow_forward,
crc.creator,
crc.gmt_create,
crc.modifier,
crc.gmt_modified
FROM
city_report_case crc
WHERE
crc.is_delete = 0
<if test="areaId != null and areaId != ''">
AND
crc.area_id = #{areaId}
</if>
<if test="communityId != null and communityId != ''">
AND
crc.community_id = #{communityId}
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(crc.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(crc.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="userId != null and userId != ''">
AND
crc.creator = #{userId}
</if>
<if test="handleUserId != null and handleUserId != ''">
AND
crc.report_case_id IN (
SELECT
crca.case_id
FROM
city_report_case_assign crca
WHERE
crca.is_delete = 0
AND
crca.handle_user_id = #{handleUserId}
)
</if>
<if test="isAccept != null and isAccept == 1">
AND
crc.case_status > 1
</if>
<if test="isHandle != null and isHandle == 1">
AND
crc.case_status > 3
</if>
<if test="isInspect != null and isInspect == 1">
AND
crc.case_status > 4
</if>
<if test="isOnfile != null and isOnfile == 1">
AND
crc.case_status > 5
</if>
ORDER BY
crc.gmt_create DESC
</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>
</mapper>