87 lines
3.2 KiB
XML
87 lines
3.2 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.crackdownsStatus.mapper.ProcessResultMapper">
|
|
<sql id="selectProcessResultListWhere">
|
|
<where>
|
|
<if test='year != null and year != ""'>
|
|
And EXTRACT(YEAR FROM pr.wrt_dt) = EXTRACT(YEAR FROM CAST(#{year} AS DATE)::TIMESTAMP)
|
|
</if>
|
|
<if test='caseNum != null and caseNum != ""'>
|
|
AND caseNum = #{caseNum}
|
|
</if>
|
|
<if test='crackdownPolice != null and crackdownPolice != ""'>
|
|
AND crackdown_police = #{crackdownPolice}
|
|
</if>
|
|
<if test='boatNameKr != null and boatNameKr != ""'>
|
|
AND boat_name_kr LIKE CONCAT('%', #{boatNameKr}, '%')
|
|
</if>
|
|
<if test='violation != null and violation != ""'>
|
|
AND violation = #{violation}
|
|
</if>
|
|
<if test='sentencingCourt != null and sentencingCourt != ""'>
|
|
AND sentencing_court LIKE CONCAT('%', #{sentencingCourt}, '%')
|
|
</if>
|
|
<if test='sentencingDetail != null and sentencingDetail != ""'>
|
|
AND sentencing_detail LIKE CONCAT('%', #{sentencingDetail}, '%')
|
|
</if>
|
|
<if test='executionDetail != null and executionDetail != ""'>
|
|
AND execution_detail = #{executionDetail}
|
|
</if>
|
|
<if test='returnDt != null'>
|
|
AND return_dt = #{returnDt}::DATE
|
|
</if>
|
|
<if test='consignmentStartDt != null'>
|
|
AND consignment_start_dt = #{consignmentStartDt}::DATE
|
|
</if>
|
|
<if test='consignmentEndDt != null'>
|
|
AND consignment_end_dt = #{consignmentEndDt}::DATE
|
|
</if>
|
|
<if test='confiscationDt != null'>
|
|
AND confiscation_dt = #{confiscationDt}::DATE
|
|
</if>
|
|
<if test='boatDisposalDt != null'>
|
|
AND boat_disposal_dt = #{boatDisposalDt}::DATE
|
|
</if>
|
|
</where>
|
|
</sql>
|
|
|
|
<select id="selectProcessResultList" resultType="ProcessResult" parameterType="ProcessResult">
|
|
SELECT DISTINCT
|
|
pr.pr_key
|
|
, cs.cds_key
|
|
, cs.case_num
|
|
, cs.napo_sea_point_lon
|
|
, cs.napo_sea_point_lat
|
|
, cs.napo_sea_point_detail
|
|
, fb.boat_name_kr
|
|
, pr.sentencing_court
|
|
, pr.sentencing_detail
|
|
, pr.execution_detail
|
|
, pr.return_dt
|
|
, pr.consignment_start_dt
|
|
, pr.consignment_end_dt
|
|
, pr.confiscation_dt
|
|
, pr.boat_disposal_dt
|
|
, pr.wrt_dt
|
|
, prv.upd_dt AS updDt
|
|
FROM process_result pr
|
|
INNER JOIN crackdown_status cs
|
|
ON pr.cds_key = cs.cds_key
|
|
INNER JOIN fishing_boat fb
|
|
ON pr.cds_key = fb.cds_key
|
|
LEFT JOIN violation v
|
|
ON fb.fb_key = v.fb_key
|
|
INNER JOIN (
|
|
SELECT pr_key ,MAX(wrt_dt) AS upd_dt
|
|
FROM process_result_version
|
|
GROUP BY pr_key
|
|
) prv
|
|
ON pr.pr_key = prv.pr_key
|
|
<include refid="selectProcessResultListWhere"></include>
|
|
ORDER BY pr.pr_key DESC
|
|
LIMIT #{rowCnt} OFFSET #{firstIndex}
|
|
</select>
|
|
</mapper> |