배치면 초기 설정 CRUD API
This commit is contained in:
parent
e572faaf4b
commit
d40932b3db
@ -0,0 +1,44 @@
|
|||||||
|
package com.interplug.qcast.biz.canvasBasicSetting;
|
||||||
|
|
||||||
|
import com.interplug.qcast.biz.canvasBasicSetting.dto.CanvasBasicSettingInfo;
|
||||||
|
import com.interplug.qcast.biz.canvasBasicSetting.dto.CanvasBasicSettingResponse;
|
||||||
|
import com.interplug.qcast.biz.excelDown.dto.NtrCtsCmpResponse;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/canvas-management")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Tag(name = "CanvasBasicSettingController", description = "Canvas Basic Setting 관련 API")
|
||||||
|
public class CanvasBasicSettingController {
|
||||||
|
private final CanvasBasicSettingService canvasBasicSettingService;
|
||||||
|
|
||||||
|
@Operation(description = "Canvas Basic Setting 정보를 조회 한다.")
|
||||||
|
@GetMapping("/canvas-basic-settings/by-object/{objectNo}")
|
||||||
|
public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(@PathVariable String objectNo) {
|
||||||
|
|
||||||
|
log.debug("Basic Setting 조회 ::::: " + objectNo);
|
||||||
|
|
||||||
|
return canvasBasicSettingService.selectCanvasBasicSetting(objectNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(description = "Canvas Basic Setting 정보를 등록 한다.")
|
||||||
|
@PostMapping("/canvas-basic-settings")
|
||||||
|
@ResponseStatus(HttpStatus.CREATED)
|
||||||
|
public String insertCanvasBasicSetting(@RequestBody CanvasBasicSettingInfo csi) {
|
||||||
|
|
||||||
|
log.debug("Basic Setting 등록 ::::: " + csi.getObjectNo());
|
||||||
|
|
||||||
|
return canvasBasicSettingService.insertCanvasBasicSetting(csi);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.interplug.qcast.biz.canvasBasicSetting;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import com.interplug.qcast.biz.canvasBasicSetting.dto.CanvasBasicSettingInfo;
|
||||||
|
import com.interplug.qcast.biz.canvasBasicSetting.dto.CanvasBasicSettingResponse;
|
||||||
|
import com.interplug.qcast.biz.canvasBasicSetting.dto.RoofMaterialsAddInfo;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface CanvasBasicSettingMapper {
|
||||||
|
|
||||||
|
// Canvas Basic Setting 조회(objectNo)
|
||||||
|
public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(String objectNo);
|
||||||
|
|
||||||
|
// Canvas Basic Setting 등록
|
||||||
|
public void insertCanvasBasicSetting(CanvasBasicSettingInfo csi);
|
||||||
|
|
||||||
|
// Canvas 지붕재추가 Setting 등록
|
||||||
|
public void insertRoofMaterialsAdd(RoofMaterialsAddInfo rma);
|
||||||
|
|
||||||
|
// Canvas 지붕재추가 Setting 삭제
|
||||||
|
public void deleteRoofMaterialsAdd(String objectNo);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
package com.interplug.qcast.biz.canvasBasicSetting;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.interplug.qcast.biz.canvasBasicSetting.dto.CanvasBasicSettingInfo;
|
||||||
|
import com.interplug.qcast.biz.canvasBasicSetting.dto.CanvasBasicSettingResponse;
|
||||||
|
import com.interplug.qcast.biz.canvasBasicSetting.dto.RoofMaterialsAddInfo;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CanvasBasicSettingService {
|
||||||
|
// @Autowired CanvasBasicSettingMapper canvasBasicSettingMapper;
|
||||||
|
private final CanvasBasicSettingMapper canvasBasicSettingMapper;
|
||||||
|
|
||||||
|
// Canvas Basic Setting 조회(objectNo)
|
||||||
|
public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(String objectNo) {
|
||||||
|
return canvasBasicSettingMapper.selectCanvasBasicSetting(objectNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Canvas Basic Setting 등록
|
||||||
|
public String insertCanvasBasicSetting(CanvasBasicSettingInfo csi) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// 도면/치수/각도 정보 insert/update
|
||||||
|
canvasBasicSettingMapper.insertCanvasBasicSetting(csi);
|
||||||
|
|
||||||
|
// 기존 지붕재추가 정보 삭제 후 insert
|
||||||
|
canvasBasicSettingMapper.deleteRoofMaterialsAdd(csi.getObjectNo());
|
||||||
|
|
||||||
|
// for-each 루프를 사용하여 지붕재추가 Setting
|
||||||
|
for (RoofMaterialsAddInfo rma : csi.getRoofMaterialsAddList()) {
|
||||||
|
|
||||||
|
rma.setObjectNo(csi.getObjectNo());
|
||||||
|
|
||||||
|
// 신규 지붕재추가 정보 insert
|
||||||
|
canvasBasicSettingMapper.insertRoofMaterialsAdd(rma);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("오류 발생 : " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 생성된 objectNo 반환
|
||||||
|
return csi.getObjectNo();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.interplug.qcast.biz.canvasBasicSetting.dto;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class CanvasBasicSettingInfo {
|
||||||
|
|
||||||
|
private String objectNo; //견적서 번호
|
||||||
|
private int roofDrawingSet; //도면(치수)
|
||||||
|
private int roofSizeSet; //치수(복사도/실측값/육지붕)
|
||||||
|
private String roofAngleSet; //각도(경사/각도)
|
||||||
|
private Date registDatetime; //생성일시
|
||||||
|
private Date lastEditDatetime; //수정일시
|
||||||
|
|
||||||
|
private List<RoofMaterialsAddInfo> roofMaterialsAddList;
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.interplug.qcast.biz.canvasBasicSetting.dto;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class CanvasBasicSettingResponse {
|
||||||
|
|
||||||
|
private String objectNo; //견적서 번호
|
||||||
|
private int roofDrawingSet; //도면(치수)
|
||||||
|
private int roofSizeSet; //치수(복사도/실측값/육지붕)
|
||||||
|
private String roofAngleSet; //각도(경사/각도)
|
||||||
|
private int roofSeq; //순번 SEQ
|
||||||
|
private int roofType; //타입
|
||||||
|
private int roofWidth; //넓이
|
||||||
|
private int roofHeight; //높이
|
||||||
|
private int roofGap; //간격
|
||||||
|
private String roofLayout; //방식
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.interplug.qcast.biz.canvasBasicSetting.dto;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class RoofMaterialsAddInfo {
|
||||||
|
|
||||||
|
private String objectNo; //견적서 번호
|
||||||
|
private int roofSeq; //순번 SEQ
|
||||||
|
private int roofType; //타입
|
||||||
|
private int roofWidth; //넓이
|
||||||
|
private int roofHeight; //높이
|
||||||
|
private int roofGap; //간격
|
||||||
|
private String roofLayout; //방식
|
||||||
|
private Date registDatetime; //생성일시
|
||||||
|
private Date lastEditDatetime; //수정일시
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
<?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.interplug.qcast.biz.canvasBasicSetting.CanvasBasicSettingMapper">
|
||||||
|
|
||||||
|
<select id="selectCanvasBasicSetting" parameterType="string"
|
||||||
|
resultType="com.interplug.qcast.biz.canvasBasicSetting.dto.CanvasBasicSettingResponse">
|
||||||
|
/* sqlid : com.interplug.qcast.canvasBasicSetting.selectCanvasBasicSetting Canvas Basic Setting 조회 */
|
||||||
|
SELECT cbs.object_no
|
||||||
|
, cbs.roof_drawing_set
|
||||||
|
, cbs.roof_size_set
|
||||||
|
, cbs.roof_angle_set
|
||||||
|
, crma.roof_seq
|
||||||
|
, crma.roof_type
|
||||||
|
, crma.roof_width
|
||||||
|
, crma.roof_height
|
||||||
|
, crma.roof_gap
|
||||||
|
, crma.roof_layout
|
||||||
|
FROM TB_CANVAS_BASIC_SETUP cbs
|
||||||
|
, TB_CANVAS_ROOF_MATERIALS_ADD crma
|
||||||
|
WHERE cbs.object_no = crma.object_no
|
||||||
|
AND cbs.object_no = #{objectNo}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertCanvasBasicSetting" parameterType="com.interplug.qcast.biz.canvasBasicSetting.dto.CanvasBasicSettingInfo">
|
||||||
|
/* sqlid : com.interplug.qcast.canvasBasicSetting.insertCanvasBasicSetting Canvas Basic Setting 등록 */
|
||||||
|
MERGE TB_CANVAS_BASIC_SETUP AS target
|
||||||
|
USING (SELECT #{objectNo} AS object_no) AS source
|
||||||
|
ON (target.object_no = source.object_no)
|
||||||
|
WHEN MATCHED THEN
|
||||||
|
UPDATE
|
||||||
|
SET roof_drawing_set = #{roofDrawingSet}
|
||||||
|
, roof_size_set = #{roofSizeSet}
|
||||||
|
, roof_angle_set = #{roofAngleSet}
|
||||||
|
, last_edit_datetime = GETDATE()
|
||||||
|
|
||||||
|
WHEN NOT MATCHED THEN
|
||||||
|
INSERT
|
||||||
|
(
|
||||||
|
object_no
|
||||||
|
, roof_drawing_set
|
||||||
|
, roof_size_set
|
||||||
|
, roof_angle_set
|
||||||
|
, regist_datetime
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
#{objectNo}
|
||||||
|
, #{roofDrawingSet}
|
||||||
|
, #{roofSizeSet}
|
||||||
|
, #{roofAngleSet}
|
||||||
|
, GETDATE()
|
||||||
|
);
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertRoofMaterialsAdd" parameterType="com.interplug.qcast.biz.canvasBasicSetting.dto.CanvasBasicSettingInfo">
|
||||||
|
/* sqlid : com.interplug.qcast.canvasBasicSetting.insertRoofMaterialsAdd Canvas 지붕재추가 Setting 등록 */
|
||||||
|
INSERT INTO TB_CANVAS_ROOF_MATERIALS_ADD
|
||||||
|
(
|
||||||
|
object_no
|
||||||
|
, roof_seq
|
||||||
|
, roof_type
|
||||||
|
, roof_width
|
||||||
|
, roof_height
|
||||||
|
, roof_gap
|
||||||
|
, roof_layout
|
||||||
|
, regist_datetime
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
#{objectNo}
|
||||||
|
, #{roofSeq}
|
||||||
|
, #{roofType}
|
||||||
|
, #{roofWidth}
|
||||||
|
, #{roofHeight}
|
||||||
|
, #{roofGap}
|
||||||
|
, #{roofLayout}
|
||||||
|
, GETDATE()
|
||||||
|
);
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<delete id="deleteRoofMaterialsAdd" parameterType="string">
|
||||||
|
/* sqlid : com.interplug.qcast.canvasBasicSetting.deleteRoofMaterialsAdd Canvas 지붕재추가 Setting 삭제 */
|
||||||
|
DELETE FROM TB_CANVAS_ROOF_MATERIALS_ADD
|
||||||
|
WHERE object_no = #{objectNo}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user