보드수정

This commit is contained in:
dyhj625 2025-02-03 15:33:02 +09:00
parent 358e12a222
commit 849b99e475
10 changed files with 36 additions and 18 deletions

View File

@ -27,6 +27,7 @@ import io.company.localhost.common.annotation.ParameterCheck;
import io.company.localhost.common.annotation.ReqMap; import io.company.localhost.common.annotation.ReqMap;
import io.company.localhost.common.dto.ApiResponse; import io.company.localhost.common.dto.ApiResponse;
import io.company.localhost.common.dto.MapDto; import io.company.localhost.common.dto.MapDto;
import io.company.localhost.service.commoncodService;
import io.company.localhost.service.localbordService; import io.company.localhost.service.localbordService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -38,6 +39,7 @@ import lombok.extern.slf4j.Slf4j;
public class BoardController { public class BoardController {
private final localbordService boardService; private final localbordService boardService;
private final commoncodService commoncodService;
/** /**
* 공지사항 목록 조회 * 공지사항 목록 조회
@ -74,7 +76,7 @@ public class BoardController {
@PostMapping @PostMapping
public ApiResponse<BigInteger> createBoard(@ReqMap MapDto map) { public ApiResponse<BigInteger> createBoard(@ReqMap MapDto map) {
//임시 //임시
map.put("MEMBERSEQ", 1); map.put("MEMBERSEQ", 1);
return ApiResponse.ok(boardService.createBoard(map)); return ApiResponse.ok(boardService.createBoard(map));
} }
@ -230,4 +232,14 @@ public class BoardController {
public ApiResponse<Boolean> checkBoardPassword(@PathVariable("boardId") int boardId, @ReqMap MapDto map) { public ApiResponse<Boolean> checkBoardPassword(@PathVariable("boardId") int boardId, @ReqMap MapDto map) {
return ApiResponse.ok(boardService.getBoardPassword(boardId).equals(map.getString("LOCBRDPWD"))); return ApiResponse.ok(boardService.getBoardPassword(boardId).equals(map.getString("LOCBRDPWD")));
} }
/**
* 카테고리 목록 조회
* @return 카테고리 리스트
*/
@GetMapping("/categories")
public ApiResponse<List<MapDto>> getCategories() {
List<MapDto> categories = commoncodService.getCategoryList();
return ApiResponse.ok(categories);
}
} }

View File

@ -23,13 +23,9 @@ public class VacationController {
private final localvacaService localVacaService; private final localvacaService localVacaService;
@PostMapping @PostMapping
public ApiResponse<String> saveVacations(@RequestBody List<MapDto> vacationRequests) { public ApiResponse<String> saveVacations(@RequestBody List<MapDto> map) {
// 요청 데이터 유효성 검사
if (vacationRequests == null || vacationRequests.isEmpty()) {
throw new IllegalArgumentException("휴가 요청 데이터가 비어 있습니다.");
}
for (MapDto request : vacationRequests) { for (MapDto request : map) {
// 요청 데이터의 필수 검증 // 요청 데이터의 필수 검증
Integer employeeId = (Integer) request.get("employeeId"); Integer employeeId = (Integer) request.get("employeeId");
String date = request.getString("date"); String date = request.getString("date");
@ -51,10 +47,10 @@ public class VacationController {
* 휴가 정보를 조회하여 프론트엔드로 전달 * 휴가 정보를 조회하여 프론트엔드로 전달
*/ */
@GetMapping("/list") @GetMapping("/list")
public ApiResponse<List<MapDto>> getVacationList() { public ApiResponse<List<MapDto>> getVacationList(@ReqMap MapDto map) {
// 서비스 호출을 통해 데이터 조회 // 서비스 호출을 통해 데이터 조회
List<MapDto> vacationList = localVacaService.getVacationList(); List<MapDto> vacationList = localVacaService.getVacationList(map);
return ApiResponse.ok(vacationList); return ApiResponse.ok(vacationList);
} }

View File

@ -32,4 +32,6 @@ public interface commoncodMapper {
List<MapDto> getMbtiList(); List<MapDto> getMbtiList();
int updateColorYon(String color); int updateColorYon(String color);
List<MapDto> getCategories();
} }

View File

@ -12,7 +12,7 @@ import io.company.localhost.common.dto.MapDto;
public interface localvacaMapper { public interface localvacaMapper {
void insertVacation(MapDto map); void insertVacation(MapDto map);
List<MapDto> findVacations(); List<MapDto> findVacations(MapDto map);
} }

View File

@ -43,6 +43,9 @@ public class commoncodService {
public List<MapDto> getMbtiList() { public List<MapDto> getMbtiList() {
return commoncodmapper.getMbtiList(); return commoncodmapper.getMbtiList();
} }
public List<MapDto> getCategoryList() {
return commoncodmapper.getCategories();
}
} }

View File

@ -33,7 +33,7 @@ public class localbordService {
public PageInfo<MapDto> getGeneralPosts(MapDto map) { public PageInfo<MapDto> getGeneralPosts(MapDto map) {
int page = map.getString("page") != null ? Integer.parseInt(map.getString("page")) : 1; int page = map.getString("page") != null ? Integer.parseInt(map.getString("page")) : 1;
int size = map.getString("size") != null ? Integer.parseInt(map.getString("size")) : 10; int size = map.getString("size") != null ? Integer.parseInt(map.getString("size")) : 12;
String orderBy = map.getString("orderBy"); String orderBy = map.getString("orderBy");
if (orderBy == null || (!orderBy.equals("date") && !orderBy.equals("views"))) { if (orderBy == null || (!orderBy.equals("date") && !orderBy.equals("views"))) {

View File

@ -14,12 +14,12 @@ public class localvacaService {
private final localvacaMapper localvacaMapper; private final localvacaMapper localvacaMapper;
public void insertVacation(MapDto vacationRequest) { public void insertVacation(MapDto map) {
localvacaMapper.insertVacation(vacationRequest); localvacaMapper.insertVacation(map);
} }
public List<MapDto> getVacationList() { public List<MapDto> getVacationList(MapDto map) {
return localvacaMapper.findVacations(); return localvacaMapper.findVacations(map);
} }
} }

View File

@ -62,5 +62,10 @@
WHERE CMNCODVAL = #{color}; WHERE CMNCODVAL = #{color};
</update> </update>
<select id="getCategories" resultType="Map">
SELECT CMNCODVAL, CMNCODNAM FROM commoncod
WHERE CMNCODVAL BETWEEN 300101 AND 300103
</select>
</mapper> </mapper>

View File

@ -62,7 +62,7 @@
<!-- 게시물 상세정보 조회 --> <!-- 게시물 상세정보 조회 -->
<select id="selectBoardDetail" resultType="io.company.localhost.common.dto.MapDto"> <select id="selectBoardDetail" resultType="io.company.localhost.common.dto.MapDto">
SELECT LOCBRDSEQ AS id, LOCBRDTTL AS title, LOCBRDCON AS content, LOCBRDUDT AS date, LOCBRDTYP AS type SELECT LOCBRDSEQ AS id, LOCBRDTTL AS title, LOCBRDCON AS content, LOCBRDUDT AS date, LOCBRDTYP AS type, LOCBRDCNT AS cnt
FROM localbord FROM localbord
WHERE LOCBRDSEQ = #{boardId} WHERE LOCBRDSEQ = #{boardId}
</select> </select>

View File

@ -9,7 +9,7 @@
</insert> </insert>
<!-- 직원 ID로 휴가 정보 조회 --> <!-- 직원 ID로 휴가 정보 조회 -->
<select id="findVacationsByEmployeeId" parameterType="int" resultType="map"> <select id="findVacations" parameterType="io.company.localhost.common.dto.MapDto">
SELECT SELECT
MEMBERSEQ MEMBERSEQ
LOCVACUDT, LOCVACUDT,