You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
165 lines
8.0 KiB
XML
165 lines
8.0 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.supervision.police.mapper.ModelCaseMapper">
|
|
<select id="selectAll" resultType="com.supervision.police.domain.ModelCase">
|
|
select * from model_case
|
|
where 1=1
|
|
<if test="modelCase.id != null and modelCase.id != ''">
|
|
and id = #{modelCase.id}
|
|
</if>
|
|
<if test="modelCase.isDelete">
|
|
and data_status != '1'
|
|
</if>
|
|
<if test="!modelCase.isDelete">
|
|
and data_status = '1'
|
|
</if>
|
|
<if test="modelCase.caseAnalysisStatus != null and modelCase.caseAnalysisStatus != ''">
|
|
and case_analysis_status = #{modelCase.caseAnalysisStatus}
|
|
</if>
|
|
<if test="modelCase.caseNo != null and modelCase.caseNo != ''">
|
|
and case_no like concat('%', #{modelCase.caseNo}, '%')
|
|
</if>
|
|
<if test="modelCase.caseName != null and modelCase.caseName != ''">
|
|
and case_name like concat('%', #{modelCase.caseName}, '%')
|
|
</if>
|
|
<if test="modelCase.caseType != null and modelCase.caseType != null">
|
|
and FIND_IN_SET(#{modelCase.caseType}, case_type) > 0
|
|
</if>
|
|
<if test="modelCase.identifyResult != null and modelCase.identifyResult != ''">
|
|
and identify_result IN
|
|
<foreach item="item" collection="modelCase.identifyResult" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="modelCase.involvedPerson != null and modelCase.involvedPerson != ''">
|
|
and ( law_actor like concat('%', #{modelCase.involvedPerson}, '%') or law_party like concat('%',
|
|
#{modelCase.involvedPerson}, '%'))
|
|
</if>
|
|
<if test="modelCase.lawActor != null and modelCase.lawActor != ''">
|
|
and law_actor like concat('%', #{modelCase.lawActor}, '%')
|
|
</if>
|
|
<if test="modelCase.lawParty != null and modelCase.lawParty != ''">
|
|
and law_party like concat('%', #{modelCase.lawParty}, '%')
|
|
</if>
|
|
<if test="modelCase.updateStartTime != null">
|
|
and DATE_FORMAT(update_time, '%Y-%m-%d') >= DATE_FORMAT(#{modelCase.updateStartTime}, '%Y-%m-%d')
|
|
</if>
|
|
<if test="modelCase.updateEndTime != null">
|
|
and DATE_FORMAT(update_time, '%Y-%m-%d') <= DATE_FORMAT(#{modelCase.updateEndTime}, '%Y-%m-%d')
|
|
</if>
|
|
<if test="modelCase.orderType == 'DESC'">
|
|
order by ${modelCase.orderBy} desc
|
|
</if>
|
|
<if test="modelCase.orderType == 'ASC'">
|
|
order by ${modelCase.orderBy} asc
|
|
</if>
|
|
</select>
|
|
<select id="selectMaxIndex" resultType="java.lang.Integer">
|
|
select ifnull(max(index_num), 0)
|
|
from model_case
|
|
where data_status = '1'
|
|
</select>
|
|
<select id="getCaseIndexDetail" resultType="com.supervision.police.dto.IndexDetail">
|
|
select mi.name as indexName, mi.index_score as score, mir.index_result, mir.atomic_ids
|
|
from model_index mi
|
|
left join model_index_result mir on mi.id = mir.index_id
|
|
WHERE mi.data_status = '1'
|
|
and mir.case_id = #{caseId}
|
|
and mi.index_type = #{indexType}
|
|
</select>
|
|
<select id="getAtomicDetail" resultType="com.supervision.police.dto.AtomicIndexDTO">
|
|
select
|
|
mar.index_id as indexId,
|
|
mai.id as atomicIndexId,
|
|
mai.name as indexName,
|
|
mai.index_source as indexSource,
|
|
mar.atomic_result as atomicResult,
|
|
mar.record_split_id as recordSplitId
|
|
from model_atomic_result mar
|
|
left join model_atomic_index mai on mar.atomic_id = mai.id
|
|
where mar.case_id = #{caseId} and mar.index_id = #{indexId} and mar.atomic_id in
|
|
<foreach collection="atomicIds" item="item" open="(" close=")" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</select>
|
|
<select id="getIndexDetail" resultType="com.supervision.police.dto.IndexDetail">
|
|
select mi.id as indexId,
|
|
mi.name as indexName,
|
|
mi.index_score as score,
|
|
mir.index_result,
|
|
mir.pre_result as preResult,
|
|
mir.atomic_ids,
|
|
mi.judge_logic as judgeLogic
|
|
from model_index mi
|
|
left join model_index_result mir on (mi.id = mir.index_id and mir.case_id = #{caseId})
|
|
WHERE mi.data_status = '1'
|
|
and mi.index_type = #{indexType}
|
|
order by CASE mir.index_result WHEN 'true' THEN 1 WHEN 'false' THEN 2 else 0 END, mi.id desc
|
|
</select>
|
|
|
|
|
|
<select id="pageListIndexResult" resultType="com.supervision.police.dto.IndexDetail">
|
|
|
|
select mi.id as indexId,
|
|
mi.name as indexName,
|
|
mi.index_score as score,
|
|
mir.index_result,
|
|
mir.pre_result as preResult,
|
|
mir.atomic_ids,
|
|
mi.judge_logic as judgeLogic,
|
|
mi.index_rule as indexRule
|
|
from model_index mi
|
|
left join model_index_result mir on (mi.id = mir.index_id and mir.case_id = #{query.caseId})
|
|
WHERE mi.data_status = '1'
|
|
and mi.index_type = #{query.indexType}
|
|
<if test="query.indexName != null and query.indexName != ''">
|
|
and mi.name like concat('%', #{query.indexName}, '%')
|
|
</if>
|
|
<choose>
|
|
<when test="query.indexResult != '' and query.indexResult == 0">
|
|
and mir.index_result is null
|
|
</when>
|
|
<when test="query.indexResult !='' and query.indexResult == 1">
|
|
and mir.index_result = 'true'
|
|
</when>
|
|
<when test="query.indexResult !='' and query.indexResult == 2">
|
|
and mir.index_result = 'false'
|
|
</when>
|
|
</choose>
|
|
and exists(select 1
|
|
from model_atomic_result mar
|
|
left join model_index_atomic_relation iar on mar.index_id = iar.model_index_id and mar.atomic_id = iar.atomic_index_id
|
|
left join model_atomic_index mai on mar.atomic_id = mai.id
|
|
where mar.case_id = #{query.caseId}
|
|
<if test="query.atomicName != null and query.atomicName != ''">
|
|
and mai.name like concat('%', #{query.atomicName}, '%')
|
|
</if>
|
|
<if test="query.indexSource != null and query.indexSource != ''">
|
|
and mai.index_source = #{query.indexSource}
|
|
</if>
|
|
<choose>
|
|
<when test="query.indexHasRecord != null and query.indexHasRecord == false">
|
|
and mar.record_split_id is null
|
|
</when>
|
|
<when test="query.indexHasRecord != null and query.indexHasRecord == true">
|
|
and mar.record_split_id is not null
|
|
</when>
|
|
</choose>
|
|
and mi.id = mar.index_id
|
|
<if test="query.indexHasRecord != null">
|
|
group by mar.index_id
|
|
having
|
|
<choose>
|
|
<when test="query.indexHasRecord == false">
|
|
sum(case when mar.record_split_id is not null then 1 else 0 end) = 0
|
|
</when>
|
|
<when test="query.indexHasRecord == true">
|
|
sum(case when mar.record_split_id is not null then 1 else 0 end) > 0
|
|
</when>
|
|
</choose>
|
|
</if>
|
|
)
|
|
order by CASE mir.index_result WHEN 'true' THEN 1 WHEN 'false' THEN 2 else 0 END, mi.id desc
|
|
|
|
</select>
|
|
</mapper> |