휴가관리 기능 추가

This commit is contained in:
dyhj625 2025-02-14 16:23:33 +09:00
parent 9612b091ba
commit 1563e9409a
4 changed files with 22 additions and 1 deletions

View File

@ -33,11 +33,12 @@ public class VacationController {
@Member @Member
@ParameterCheck @ParameterCheck
@PostMapping @PostMapping
public ApiResponse<String> saveVacations(@RequestBody List<MapDto> map) { public ApiResponse<?> saveVacations(@RequestBody List<MapDto> map) {
Long user = AuthUtil.getUser().getId(); Long user = AuthUtil.getUser().getId();
for (MapDto request : map) { for (MapDto request : map) {
String date = request.getString("date"); String date = request.getString("date");
String type = request.getString("type"); String type = request.getString("type");
Object receiverId = request.get("receiverId");
if ( date == null || type == null) { if ( date == null || type == null) {
throw new IllegalArgumentException("요청 데이터에 누락된 값이 있습니다: " + request); throw new IllegalArgumentException("요청 데이터에 누락된 값이 있습니다: " + request);
@ -93,4 +94,14 @@ public class VacationController {
return ApiResponse.ok(localVacaService.getCommonCodeList()); return ApiResponse.ok(localVacaService.getCommonCodeList());
} }
@GetMapping("/sent")
public ApiResponse<List<MapDto>> getSentVacations(@ReqMap MapDto map) {
Long userId = AuthUtil.getUser().getId(); // 현재 로그인한 사용자 ID
map.put("userId", userId);
List<MapDto> sentCount = localVacaService.getSentVacationCount(map);
return ApiResponse.ok(sentCount);
}
} }

View File

@ -21,6 +21,8 @@ public interface localvacaMapper {
List<MapDto> getEmployeeRemainingVacation(); List<MapDto> getEmployeeRemainingVacation();
List<MapDto> getCommonCodeNames(); List<MapDto> getCommonCodeNames();
List<MapDto> countSentVacations(MapDto map);
} }

View File

@ -238,4 +238,8 @@ public class localvacaService {
// 데이터가 비어있으면 리스트 반환 (null 방지) // 데이터가 비어있으면 리스트 반환 (null 방지)
return (codeList != null) ? codeList : new ArrayList<>(); return (codeList != null) ? codeList : new ArrayList<>();
} }
public List<MapDto> getSentVacationCount(MapDto map) {
return localvacaMapper.countSentVacations(map);
}
} }

View File

@ -109,5 +109,9 @@
WHERE CMNCODVAL IN ('700101', '700102', '700103') WHERE CMNCODVAL IN ('700101', '700102', '700103')
</select> </select>
<select id="countSentVacations" resultType="io.company.localhost.common.dto.MapDto">
SELECT COUNT(*) as count FROM localvaca WHERE MEMBERSEQ = #{userId} AND LOCVACRMM = #{receiverId} AND YEAR(LOCVACRDT) = YEAR(NOW())
</select>
</mapper> </mapper>