btxtgxq-system-bigdata/src/main/resources/mybatis/db2-mapper/kpi/report-case-mapper.xml

230 lines
8.4 KiB
XML
Raw Normal View History

<?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>
<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
</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="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="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>
</mapper>