지붕재 할당 삭제 로직 및 컬럼 추가
This commit is contained in:
parent
455734c094
commit
b0d6de0d58
@ -24,12 +24,12 @@ public class CanvasBasicSettingController {
|
|||||||
private final CanvasBasicSettingService canvasBasicSettingService;
|
private final CanvasBasicSettingService canvasBasicSettingService;
|
||||||
|
|
||||||
@Operation(description = "Canvas Basic Setting 정보를 조회 한다.")
|
@Operation(description = "Canvas Basic Setting 정보를 조회 한다.")
|
||||||
@GetMapping("/canvas-basic-settings/by-object/{roofSeq}/{objectNo}")
|
@GetMapping("/canvas-basic-settings/by-object/{objectNo}")
|
||||||
public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(@PathVariable String roofSeq, @PathVariable String objectNo) {
|
public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(@PathVariable String objectNo) {
|
||||||
|
|
||||||
log.debug("Basic Setting 조회 ::::: " + objectNo + " : " + roofSeq);
|
log.debug("Basic Setting 조회 ::::: " + objectNo);
|
||||||
|
|
||||||
return canvasBasicSettingService.selectCanvasBasicSetting(roofSeq, objectNo);
|
return canvasBasicSettingService.selectCanvasBasicSetting(objectNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(description = "Canvas Basic Setting 정보를 등록 한다.")
|
@Operation(description = "Canvas Basic Setting 정보를 등록 한다.")
|
||||||
@ -42,11 +42,21 @@ public class CanvasBasicSettingController {
|
|||||||
return canvasBasicSettingService.insertCanvasBasicSetting(csi);
|
return canvasBasicSettingService.insertCanvasBasicSetting(csi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(description = "지붕면 할당 정보를 등록 한다.")
|
||||||
|
@PostMapping("/roof-allocation-settings/")
|
||||||
|
@ResponseStatus(HttpStatus.CREATED)
|
||||||
|
public Map<String, String> insertRoofAllocSetting(@RequestBody CanvasBasicSettingInfo csi) throws QcastException {
|
||||||
|
|
||||||
|
log.debug("지붕면 할당 등록 ::::: " + csi.getObjectNo());
|
||||||
|
|
||||||
|
return canvasBasicSettingService.insertRoofAllocSetting(csi);
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(description = "Canvas 지붕재추가 Setting 정보를 삭제 한다.")
|
@Operation(description = "Canvas 지붕재추가 Setting 정보를 삭제 한다.")
|
||||||
@DeleteMapping("/canvas-basic-settings/delete-RoofMaterials/{roofSeq}/{objectNo}")
|
@DeleteMapping("/canvas-basic-settings/delete-RoofMaterials/{objectNo}")
|
||||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||||
public void deleteRoofMaterialsAdd(@PathVariable String objectNo, @PathVariable String roofSeq) throws QcastException {
|
public void deleteRoofMaterialsAdd(@PathVariable String objectNo) throws QcastException {
|
||||||
canvasBasicSettingService.deleteRoofMaterialsAdd(objectNo, roofSeq);
|
canvasBasicSettingService.deleteRoofMaterialsAdd(objectNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ public interface CanvasBasicSettingMapper {
|
|||||||
public CanvasBasicSettingInfo getCanvasBasicSettingCnt(String objectNo);
|
public CanvasBasicSettingInfo getCanvasBasicSettingCnt(String objectNo);
|
||||||
|
|
||||||
// Canvas Basic Setting 조회(objectNo)
|
// Canvas Basic Setting 조회(objectNo)
|
||||||
public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(String roofSeq, String objectNo);
|
public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(String objectNo);
|
||||||
|
|
||||||
// Canvas Basic Setting 등록
|
// Canvas Basic Setting 등록
|
||||||
public void insertCanvasBasicSetting(CanvasBasicSettingInfo csi);
|
public void insertCanvasBasicSetting(CanvasBasicSettingInfo csi);
|
||||||
@ -24,7 +24,7 @@ public interface CanvasBasicSettingMapper {
|
|||||||
public void updateCanvasBasicSetting(CanvasBasicSettingInfo csi);
|
public void updateCanvasBasicSetting(CanvasBasicSettingInfo csi);
|
||||||
|
|
||||||
// Canvas 지붕재추가 Setting 유무 조회
|
// Canvas 지붕재추가 Setting 유무 조회
|
||||||
public RoofMaterialsAddInfo getRoofMaterialsCnt(String objectNo, String roofSeq);
|
public RoofMaterialsAddInfo getRoofMaterialsCnt(String objectNo);
|
||||||
|
|
||||||
// Canvas 지붕재추가 Setting 등록
|
// Canvas 지붕재추가 Setting 등록
|
||||||
public void insertRoofMaterialsAdd(RoofMaterialsAddInfo rma);
|
public void insertRoofMaterialsAdd(RoofMaterialsAddInfo rma);
|
||||||
@ -33,6 +33,6 @@ public interface CanvasBasicSettingMapper {
|
|||||||
public void updateRoofMaterialsAdd(RoofMaterialsAddInfo rma);
|
public void updateRoofMaterialsAdd(RoofMaterialsAddInfo rma);
|
||||||
|
|
||||||
// Canvas 지붕재추가 Setting 삭제
|
// Canvas 지붕재추가 Setting 삭제
|
||||||
public void deleteRoofMaterialsAdd(String objectNo, String roofSeq);
|
public void deleteRoofMaterialsAdd(String objectNo);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -22,8 +22,8 @@ public class CanvasBasicSettingService {
|
|||||||
private final CanvasBasicSettingMapper canvasBasicSettingMapper;
|
private final CanvasBasicSettingMapper canvasBasicSettingMapper;
|
||||||
|
|
||||||
// Canvas Basic Setting 조회(objectNo)
|
// Canvas Basic Setting 조회(objectNo)
|
||||||
public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(String roofSeq, String objectNo) {
|
public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(String objectNo) {
|
||||||
return canvasBasicSettingMapper.selectCanvasBasicSetting(roofSeq, objectNo);
|
return canvasBasicSettingMapper.selectCanvasBasicSetting(objectNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Canvas Basic Setting 등록
|
// Canvas Basic Setting 등록
|
||||||
@ -51,7 +51,6 @@ public class CanvasBasicSettingService {
|
|||||||
for (RoofMaterialsAddInfo rma : csi.getRoofMaterialsAddList()) {
|
for (RoofMaterialsAddInfo rma : csi.getRoofMaterialsAddList()) {
|
||||||
|
|
||||||
rma.setObjectNo(csi.getObjectNo());
|
rma.setObjectNo(csi.getObjectNo());
|
||||||
log.debug("rma 1111 ::::: " + rma);
|
|
||||||
// 신규 지붕재추가 정보 insert
|
// 신규 지붕재추가 정보 insert
|
||||||
canvasBasicSettingMapper.insertRoofMaterialsAdd(rma);
|
canvasBasicSettingMapper.insertRoofMaterialsAdd(rma);
|
||||||
}
|
}
|
||||||
@ -67,7 +66,6 @@ public class CanvasBasicSettingService {
|
|||||||
for (RoofMaterialsAddInfo rma : csi.getRoofMaterialsAddList()) {
|
for (RoofMaterialsAddInfo rma : csi.getRoofMaterialsAddList()) {
|
||||||
|
|
||||||
rma.setObjectNo(csi.getObjectNo());
|
rma.setObjectNo(csi.getObjectNo());
|
||||||
log.debug("rma 22222 ::::: " + rma);
|
|
||||||
// 신규 지붕재추가 정보 insert
|
// 신규 지붕재추가 정보 insert
|
||||||
canvasBasicSettingMapper.updateRoofMaterialsAdd(rma);
|
canvasBasicSettingMapper.updateRoofMaterialsAdd(rma);
|
||||||
}
|
}
|
||||||
@ -86,19 +84,56 @@ public class CanvasBasicSettingService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 지붕재추가 삭제
|
// 지붕면 할당 Setting 등록
|
||||||
public void deleteRoofMaterialsAdd(String objectNo, String roofSeq) throws QcastException {
|
public Map<String, String> insertRoofAllocSetting(CanvasBasicSettingInfo csi) throws QcastException {
|
||||||
|
|
||||||
if (objectNo == null || objectNo.trim().isEmpty() || roofSeq == null || roofSeq.trim().isEmpty()) {
|
Map<String, String> response = new HashMap<>();
|
||||||
|
|
||||||
|
if (csi.getObjectNo() == null) {
|
||||||
|
throw new QcastException (ErrorCode.INVALID_INPUT_VALUE ,"올바르지 않은 입력값입니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// 기존 지붕재추가 정보 삭제 후 insert
|
||||||
|
canvasBasicSettingMapper.deleteRoofMaterialsAdd(csi.getObjectNo());
|
||||||
|
|
||||||
|
int roofSeq = 0;
|
||||||
|
// for-each 루프를 사용하여 지붕재추가 Setting
|
||||||
|
for (RoofMaterialsAddInfo rma : csi.getRoofMaterialsAddList()) {
|
||||||
|
|
||||||
|
rma.setObjectNo(csi.getObjectNo());
|
||||||
|
rma.setRoofSeq(roofSeq++); //roofSeq는 순차적으로 새로 생성하여 insert
|
||||||
|
|
||||||
|
// 신규 지붕재추가 정보 insert
|
||||||
|
canvasBasicSettingMapper.insertRoofMaterialsAdd(rma);
|
||||||
|
}
|
||||||
|
response.put("objectNo", csi.getObjectNo());
|
||||||
|
response.put("returnMessage", "common.message.confirm.mark");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
response.put("objectNo", csi.getObjectNo());
|
||||||
|
response.put("returnMessage", "common.message.save.error");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 생성된 objectNo 반환
|
||||||
|
return response;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 지붕재추가 삭제
|
||||||
|
public void deleteRoofMaterialsAdd(String objectNo) throws QcastException {
|
||||||
|
|
||||||
|
if (objectNo == null || objectNo.trim().isEmpty()) {
|
||||||
throw new QcastException (ErrorCode.INVALID_INPUT_VALUE ,"올바르지 않은 입력값입니다.");
|
throw new QcastException (ErrorCode.INVALID_INPUT_VALUE ,"올바르지 않은 입력값입니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 먼저 데이터가 존재하는지 확인
|
// 먼저 데이터가 존재하는지 확인
|
||||||
RoofMaterialsAddInfo cntData = canvasBasicSettingMapper.getRoofMaterialsCnt(objectNo, roofSeq);
|
RoofMaterialsAddInfo cntData = canvasBasicSettingMapper.getRoofMaterialsCnt(objectNo);
|
||||||
|
|
||||||
// 데이터가 존재하지 않으면 수정하지 않고 예외를 던짐
|
// 데이터가 존재하지 않으면 수정하지 않고 예외를 던짐
|
||||||
if (cntData.getRoofCnt().intValue() > 0) {
|
if (cntData.getRoofCnt().intValue() > 0) {
|
||||||
canvasBasicSettingMapper.deleteRoofMaterialsAdd(objectNo, roofSeq);
|
canvasBasicSettingMapper.deleteRoofMaterialsAdd(objectNo);
|
||||||
} else {
|
} else {
|
||||||
throw new QcastException (ErrorCode.NOT_FOUND ,"삭제할 지붕재가 존재하지 않습니다.");
|
throw new QcastException (ErrorCode.NOT_FOUND ,"삭제할 지붕재가 존재하지 않습니다.");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,5 +18,7 @@ public class CanvasBasicSettingResponse {
|
|||||||
private Integer roofHajebichi; //하제비치
|
private Integer roofHajebichi; //하제비치
|
||||||
private String roofGap; //간격
|
private String roofGap; //간격
|
||||||
private String roofLayout; //방식
|
private String roofLayout; //방식
|
||||||
|
private Integer roofPitch; //경사도
|
||||||
|
private Float roofAngle; //각도
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,8 @@ public class RoofMaterialsAddInfo {
|
|||||||
private Integer roofHajebichi; //하제비치
|
private Integer roofHajebichi; //하제비치
|
||||||
private String roofGap; //간격
|
private String roofGap; //간격
|
||||||
private String roofLayout; //방식
|
private String roofLayout; //방식
|
||||||
|
private Integer roofPitch; //경사도
|
||||||
|
private Float roofAngle; //각도
|
||||||
private Integer roofCnt; //존재여부
|
private Integer roofCnt; //존재여부
|
||||||
private Date registDatetime; //생성일시
|
private Date registDatetime; //생성일시
|
||||||
private Date lastEditDatetime; //수정일시
|
private Date lastEditDatetime; //수정일시
|
||||||
|
|||||||
@ -25,13 +25,12 @@
|
|||||||
, crma.roof_hajebichi
|
, crma.roof_hajebichi
|
||||||
, crma.roof_gap
|
, crma.roof_gap
|
||||||
, crma.roof_layout
|
, crma.roof_layout
|
||||||
|
, crma.roof_pitch
|
||||||
|
, crma.roof_angle
|
||||||
FROM TB_CANVAS_BASIC_SETUP cbs
|
FROM TB_CANVAS_BASIC_SETUP cbs
|
||||||
LEFT JOIN TB_CANVAS_ROOF_MATERIALS_ADD crma
|
LEFT JOIN TB_CANVAS_ROOF_MATERIALS_ADD crma
|
||||||
ON cbs.object_no = crma.object_no
|
ON cbs.object_no = crma.object_no
|
||||||
WHERE cbs.object_no = #{objectNo}
|
WHERE cbs.object_no = #{objectNo}
|
||||||
<if test="roofSeq == 0">
|
|
||||||
AND crma.roof_seq = 0
|
|
||||||
</if>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertCanvasBasicSetting" parameterType="com.interplug.qcast.biz.canvasBasicSetting.dto.CanvasBasicSettingInfo">
|
<insert id="insertCanvasBasicSetting" parameterType="com.interplug.qcast.biz.canvasBasicSetting.dto.CanvasBasicSettingInfo">
|
||||||
@ -68,7 +67,6 @@
|
|||||||
SELECT COUNT(1) AS roofCnt
|
SELECT COUNT(1) AS roofCnt
|
||||||
FROM TB_CANVAS_BASIC_SETUP
|
FROM TB_CANVAS_BASIC_SETUP
|
||||||
WHERE object_no = #{objectNo}
|
WHERE object_no = #{objectNo}
|
||||||
AND roof_seq = #{roofSeq}
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertRoofMaterialsAdd" parameterType="com.interplug.qcast.biz.canvasBasicSetting.dto.RoofMaterialsAddInfo">
|
<insert id="insertRoofMaterialsAdd" parameterType="com.interplug.qcast.biz.canvasBasicSetting.dto.RoofMaterialsAddInfo">
|
||||||
@ -84,6 +82,8 @@
|
|||||||
, roof_hajebichi
|
, roof_hajebichi
|
||||||
, roof_gap
|
, roof_gap
|
||||||
, roof_layout
|
, roof_layout
|
||||||
|
, roof_pitch
|
||||||
|
, roof_angle
|
||||||
, regist_datetime
|
, regist_datetime
|
||||||
, last_edit_datetime
|
, last_edit_datetime
|
||||||
)
|
)
|
||||||
@ -97,6 +97,8 @@
|
|||||||
, #{roofHajebichi}
|
, #{roofHajebichi}
|
||||||
, #{roofGap}
|
, #{roofGap}
|
||||||
, #{roofLayout}
|
, #{roofLayout}
|
||||||
|
, #{roofPitch}
|
||||||
|
, #{roofAngle}
|
||||||
, GETDATE()
|
, GETDATE()
|
||||||
, GETDATE()
|
, GETDATE()
|
||||||
);
|
);
|
||||||
@ -118,6 +120,8 @@
|
|||||||
, roof_hajebichi = #{roofHajebichi}
|
, roof_hajebichi = #{roofHajebichi}
|
||||||
, roof_gap = #{roofGap}
|
, roof_gap = #{roofGap}
|
||||||
, roof_layout = #{roofLayout}
|
, roof_layout = #{roofLayout}
|
||||||
|
, roof_pitch = #{roofPitch}
|
||||||
|
, roof_angle = #{roofAngle}
|
||||||
, last_edit_datetime = GETDATE()
|
, last_edit_datetime = GETDATE()
|
||||||
WHEN NOT MATCHED THEN
|
WHEN NOT MATCHED THEN
|
||||||
INSERT
|
INSERT
|
||||||
@ -131,6 +135,8 @@
|
|||||||
, roof_hajebichi
|
, roof_hajebichi
|
||||||
, roof_gap
|
, roof_gap
|
||||||
, roof_layout
|
, roof_layout
|
||||||
|
, roof_pitch
|
||||||
|
, roof_angle
|
||||||
, regist_datetime
|
, regist_datetime
|
||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
@ -143,6 +149,8 @@
|
|||||||
, #{roofHajebichi}
|
, #{roofHajebichi}
|
||||||
, #{roofGap}
|
, #{roofGap}
|
||||||
, #{roofLayout}
|
, #{roofLayout}
|
||||||
|
, #{roofPitch}
|
||||||
|
, #{roofAngle}
|
||||||
, GETDATE()
|
, GETDATE()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -152,7 +160,6 @@
|
|||||||
/* sqlid : com.interplug.qcast.canvasBasicSetting.deleteRoofMaterialsAdd Canvas 지붕재추가 Setting 삭제 */
|
/* sqlid : com.interplug.qcast.canvasBasicSetting.deleteRoofMaterialsAdd Canvas 지붕재추가 Setting 삭제 */
|
||||||
DELETE FROM TB_CANVAS_ROOF_MATERIALS_ADD
|
DELETE FROM TB_CANVAS_ROOF_MATERIALS_ADD
|
||||||
WHERE object_no = #{objectNo}
|
WHERE object_no = #{objectNo}
|
||||||
AND roof_seq = #{roofSeq}
|
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user