veve-batch-material/target/root-0.0.1-SNAPSHOT/WEB-INF/classes/mapper/TmsMapper.xml
2025-07-21 11:43:14 +07:00

165 lines
5.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.veve_plus.root.mapper.TmsMapper">
<insert id="insertTranslation" parameterType="com.veve_plus.root.dto.tms.TranslationDto">
INSERT INTO tb_translation (
tms_id,
chapter,
language_code,
seq_no,
coordinate_x,
coordinate_y,
width,
height,
text_content,
color_code,
del_flg,
created_by,
updated_by,
created_time,
updated_time
) VALUES (
#{tmsId},
#{chapter},
#{languageCode},
#{seqNo},
#{positionX},
#{positionY},
#{width},
#{height},
#{textContent},
#{colorCode},
#{delFlg},
#{createdBy},
#{updatedBy},
SYSDATE(),
SYSDATE()
)
ON DUPLICATE KEY UPDATE
coordinate_x = #{positionX},
coordinate_y = #{positionY},
width = #{width},
height = #{height},
text_content = #{textContent},
color_code = #{colorCode},
del_flg = #{delFlg},
created_by = #{createdBy},
updated_by = #{updatedBy},
updated_time = SYSDATE()
</insert>
<insert id="insertProject" parameterType="com.veve_plus.root.dto.tms.ProjectDto">
INSERT INTO tb_tms_project (
project_id,
title,
version,
locale,
del_flg,
archived_flg,
bookmark_flg,
created_by,
updated_by,
created_time,
updated_time
) VALUES (
#{projectId},
#{title},
#{version},
#{locale},
#{delFlg},
#{archivedFlg},
#{bookmarkFlg},
#{createdBy},
#{updatedBy},
SYSDATE(),
SYSDATE()
)
ON DUPLICATE KEY UPDATE
title = #{title},
version = #{version},
locale = #{locale},
del_flg = #{delFlg},
archived_flg = #{archivedFlg},
bookmark_flg = #{bookmarkFlg},
created_by = #{createdBy},
updated_by = #{updatedBy},
updated_time = SYSDATE()
</insert>
<insert id="insertProjectLocale" parameterType="com.veve_plus.root.dto.tms.ProjectLocaleDto">
INSERT INTO tb_tms_project_locale (
project_id,
locale
)
SELECT
#{projectId},
#{locale}
WHERE NOT EXISTS (
SELECT *
FROM tb_tms_project_locale
WHERE project_id = #{projectId}
AND locale = #{locale}
)
</insert>
<select id="findProjectByTitle" resultType="com.veve_plus.root.dto.tms.ProjectDto">
SELECT project_id AS projectId
, title
FROM tb_tms_project
WHERE del_flg = 0
<if test="title != null and title != ''">
AND title LIKE CONCAT('%', #{title}, '%')
</if>
</select>
<select id="getTranslationList" resultType="com.veve_plus.root.dto.tms.TranslationDto">
WITH title_lang AS
(
SELECT c.content, c.tms_id, b.code_id, b.code_name, c.tooning_id, a.*
FROM tb_content_title a, tb_code b, tb_content c
WHERE a.language_code = b.code_id
AND c.idx = a.content_id
AND b.group_id = 27
<if test="platform == 'TMS'">
AND c.tms_id = #{tmsId}
</if>
<if test="platform == 'TN'">
AND c.tooning_id = #{tmsId}
</if>
AND b.code_name = #{languageCode}
LIMIT 0,1
)
SELECT tt.tms_id AS tmsId
, tt.chapter
, tt.language_code AS languageCode
, tt.seq_no AS seqNo
, tt.coordinate_x AS positionX
, tt.coordinate_y AS positionY
, tt.width
, tt.height
, tt.text_content AS textContent
, tt.color_code AS colorCode
, tc.font_size AS fontSize
, tc.font_type_code AS fontTypeCode
, tcc.code_name AS fontName
FROM title_lang tc
INNER JOIN tb_translation tt
ON tt.language_code = tc.code_name
AND tt.chapter = #{chapter}
<if test="platform == 'TMS'">
AND tt.tms_id = tc.tms_id
</if>
<if test="platform == 'TN'">
AND tt.tms_id = tc.tooning_id
</if>
AND tt.platform = #{platform}
LEFT JOIN tb_code tcc
ON tc.font_type_code = tcc.code_id
AND tcc.group_id = '28'
WHERE tc.del_yn = 0
ORDER BY tt.coordinate_y DESC;
</select>
</mapper>