86 lines
3.0 KiB
XML
86 lines
3.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.dbnt.faisp.main.faStatistics.crackdownsStatus.mapper.SailorMapper">
|
||
|
|
<sql id="selectSailorListWhere">
|
||
|
|
<where>
|
||
|
|
<if test='year != null and year != ""'>
|
||
|
|
And EXTRACT(YEAR FROM s.wrt_dt) = EXTRACT(YEAR FROM CAST(#{year} AS DATE)::TIMESTAMP)
|
||
|
|
</if>
|
||
|
|
<if test='crackdownPolice != null and crackdownPolice != ""'>
|
||
|
|
AND crackdown_police = #{crackdownPolice}
|
||
|
|
</if>
|
||
|
|
<if test='crackdownBoat != null and crackdownBoat != ""'>
|
||
|
|
AND crackdown_boat = #{crackdownBoat}
|
||
|
|
</if>
|
||
|
|
<if test='sailorNameKr != null and sailorNameKr != ""'>
|
||
|
|
AND sailor_name_kr LIKE CONCAT('%', #{sailorNameKr}, '%')
|
||
|
|
</if>
|
||
|
|
<if test='residence != null and residence != ""'>
|
||
|
|
AND residence = #{residence}
|
||
|
|
</if>
|
||
|
|
<if test='education != null and education != ""'>
|
||
|
|
AND education = #{education}
|
||
|
|
</if>
|
||
|
|
<if test='position != null and position != ""'>
|
||
|
|
AND position = #{position}
|
||
|
|
</if>
|
||
|
|
<if test='career != null and career != ""'>
|
||
|
|
AND career = #{career}
|
||
|
|
</if>
|
||
|
|
<if test='similarCriminalHistory != null and similarCriminalHistory != ""'>
|
||
|
|
AND similar_criminal_history = #{similarCriminalHistory}
|
||
|
|
</if>
|
||
|
|
<if test='heterogeneousCriminalHistory != null and heterogeneousCriminalHistory != ""'>
|
||
|
|
AND heterogeneous_criminal_history = #{heterogeneousCriminalHistory}
|
||
|
|
</if>
|
||
|
|
<if test='arrestHistory != null and arrestHistory != ""'>
|
||
|
|
AND arrest_history = #{arrestHistory}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="selectSailorList" resultType="Sailor" parameterType="Sailor">
|
||
|
|
SELECT
|
||
|
|
s.sailor_key
|
||
|
|
, s.fb_key
|
||
|
|
, s.sailor_name_kr
|
||
|
|
, s.sailor_name_cn
|
||
|
|
, s.sailor_name_pinyin
|
||
|
|
, s.sailor_contact
|
||
|
|
, s.birthdate
|
||
|
|
, s.residence
|
||
|
|
, s.education
|
||
|
|
, s.position
|
||
|
|
, s.career
|
||
|
|
, s.similar_criminal_history
|
||
|
|
, s.heterogeneous_criminal_history
|
||
|
|
, s.arrest_history
|
||
|
|
, s.criminal_history_detail
|
||
|
|
, s.monthly_wages
|
||
|
|
, s.is_restriction
|
||
|
|
, s.note
|
||
|
|
, s.wrt_organ
|
||
|
|
, s.wrt_part
|
||
|
|
, s.wrt_user_seq
|
||
|
|
, s.wrt_user_grd
|
||
|
|
, s.wrt_user_nm
|
||
|
|
, s.wrt_dt
|
||
|
|
, sv.upd_dt AS updDt
|
||
|
|
FROM sailor s
|
||
|
|
INNER JOIN fishing_boat f
|
||
|
|
ON s.fb_key = f.fb_key
|
||
|
|
INNER JOIN crackdown_status cs
|
||
|
|
ON f.cds_key = cs.cds_key
|
||
|
|
INNER JOIN (
|
||
|
|
SELECT sailor_key ,MAX(wrt_dt) AS upd_dt
|
||
|
|
FROM sailor_version
|
||
|
|
GROUP BY sailor_key
|
||
|
|
) sv
|
||
|
|
ON s.sailor_key = sv.sailor_key
|
||
|
|
<include refid="selectSailorListWhere"></include>
|
||
|
|
ORDER BY s.sailor_key DESC
|
||
|
|
</select>
|
||
|
|
</mapper>
|