FAISP/src/main/resources/mybatisMapper/InternationalCrimeArrestMap...

108 lines
3.5 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.dbnt.faisp.main.faStatistics.internationalCrimeArrest.mapper.InternationalCrimeArrestMapper">
<sql id="selectInternationalCrimeArrestListWhere">
<where>
status &lt;> 'DST008'
<if test='organ != null and organ != ""'>
AND organ = #{organ}
</if>
<if test='department != null and department != ""'>
AND department = #{department}
</if>
<if test='crimeType != null and crimeType != ""'>
AND crime_type = #{crimeType}
</if>
<if test='violationType != null and violationType != ""'>
AND violation_type = #{violationType}
</if>
<if test='caseNum != null and caseNum != ""'>
AND case_num = #{caseNum}
</if>
<if test='crimeName != null and crimeName != ""'>
AND crime_name LIKE CONCAT('%', #{crimeName}, '%')
</if>
<if test='occurTable != null and occurTable != ""'>
AND occur_table LIKE CONCAT('%', #{occurTable}, '%')
</if>
<if test='arrestTable != null and arrestTable != ""'>
AND arrest_table LIKE CONCAT('%', #{arrestTable}, '%')
</if>
<if test='suspectTable != null and suspectTable != ""'>
AND suspect_table LIKE CONCAT('%', #{suspectTable}, '%')
</if>
<if test='crimeAwarenessDt != null'>
And crime_awareness_dt = #{crimeAwarenessDt}::DATE
</if>
<if test='caseSentDt != null'>
AND case_sent_dt = #{caseSentDt}::DATE
</if>
<if test='processResult != null and processResult != ""'>
AND ica_key in (
select ica_key
from ica_suspect_info
where process_result = #{processResult}
)
</if>
<if test='dateSelector == "wrtDt"'>
<if test='startDate != null and startDate != ""'>
And wrt_dt >= #{startDate}::DATE
</if>
<if test='endDate != null and endDate != ""'>
AND wrt_dt &lt;= #{endDate}::DATE+1
</if>
</if>
</where>
</sql>
<select id="selectInternationalCrimeArrestList" resultType="InternationalCrimeArrest" parameterType="InternationalCrimeArrest">
SELECT a.ica_key,
a.organ,
a.department,
a.case_officer,
a.crime_type,
a.violation_type,
a.crime_name,
a.occur_table,
a.arrest_table,
a.suspect_table,
a.crime_awareness_dt,
a.case_sent_dt,
a.case_num,
a.wrt_organ,
a.wrt_part,
a.wrt_user_grd,
a.wrt_user_nm,
a.wrt_dt
FROM international_crime_arrest a
<include refid="selectInternationalCrimeArrestListWhere"></include>
ORDER BY a.ica_key DESC
LIMIT #{rowCnt} OFFSET #{firstIndex}
</select>
<select id="selectInternationalCrimeArrestListCnt" resultType="int" parameterType="InternationalCrimeArrest">
SELECT count(*)
FROM international_crime_arrest a
<include refid="selectInternationalCrimeArrestListWhere"></include>
</select>
<select id="selectSuspectPersonInfoParamList" resultType="com.dbnt.faisp.util.ParamMap" parameterType="int">
SELECT
s.spi_key,
s.ica_key,
s.sex,
s.age,
s.country,
s.stay_qualification,
s.stay_period_expired_dt,
s.entry_visa
FROM suspect_person_info s
INNER JOIN international_crime_arrest i
ON s.ica_key = i.ica_key
WHERE s.ica_key = #{icaKey}
</select>
</mapper>