|
|
|
@ -1,7 +1,6 @@
|
|
|
|
|
package com.xit.biz.ctgy.v2.repository;
|
|
|
|
|
|
|
|
|
|
import com.xit.biz.ctgy.dto.BoardDto;
|
|
|
|
|
import com.xit.biz.ctgy.entity.MinCivBoard680;
|
|
|
|
|
import com.xit.core.config.database.BaseMpowerDaoSupport;
|
|
|
|
|
import com.xit.core.support.sql.parser.QueryGenerator;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@ -15,15 +14,15 @@ import java.util.*;
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class BoardDao extends BaseMpowerDaoSupport {
|
|
|
|
|
|
|
|
|
|
public Page<BoardDto> findAll(final BoardDto dto, Pageable pageable) {
|
|
|
|
|
String cntSql = getSql("selectBoardListCnt", dto, pageable);
|
|
|
|
|
String listSql = getSql("selectBoardList", dto, pageable);
|
|
|
|
|
String fieldStrs = "ciCode, ciName, ciContentno, ciTitle, ciContents, ciNalja, ciStep, ciRevel, ciRef, ciHit, ciPass, ciId";
|
|
|
|
|
public Page<BoardDto> findAll(final BoardDto dto, final Pageable pageable) {
|
|
|
|
|
final String cntSql = getSql("selectBoardListCnt", dto, pageable);
|
|
|
|
|
final String listSql = getSql("selectBoardList", dto, pageable);
|
|
|
|
|
final String fieldStrs = "ciCode, ciName, ciContentno, ciTitle, ciContents, ciNalja, ciStep, ciRevel, ciRef, ciHit, ciPass, ciId";
|
|
|
|
|
|
|
|
|
|
return selectList(BoardDto.class, listSql, cntSql, fieldStrs, pageable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getSql(String sqlId, BoardDto dto, Pageable pageable){
|
|
|
|
|
private String getSql(final String sqlId, final BoardDto dto, final Pageable pageable){
|
|
|
|
|
return QueryGenerator.createNamedQuery("board", sqlId)
|
|
|
|
|
.setParameter("ciTitle", dto.getCiTitle())
|
|
|
|
|
.setParameter("ciName", dto.getCiName())
|
|
|
|
@ -33,30 +32,61 @@ public class BoardDao extends BaseMpowerDaoSupport {
|
|
|
|
|
.getQueryString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//@Query("UPDATE MinCivBoard680 m SET m.ciHit = m.ciHit + 1 WHERE m.ciCode = :ciCode")
|
|
|
|
|
public void updateInHitForMinCivBoard680(Long ciCode) {
|
|
|
|
|
String sql = QueryGenerator.createNamedQuery("board", "updateCiHit")
|
|
|
|
|
public void updateInHitForMinCivBoard680(final Long ciCode) {
|
|
|
|
|
final String sql = QueryGenerator.createNamedQuery("board", "updateCiHit")
|
|
|
|
|
.setParameter("ciCode", ciCode).getQueryString();
|
|
|
|
|
update(sql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Optional<MinCivBoard680> findById(Long ciCode) {
|
|
|
|
|
return Optional.empty();
|
|
|
|
|
public Optional<BoardDto> findById(final Long ciCode) {
|
|
|
|
|
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";
|
|
|
|
|
|
|
|
|
|
return Optional.ofNullable(selectOne(BoardDto.class, sql, fieldStrs));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//@Query(value = "SELECT max(e.ci_code) + 1 FROM min_civ_board680 e", nativeQuery = true)
|
|
|
|
|
public Long getCiCode() {
|
|
|
|
|
return null;
|
|
|
|
|
public void insertBoard(final BoardDto dto) {
|
|
|
|
|
final String sql = QueryGenerator.createNamedQuery("board", "insertBoard")
|
|
|
|
|
.setParameter("ciTitle", dto.getCiTitle())
|
|
|
|
|
.setParameter("ciContents", dto.getCiContents())
|
|
|
|
|
.setParameter("ciEmail", dto.getCiEmail())
|
|
|
|
|
.setParameter("ciHit", dto.getCiHit())
|
|
|
|
|
.setParameter("ciId", dto.getCiId())
|
|
|
|
|
.setParameter("ciIp", dto.getCiIp())
|
|
|
|
|
.setParameter("ciNalja", dto.getCiNalja())
|
|
|
|
|
.setParameter("ciName", dto.getCiName())
|
|
|
|
|
.setParameter("ciPass", dto.getCiPass())
|
|
|
|
|
.setParameter("ciPwd", dto.getCiPwd())
|
|
|
|
|
.setParameter("ciRef", dto.getCiRef())
|
|
|
|
|
.setParameter("ciRevel", dto.getCiRevel())
|
|
|
|
|
.setParameter("ciStep", dto.getCiStep())
|
|
|
|
|
.setParameter("ciTime", dto.getCiTime())
|
|
|
|
|
.getQueryString();
|
|
|
|
|
insert(sql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void save(MinCivBoard680 entity) {
|
|
|
|
|
public void updateBoard(final BoardDto dto){
|
|
|
|
|
final String sql = QueryGenerator.createNamedQuery("board", "updateBoard")
|
|
|
|
|
.setParameter("ciCode", dto.getCiCode())
|
|
|
|
|
.setParameter("ciTitle", dto.getCiTitle())
|
|
|
|
|
.setParameter("ciContents", dto.getCiContents())
|
|
|
|
|
.getQueryString();
|
|
|
|
|
update(sql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<MinCivBoard680> findByCiRef(Long ciCode) {
|
|
|
|
|
return null;
|
|
|
|
|
public int findByCiRefCnt(final Long ciCode) {
|
|
|
|
|
final String sql = QueryGenerator.createNamedQuery("board", "selectCntByCiRef")
|
|
|
|
|
.setParameter("ciCode", ciCode)
|
|
|
|
|
.getQueryString();
|
|
|
|
|
return Integer.parseInt(selectOneColumn(sql));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void deleteById(Long ciCode) {
|
|
|
|
|
public void deleteById(final Long ciCode) {
|
|
|
|
|
final String sql = QueryGenerator.createNamedQuery("board", "deleteBoard")
|
|
|
|
|
.setParameter("ciCode", ciCode)
|
|
|
|
|
.getQueryString();
|
|
|
|
|
delete(sql);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|