diff --git a/src/main/java/com/xit/biz/ctgy/v2/repository/BoardDao.java b/src/main/java/com/xit/biz/ctgy/v2/repository/BoardDao.java index d2f2d25..0ce6b48 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/repository/BoardDao.java +++ b/src/main/java/com/xit/biz/ctgy/v2/repository/BoardDao.java @@ -42,7 +42,7 @@ public class BoardDao extends BaseMpowerDaoSupport { final String sql = QueryGenerator.createNamedQuery("board", "selectBoard") .setParameter("ciCode", ciCode) .getQueryString(); - final String fieldStrs = "ci_code, ci_contentno, ci_contents, ci_email, ci_hit, ci_id, ci_ip, ci_nalja, ci_name, ci_pass, ci_pwd, ci_ref, ci_revel, ci_step, ci_time, ci_title"; + final String fieldStrs = "ciCode, ciContentno, ciContents, ciEmail, ciHit, ciId, ciIp, ciNalja, ciName, ciPass, ciPwd, ciRef, ciRevel, ciStep, ciTime, ciTitle"; return Optional.ofNullable(selectOne(BoardDto.class, sql, fieldStrs)); } @@ -76,9 +76,9 @@ public class BoardDao extends BaseMpowerDaoSupport { update(sql); } - public int findByCiRefCnt(final Long ciCode) { + public int findByCiRefCnt(final Long ciRef) { final String sql = QueryGenerator.createNamedQuery("board", "selectCntByCiRef") - .setParameter("ciCode", ciCode) + .setParameter("ciRef", ciRef) .getQueryString(); return Integer.parseInt(selectOneColumn(sql)); } diff --git a/src/main/java/com/xit/biz/ctgy/v2/service/impl/BoardService.java b/src/main/java/com/xit/biz/ctgy/v2/service/impl/BoardService.java index 1822af4..a04a6b4 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/service/impl/BoardService.java +++ b/src/main/java/com/xit/biz/ctgy/v2/service/impl/BoardService.java @@ -69,7 +69,7 @@ public class BoardService implements IBoardService { BoardDto savedDto = boardDao.findById(ciCode).orElseThrow(() -> new CustomBaseException(ErrorCode.NOT_FOUND)); if(!Objects.equal(HeaderUtil.getUserId(), savedDto.getCiId())) throw new CustomBaseException("삭제 권한(게시글 소유자)이 없는 사용자 입니다"); - // 댓글 존재 여부 조회 + // 댓글 존재 여부 조회 : 댓글이 있는 경우 ciRef 에 ciCode로 존재 int cnt = boardDao.findByCiRefCnt(ciCode); if(cnt > 1) throw new CustomBaseException("삭제 할 수 없는 게시글 입니다[댓글 존재]"); boardDao.deleteById(ciCode); diff --git a/src/main/java/com/xit/core/config/database/BaseMpowerDaoSupport.java b/src/main/java/com/xit/core/config/database/BaseMpowerDaoSupport.java index 3b6991a..ff5b4f6 100644 --- a/src/main/java/com/xit/core/config/database/BaseMpowerDaoSupport.java +++ b/src/main/java/com/xit/core/config/database/BaseMpowerDaoSupport.java @@ -261,6 +261,8 @@ public abstract class BaseMpowerDaoSupport { break; } } catch (Exception e) { + log.error(e.getLocalizedMessage()); + e.printStackTrace(); throw new MpowerException(String.format("%s::%s=%s", "DB Result 바인딩 오류", fields.get(j), client.getString("list1", row, j))); } } diff --git a/src/main/resources/config/conf.yml b/src/main/resources/config/conf.yml index 4fc092b..23c818d 100644 --- a/src/main/resources/config/conf.yml +++ b/src/main/resources/config/conf.yml @@ -12,7 +12,7 @@ xit: # api response logging 여부 api: reponse: - logging: true + logging: false file: cmm: diff --git a/src/main/resources/sql/board-mapper.xml b/src/main/resources/sql/board-mapper.xml index 7ca2709..1a4ab56 100644 --- a/src/main/resources/sql/board-mapper.xml +++ b/src/main/resources/sql/board-mapper.xml @@ -63,7 +63,7 @@ /* board-mapper|updateCiHit|julim */ - SELECT ci_code + SELECT ci_code, ci_contentno, ci_contents, ci_email,