본문 바로가기
내일배움캠프/회고록

8월 13일 화요일

by jhdevtrace 2024. 8. 14.

결론

과제 필수 단계 완료

 

 

 

본문

 

과제 3~5단계까지 완료했다.

뭔가 스프링이 익숙하지 않아서 그런지, 딱히 많이 한 것 같지는 않은데 엄청 엄청 시간이 많이 지나있다. 구현하면서도 구현 속도도 느리기는 한데, 데이터 타입 계속 바꾸고 넣어주고 필요하면 다시 만들어주고 이런 과정들이 꽤 오래 걸리는 것 같다. 그래도 뿌듯하다. 수요일 오전까지 강의 끝내고, 오후부터 목요일까지 나머지 추가 과제를 할 예정이다.

 

 

오늘은 과제에만 거의 몰두해서 딱히 쓸 내용이 없다..

 

 

스프링 서버에서 시간 넣어주기

관련 코드들

    LocalDateTime now = LocalDateTime.now();
    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");  
    String formattedDate = now.format(formatter);
   
   
       public int save(ScheduleAddDto AddDto) {
        String sql = "INSERT INTO schedule (assignee, pw, content, reg_date, mod_date) VALUES (?, ?, ?, ?, ?)";
        return jdbcTemplate.update(sql,
                AddDto.getAssignee(),
                AddDto.getPw(),
                AddDto.getContent(),
                formattedDate,
                formattedDate);

    }
    
        // 선택한 일정 수정
    // 할 일만 수정
    public int updateScheduleContent(ScheduleRequestDto sReqDto){
        String sql = "UPDATE schedule SET mod_date=?, content = ? WHERE schedule_id=? and pw=?";
        return jdbcTemplate.update(sql,formattedDate, sReqDto.getContent(), sReqDto.getScheduleId(), sReqDto.getPw());
    }

    // 담당자만 수정
    public int updateScheduleAssignee(ScheduleRequestDto sReqDto){
        String sql = "UPDATE schedule SET mod_date=?, assignee = ? WHERE schedule_id=? and pw=?";
        return jdbcTemplate.update(sql,formattedDate, sReqDto.getAssignee(), sReqDto.getScheduleId(), sReqDto.getPw());
    }

    // 할 일과 담당자 수정
    public int updateScheduleAssigneeContent(ScheduleRequestDto sReqDto){
        String sql = "UPDATE schedule SET mod_date=?, assignee = ?, content=? WHERE schedule_id=? and pw=?";
        return jdbcTemplate.update(sql,formattedDate, sReqDto.getAssignee(),sReqDto.getContent(), sReqDto.getScheduleId(), sReqDto.getPw());
    }

'내일배움캠프 > 회고록' 카테고리의 다른 글

8월 22일 목요일  (0) 2024.08.23
8월 19일 월요일  (0) 2024.08.20
8월 12일 월요일  (0) 2024.08.12
8월 9일 금요일  (0) 2024.08.12
8월 7일 수요일  (0) 2024.08.08