feat: 관리자 - 환경설정 - 위원회 코드관리 삭제 기능 구현 - backend
parent
29215ccaae
commit
d98798e7b5
|
|
@ -445,4 +445,43 @@ public class AdminConfigController extends BaseController {
|
||||||
return resultVO;
|
return resultVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(
|
||||||
|
summary = "'위원회 코드 관리' 페이지에서 위원회 코드 삭제하는 API",
|
||||||
|
description = "관리자 단에서 '환경설정' > '위원회코드 관리' 페이지에서 휴지통 모양 삭제 버튼으로 항목 삭제하는 API",
|
||||||
|
tags = {"AdminConfigController"}
|
||||||
|
)
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "등록 성공"),
|
||||||
|
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||||
|
})
|
||||||
|
@DeleteMapping(value = "/committee-code-management/{orgId}")
|
||||||
|
public ResultVO deleteSchedule
|
||||||
|
(
|
||||||
|
@AuthenticationPrincipal LoginVO user,
|
||||||
|
HttpServletRequest request,
|
||||||
|
@PathVariable("orgId") String strOrgId
|
||||||
|
) throws Exception {
|
||||||
|
|
||||||
|
ResultVO resultVO = new ResultVO();
|
||||||
|
Long orgId = Long.valueOf(strOrgId);
|
||||||
|
try {
|
||||||
|
resultVO = adminCommitteeCodeManagementService.deleteCommitteeCodeManagement(resultVO, request, user, orgId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
||||||
|
resultVO.setResultMessage(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println(
|
||||||
|
"\n--------------------------------------------------------------\n" +
|
||||||
|
request.getRequestURI() + " OUT:" +
|
||||||
|
"\n--------------------------------------------------------------\n" +
|
||||||
|
"resultVO.toString():" + "\n" +
|
||||||
|
resultVO.toString() + "\n" +
|
||||||
|
"\n--------------------------------------------------------------\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
return resultVO;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.dbnt.kcscbackend.admin.config.service.AdminCommitteeCodeManagementSer
|
||||||
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
||||||
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
||||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||||
|
import com.dbnt.kcscbackend.commonCode.entity.TnCmtOrg;
|
||||||
import com.dbnt.kcscbackend.commonCode.repository.TnCmtOrgRepository;
|
import com.dbnt.kcscbackend.commonCode.repository.TnCmtOrgRepository;
|
||||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||||
|
|
@ -110,7 +111,56 @@ public class AdminCommitteeCodeManagementServiceImpl extends EgovAbstractService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultVO deleteCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception {
|
public ResultVO deleteCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long cmtSeq) throws Exception {
|
||||||
return null;
|
System.out.println(
|
||||||
|
"\n--------------------------------------------------------------\n" +
|
||||||
|
request.getRequestURI() + " IN:" +
|
||||||
|
"\n--------------------------------------------------------------\n" +
|
||||||
|
"cmtSeq:" + "\n" +
|
||||||
|
cmtSeq + "\n" +
|
||||||
|
"\n--------------------------------------------------------------\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, Object> response = tnCmtOrgRepository.spDeleteTnCmtOrg(
|
||||||
|
cmtSeq.intValue(),
|
||||||
|
user.getId(),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
|
// 자식 코드들을 모두 제거한다.
|
||||||
|
getChildrenOrg(user, cmtSeq);
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, Object> dto = new HashMap<String, Object>();
|
||||||
|
dto.put("errorMessage", response.get("_error_message") );
|
||||||
|
dto.put("orgId", cmtSeq );
|
||||||
|
|
||||||
|
resultVO.setResult(dto);
|
||||||
|
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||||
|
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||||
|
|
||||||
|
return resultVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getChildrenOrg(LoginVO user, Long upCmtSeq) {
|
||||||
|
List<Map<String, Object>> list = tnCmtOrgRepository.findByUpCmtSeq(upCmtSeq).stream()
|
||||||
|
.map(item -> {
|
||||||
|
Map<String, Object> returnMap = new HashMap<>();
|
||||||
|
returnMap.put("cmtSeq", item.getCmtSeq());
|
||||||
|
getChildrenOrg( user, item.getCmtSeq() );
|
||||||
|
Map<String, Object> response = tnCmtOrgRepository.spDeleteTnCmtOrg(
|
||||||
|
item.getCmtSeq().intValue(),
|
||||||
|
user.getId(),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
return returnMap;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
System.out.println("for Debugging");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.dbnt.kcscbackend.commonCode.repository;
|
||||||
import com.dbnt.kcscbackend.commonCode.entity.TnCmtOrg;
|
import com.dbnt.kcscbackend.commonCode.entity.TnCmtOrg;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.jpa.repository.query.Procedure;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -40,4 +41,28 @@ public interface TnCmtOrgRepository extends JpaRepository<TnCmtOrg, TnCmtOrg.TnC
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Query(value = "CALL sp_delete_tn_cmt_org (" +
|
||||||
|
":_cmt_seq, " +
|
||||||
|
":_modi_id, " +
|
||||||
|
":_result_count, " +
|
||||||
|
":_result_code, " +
|
||||||
|
":_error_message)",
|
||||||
|
nativeQuery = true)
|
||||||
|
Map<String, Object> spDeleteTnCmtOrg(
|
||||||
|
@Param("_cmt_seq") Integer cmtSeq,
|
||||||
|
@Param("_modi_id") String modiId,
|
||||||
|
@Param("_result_count") Integer resultCount,
|
||||||
|
@Param("_result_code") String resultCode,
|
||||||
|
@Param("_error_message") String errorMessage
|
||||||
|
);
|
||||||
|
|
||||||
|
@Procedure("sp_is_valid_tn_cmt_org_id")
|
||||||
|
int spIsValidTnCmtOrgId( Integer cmtSeq );
|
||||||
|
|
||||||
|
TnCmtOrg findByCmtSeq(Long cmtSeq);
|
||||||
|
List<TnCmtOrg> findByUpCmtSeq(Long upCmtSeq);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue