FAISP/src/main/resources/mybatisMapper/TranslatorMapper.xml

172 lines
5.1 KiB
XML
Raw Normal View History

2022-09-05 04:53:49 +00:00
<?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.translator.mapper.TranslatorMapper">
<select id="selectTranslatorList" resultType="Translator" parameterType="Translator">
2022-09-05 07:47:25 +00:00
select a.translator_key,
version_no,
c.item_value as ogdp1,
d.item_value as tr_lang,
2022-09-05 04:53:49 +00:00
tr_career,
tr_name,
2022-09-05 07:47:25 +00:00
e.item_value as tr_sex,
2022-09-05 04:53:49 +00:00
tr_age,
2022-09-05 07:47:25 +00:00
f.item_value as tr_nny,
g.item_value as tr_edu,
2022-09-05 04:53:49 +00:00
tr_cft,
2022-09-05 07:47:25 +00:00
h.item_value as tr_visa,
2022-09-05 04:53:49 +00:00
dml_yn,
apt_dt,
tr_phone
2022-09-05 07:47:25 +00:00
from translator_info a
inner join (select translator_key, max(version_no) as lastVer
from translator_info
group by translator_key) b
on a.translator_key =b.translator_key and a.version_no = b.lastVer
left outer join code_mgt c on a.ogdp1 = c.item_cd
left outer join code_mgt d on a.tr_lang = d.item_cd
left outer join code_mgt e on a.tr_sex = e.item_cd
left outer join code_mgt f on a.tr_nny = f.item_cd
left outer join code_mgt g on a.tr_edu = g.item_cd
left outer join code_mgt h on a.tr_visa = h.item_cd
2022-09-05 04:53:49 +00:00
where wrt_organ in
<foreach collection="organCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
<if test='trLang != null and trLang != ""'>
and tr_lang = #{trLang}
</if>
<if test='ogdp1 != null and ogdp1 != ""'>
and ogdp1 = #{ogdp1}
</if>
<if test='trName != null and trName != ""'>
and tr_name = #{trName}
</if>
<if test='trNny != null and trNny != ""'>
and tr_nny = #{trNny}
</if>
<if test='trVisa != null and trVisa != ""'>
and tr_visa = #{trVisa}
</if>
<if test='aptDt != null'>
and to_char(apt_dt,'YYYY-MM-DD') = #{aptDt}::VARCHAR
</if>
<if test='dmlYn != null and dmlYn != ""'>
and dml_yn = #{dmlYn}
</if>
2022-09-05 04:53:49 +00:00
order by translator_key desc
limit #{rowCnt} offset #{firstIndex}
</select>
<select id="selectTranslatorListCnt" resultType="int" parameterType="Translator">
select count(*)
2022-09-05 07:47:25 +00:00
from(
select a.translator_key,
version_no,
c.item_value as ogdp1,
d.item_value as tr_lang,
tr_career,
tr_name,
e.item_value as tr_sex,
tr_age,
f.item_value as tr_nny,
g.item_value as tr_edu,
tr_cft,
h.item_value as tr_visa,
dml_yn,
apt_dt,
tr_phone
from translator_info a
inner join (select translator_key, max(version_no) as lastVer
from translator_info
group by translator_key) b
on a.translator_key =b.translator_key and a.version_no = b.lastVer
left outer join code_mgt c on a.ogdp1 = c.item_cd
left outer join code_mgt d on a.tr_lang = d.item_cd
left outer join code_mgt e on a.tr_sex = e.item_cd
left outer join code_mgt f on a.tr_nny = f.item_cd
left outer join code_mgt g on a.tr_edu = g.item_cd
left outer join code_mgt h on a.tr_visa = h.item_cd
where wrt_organ in
2022-09-05 04:53:49 +00:00
<foreach collection="organCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
<if test='trLang != null and trLang != ""'>
and tr_lang = #{trLang}
</if>
<if test='ogdp1 != null and ogdp1 != ""'>
and ogdp1 = #{ogdp1}
</if>
<if test='trName != null and trName != ""'>
and tr_name = #{trName}
</if>
<if test='trNny != null and trNny != ""'>
and tr_nny = #{trNny}
</if>
<if test='trVisa != null and trVisa != ""'>
and tr_visa = #{trVisa}
</if>
<if test='aptDt != null'>
and to_char(apt_dt,'YYYY-MM-DD') = #{aptDt}::VARCHAR
</if>
<if test='dmlYn != null and dmlYn != ""'>
and dml_yn = #{dmlYn}
</if>
2022-09-05 07:47:25 +00:00
) a
2022-09-05 04:53:49 +00:00
</select>
2022-09-08 05:29:50 +00:00
<select id="selectHistoryList" resultType="Translator" parameterType="Translator">
select translator_key,
version_no,
wrt_nm,
wrt_dt
from translator_info
where translator_key = #{translatorKey}
order by wrt_dt desc
</select>
<select id="HistoryView" resultType="Translator" parameterType="Translator">
select a.translator_key,
version_no,
c.item_value as ogdp1,
d.item_value as tr_lang,
tr_career,
tr_name,
e.item_value as tr_sex,
tr_age,
f.item_value as tr_nny,
g.item_value as tr_edu,
tr_cft,
h.item_value as tr_visa,
dml_yn,
apt_dt,
tr_phone,
remark
from translator_info a
left outer join code_mgt c on a.ogdp1 = c.item_cd
left outer join code_mgt d on a.tr_lang = d.item_cd
left outer join code_mgt e on a.tr_sex = e.item_cd
left outer join code_mgt f on a.tr_nny = f.item_cd
left outer join code_mgt g on a.tr_edu = g.item_cd
left outer join code_mgt h on a.tr_visa = h.item_cd
where translator_key = #{translatorKey}
and version_no = #{versionNo}
</select>
<select id="selectCareerList" resultType="TranslatorCrr" parameterType="TranslatorCrr">
select career_seq,
translator_key,
his_gubun,
contents,
remark,
tc_dt
from translator_career
where translator_key = #{translatorKey}
and his_gubun = #{hisGubun}
order by career_seq desc
</select>
2022-09-05 04:53:49 +00:00
</mapper>