Canvas 상태 Api 수정
This commit is contained in:
parent
b93e9e0d18
commit
0271a145c9
@ -10,14 +10,13 @@ import lombok.Setter;
|
||||
public class CanvasGridSettingInfo {
|
||||
|
||||
private String objectNo; //견적서 번호
|
||||
private Integer dotGridDisplay; //점 그리드 표시
|
||||
private Integer lineGridDisplay; //선 그리드 표시
|
||||
private boolean gridChk01; //선택01
|
||||
private boolean gridChk02; //선택02
|
||||
private boolean dotGridDisplay; //점 그리드 표시
|
||||
private boolean lineGridDisplay; //선 그리드 표시
|
||||
private Integer gridType; //그리드 설정 타입
|
||||
private Integer gridHorizon; //가로 간격
|
||||
private Integer gridVertical; //세로 간격
|
||||
private Integer gridRatio; //비율 간격
|
||||
private Integer gridDimen; //치수 간격
|
||||
private String gridDimen; //치수 간격
|
||||
private Date registDatetime; //생성일시
|
||||
private Date lastEditDatetime; //수정일시
|
||||
private String returnMessage; //return message
|
||||
|
||||
@ -41,7 +41,7 @@ public class CanvasStatusController {
|
||||
|
||||
@Operation(description = "견적서를 수정 한다.")
|
||||
@PutMapping("/canvas-statuses")
|
||||
public void updateCanvasStatus(@RequestBody CanvasStatus cs) {
|
||||
public void updateCanvasStatus(@RequestBody CanvasStatus cs) throws CanvasStatusException {
|
||||
canvasStatusService.updateCanvasStatus(cs);
|
||||
}
|
||||
|
||||
@ -53,10 +53,10 @@ public class CanvasStatusController {
|
||||
}
|
||||
|
||||
@Operation(description = "견적서의 이미지(템플릿)를 삭제 한다.")
|
||||
@DeleteMapping("/canvas-statuses/{id}")
|
||||
@DeleteMapping("/canvas-statuses/by-id/{id}")
|
||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||
public void deleteImageNameCanvasStatus(@PathVariable Integer id) {
|
||||
canvasStatusService.deleteImageNameCanvasStatus(id);
|
||||
public void deleteIdCanvasStatus(@PathVariable Integer id) {
|
||||
canvasStatusService.deleteIdCanvasStatus(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -22,8 +22,11 @@ public interface CanvasStatusMapper {
|
||||
// 견적서 조회(objectNo)
|
||||
public List<CanvasStatusResponse> selectObjectNoCanvasStatus(String objectNo, String userId);
|
||||
|
||||
// 견적서 조회(id)
|
||||
public List<CanvasStatusResponse> selectIdCanvasStatus(String objectNo, String userId);
|
||||
// 견적서 조회(Max id)
|
||||
public List<CanvasStatusResponse> getMaxIdCanvasStatus(String objectNo, String userId);
|
||||
|
||||
// 견적서 조회(id별)
|
||||
public List<CanvasStatusResponse> getIdCanvasStatus(Integer id);
|
||||
|
||||
// 견적서 등록
|
||||
public void insertCanvasStatus(CanvasStatus cs);
|
||||
@ -35,7 +38,7 @@ public interface CanvasStatusMapper {
|
||||
public void deleteObjectNoCanvasStatus(String objectNo);
|
||||
|
||||
// 이미지(템플릿) 삭제
|
||||
public void deleteImageNameCanvasStatus(Integer id);
|
||||
public void deleteIdCanvasStatus(Integer id);
|
||||
|
||||
|
||||
}
|
||||
@ -30,20 +30,12 @@ public class CanvasStatusService {
|
||||
|
||||
Integer id = 0;
|
||||
|
||||
// 먼저 데이터가 존재하는지 확인
|
||||
List<CanvasStatusResponse> existingStatus = canvasStatusMapper.selectObjectNoCanvasStatus(cs.getObjectNo(), cs.getUserId());
|
||||
|
||||
// 데이터가 이미 존재하면 저장하지 않고 예외를 던짐
|
||||
if (existingStatus.size() > 0) {
|
||||
throw new CanvasStatusException("해당 objectNo로 이미 견적서가 존재합니다.");
|
||||
}
|
||||
|
||||
// 데이터가 없으면 저장
|
||||
try {
|
||||
canvasStatusMapper.insertCanvasStatus(cs);
|
||||
|
||||
// 데이터 저장 후 Max id 확인
|
||||
List<CanvasStatusResponse> maxId = canvasStatusMapper.selectIdCanvasStatus(cs.getObjectNo(), cs.getUserId());
|
||||
List<CanvasStatusResponse> maxId = canvasStatusMapper.getMaxIdCanvasStatus(cs.getObjectNo(), cs.getUserId());
|
||||
id = maxId.get(0).getId();
|
||||
|
||||
} catch (Exception e) {
|
||||
@ -56,18 +48,40 @@ public class CanvasStatusService {
|
||||
}
|
||||
|
||||
// 견적서 수정
|
||||
public void updateCanvasStatus(CanvasStatus cs) {
|
||||
canvasStatusMapper.updateCanvasStatus(cs);
|
||||
public void updateCanvasStatus(CanvasStatus cs) throws CanvasStatusException {
|
||||
|
||||
// 먼저 데이터가 존재하는지 확인
|
||||
List<CanvasStatusResponse> existingStatus = canvasStatusMapper.getIdCanvasStatus(cs.getId());
|
||||
|
||||
// 데이터가 존재하지 않으면 수정하지 않고 예외를 던짐
|
||||
if (existingStatus.size() > 0) {
|
||||
canvasStatusMapper.updateCanvasStatus(cs);
|
||||
} else {
|
||||
throw new CanvasStatusException("수정할 견적서가 존재하지 않습니다.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 견적서 삭제
|
||||
// 전체 견적서 삭제
|
||||
public void deleteObjectNoCanvasStatus(String objectNo) {
|
||||
|
||||
canvasStatusMapper.deleteObjectNoCanvasStatus(objectNo);
|
||||
|
||||
}
|
||||
|
||||
// 이미지(템플릿) 삭제
|
||||
public void deleteImageNameCanvasStatus(Integer id) {
|
||||
canvasStatusMapper.deleteImageNameCanvasStatus(id);
|
||||
public void deleteIdCanvasStatus(Integer id) {
|
||||
|
||||
// 먼저 데이터가 존재하는지 확인
|
||||
List<CanvasStatusResponse> existingStatus = canvasStatusMapper.getIdCanvasStatus(id);
|
||||
|
||||
// 데이터가 존재하지 않으면 수정하지 않고 예외를 던짐
|
||||
if (existingStatus.size() > 0) {
|
||||
canvasStatusMapper.deleteIdCanvasStatus(id);
|
||||
} else {
|
||||
throw new IllegalArgumentException("삭제할 견적서가 존재하지 않습니다.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class CanvasStatusResponse {
|
||||
private Integer id; //PK ID
|
||||
private Integer id; //PK ID
|
||||
private String userId; //사용자 ID
|
||||
private String objectNo; //견적서 번호
|
||||
private String imageName; //이미지명
|
||||
|
||||
@ -9,8 +9,7 @@
|
||||
SELECT object_no
|
||||
, dot_grid_display
|
||||
, line_grid_display
|
||||
, grid_chk01
|
||||
, grid_chk02
|
||||
, grid_type
|
||||
, grid_horizon
|
||||
, grid_vertical
|
||||
, grid_ratio
|
||||
@ -30,8 +29,7 @@
|
||||
UPDATE
|
||||
SET dot_grid_display = #{dotGridDisplay}
|
||||
, line_grid_display = #{lineGridDisplay}
|
||||
, grid_chk01 = #{gridChk01}
|
||||
, grid_chk02 = #{gridChk02}
|
||||
, grid_type = #{gridType]}
|
||||
, grid_horizon = #{gridHorizon}
|
||||
, grid_vertical = #{gridVertical}
|
||||
, grid_ratio = #{gridRatio}
|
||||
@ -44,8 +42,7 @@
|
||||
object_no
|
||||
, dot_grid_display
|
||||
, line_grid_display
|
||||
, grid_chk01
|
||||
, grid_chk02
|
||||
, grid_type
|
||||
, grid_horizon
|
||||
, grid_vertical
|
||||
, grid_ratio
|
||||
@ -56,8 +53,7 @@
|
||||
#{objectNo}
|
||||
, #{dotGridDisplay}
|
||||
, #{lineGridDisplay}
|
||||
, #{gridChk01}
|
||||
, #{gridChk02}
|
||||
, #{gridType}
|
||||
, #{gridHorizon}
|
||||
, #{gridVertical}
|
||||
, #{gridRatio}
|
||||
|
||||
@ -48,14 +48,21 @@
|
||||
AND user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectIdCanvasStatus" parameterType="string"
|
||||
<select id="getMaxIdCanvasStatus" parameterType="string"
|
||||
resultType="com.interplug.qcast.biz.canvasStatus.dto.CanvasStatusResponse">
|
||||
/* sqlid : com.interplug.qcast.canvasStatus.selectIdCanvasStatus 견적서 조회 */
|
||||
/* sqlid : com.interplug.qcast.canvasStatus.getMaxIdCanvasStatus 견적서 조회(Max id) */
|
||||
SELECT MAX(id) AS id
|
||||
FROM TB_CANVAS_STATUS
|
||||
WHERE object_no = #{objectNo}
|
||||
AND user_id = #{userId}
|
||||
</select>
|
||||
<select id="getIdCanvasStatus" parameterType="integer"
|
||||
resultType="com.interplug.qcast.biz.canvasStatus.dto.CanvasStatusResponse">
|
||||
/* sqlid : com.interplug.qcast.canvasStatus.getIdCanvasStatus 견적서 조회(id별) */
|
||||
SELECT id
|
||||
FROM TB_CANVAS_STATUS
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertCanvasStatus" parameterType="com.interplug.qcast.biz.canvasStatus.dto.CanvasStatus">
|
||||
/* sqlid : com.interplug.qcast.canvasStatus.insertCanvasStatus 견적서 등록 */
|
||||
@ -90,8 +97,8 @@
|
||||
WHERE object_no = #{objectNo}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteImageNameCanvasStatus" parameterType="integer">
|
||||
/* sqlid : com.interplug.qcast.canvasStatus.deleteImageNameCanvasStatus 이미지(템플릿) 삭제 */
|
||||
<delete id="deleteIdCanvasStatus" parameterType="integer">
|
||||
/* sqlid : com.interplug.qcast.canvasStatus.deleteIdCanvasStatus 이미지(템플릿) 삭제 */
|
||||
DELETE FROM TB_CANVAS_STATUS
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user