refactor: 캔버스 복사 시 id 리턴 추가

This commit is contained in:
Daseul Kim 2025-02-07 11:30:46 +09:00
parent b7952efce9
commit a22dbffe4e
4 changed files with 40 additions and 16 deletions

View File

@ -43,5 +43,5 @@ public interface CanvasStatusMapper {
public void deleteIdCanvasStatus(Integer id);
// 캔버스 복사
public void copyCanvasStatus(CanvasStatusCopyRequest cs);
public int copyCanvasStatus(CanvasStatusCopyRequest cs);
}

View File

@ -119,9 +119,10 @@ public class CanvasStatusService {
}
// 캔버스 복사 등록
public void copyCanvasStatus(CanvasStatusCopyRequest cs) throws QcastException {
public int copyCanvasStatus(CanvasStatusCopyRequest cs) throws QcastException {
try {
canvasStatusMapper.copyCanvasStatus(cs);
return cs.getId();
} catch (Exception e) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, "캔버스 복사 중 오류 발생");
}

View File

@ -8,6 +8,9 @@ import lombok.Setter;
@Setter
@Schema(description = "캔버스 복사 요청 객체")
public class CanvasStatusCopyRequest {
@Schema(description = "ID", hidden = true)
private Integer id;
@Schema(description = "원본 물건 번호")
private String originObjectNo;

View File

@ -125,24 +125,44 @@
<insert id="copyCanvasStatus"
parameterType="com.interplug.qcast.biz.canvasStatus.dto.CanvasStatusCopyRequest">
/* sqlid : com.interplug.qcast.canvasStatus.copyCanvasStatus 캔버스 복사 */
<selectKey resultType="int" keyProperty="id" order="AFTER">
SELECT id
FROM TB_CANVAS_STATUS
WHERE object_no = #{objectNo} AND plan_no = #{planNo}
</selectKey>
INSERT INTO TB_CANVAS_STATUS
(user_id,
object_no,
plan_no,
regist_datetime,
canvas_status,
bg_image_name,
map_position_address)
object_no,
plan_no,
regist_datetime,
canvas_status,
bg_image_name,
map_position_address)
SELECT #{userId},
#{objectNo},
#{planNo},
GETDATE(),
canvas_status,
bg_image_name,
map_position_address
#{objectNo},
#{planNo},
GETDATE(),
canvas_status,
bg_image_name,
map_position_address
FROM TB_CANVAS_STATUS
WHERE object_no = #{originObjectNo}
AND plan_no = #{originPlanNo}
AND plan_no = #{originPlanNo}
</insert>
</mapper>