kcscDev/kcsc-back-end/src/main/resources/mybatisMapper/StandardCodeMapper.xml

115 lines
3.0 KiB
XML
Raw Normal View History

2023-10-31 05:59:10 +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.kcscbackend.standardCode.mapper.StandardCodeMapper">
<select id="selectStandardCodeList" parameterType="TnDocumentInfo" resultType="TnDocumentInfo">
2023-10-31 05:59:10 +00:00
SELECT
2023-11-03 02:24:34 +00:00
tdi.doc_info_seq,
tdi.use_yn,
tdi.rvsn_ymd,
tdi.rvsn_file_grp_id,
tdi.old_seq,
tdi.old_kcsc_cd,
tdi.last_yn,
tdi.last_chg_id,
tdi.last_chg_dt,
tdi.kcsc_cd,
tdi.group_seq,
tdi.frst_crt_id,
tdi.frst_crt_dt,
tdi.estb_ymd,
tdi.doc_yr,
tdi.doc_rvsn_remark,
tdi.doc_rev_hist_seq,
tdi.doc_relation,
tdi.doc_publish,
tdi.doc_order,
tdi.doc_nm,
tdi.doc_file_grp_id,
tdi.doc_er,
tdi.doc_dept,
tdi.doc_cycl,
tdi.doc_consider,
tdi.doc_brief,
tdi.doc_advice,
tdi.aplcn_end_ymd,
tdi.aplcn_bgng_ymd
2023-10-31 05:59:10 +00:00
FROM
2023-11-03 02:24:34 +00:00
tn_document_info tdi, tn_document_group tdg
<include refid="selectStandardCodeListWhere"></include>
ORDER BY tdi.kcsc_cd
2023-10-31 05:59:10 +00:00
LIMIT #{recordCountPerPage} OFFSET #{firstIndex}
</select>
<select id="selectStandardCodeListCnt" parameterType="TnDocumentInfo" resultType="int">
2023-10-31 05:59:10 +00:00
SELECT count(*)
FROM
2023-11-03 02:24:34 +00:00
tn_document_info tdi, tn_document_group tdg
<include refid="selectStandardCodeListWhere"></include>
2023-10-31 05:59:10 +00:00
</select>
2023-11-03 02:24:34 +00:00
<sql id="selectStandardCodeListWhere">
<where>
and tdi.group_seq = tdg.group_seq
and tdi.kcsc_cd like 'KDS%'
and tdi.last_yn = 'Y'
and tdi.use_yn = 'Y'
<if test="listCode != null and listCode != ''">
and tdg.group_full_cd like #{listCode} || '%'
</if>
</where>
</sql>
<select id="selectStandardCodeRevisionhistoryList" resultType="TnDocumentInfo">
select tdi.aplcn_bgng_ymd,tdi.doc_file_grp_id from tn_document_info tdi, tn_document_group tdg
where 1 = 1
and tdi.group_seq = tdg.group_seq
and tdi.kcsc_cd like 'KDS%'
and tdi.group_seq =#{groupseq}
and tdi.use_yn = 'Y'
order by tdi.kcsc_cd;
</select>
<select id="selectStandardcodelist" resultType="TnDocumentCodeList">
select
case
when a3.doc_level > 1 then a3.doc_code_name
else a2.doc_code_name
end as main_category,
case
when a3.doc_level > 1 then a2.doc_code_name
else a.group_nm
end as middle_category,
a.group_nm,
a.kcsc_cd,
tdi.doc_file_grp_id,
a.group_seq,
count(tdc.full_content) as contentcount
from
tn_document_group a
left join tn_document_info tdi on
a.group_seq = tdi.group_seq
left join tn_document_content tdc on
tdi.doc_info_seq = tdc.doc_info_seq,
sp_get_tn_document_code_by_tree() a2,
sp_get_tn_document_code_by_tree() a3
where
a.parent_group_seq = a2.seq
and a2.parent_seq = a3.seq
and a.group_full_cd like #{code} || '%'
and a.group_type = 'D'
and tdi.last_yn = 'Y'
group by
main_category,
middle_category,
a.group_nm,
a.kcsc_cd,
tdi.doc_file_grp_id,
a.group_seq
order by
a.kcsc_cd;
</select>
2023-10-31 05:59:10 +00:00
</mapper>