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 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 { try {
canvasStatusMapper.copyCanvasStatus(cs); canvasStatusMapper.copyCanvasStatus(cs);
return cs.getId();
} catch (Exception e) { } catch (Exception e) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, "캔버스 복사 중 오류 발생"); throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, "캔버스 복사 중 오류 발생");
} }

View File

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

View File

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