휴가관리 기능 추가
This commit is contained in:
parent
9612b091ba
commit
1563e9409a
@ -33,11 +33,12 @@ public class VacationController {
|
||||
@Member
|
||||
@ParameterCheck
|
||||
@PostMapping
|
||||
public ApiResponse<String> saveVacations(@RequestBody List<MapDto> map) {
|
||||
public ApiResponse<?> saveVacations(@RequestBody List<MapDto> map) {
|
||||
Long user = AuthUtil.getUser().getId();
|
||||
for (MapDto request : map) {
|
||||
String date = request.getString("date");
|
||||
String type = request.getString("type");
|
||||
Object receiverId = request.get("receiverId");
|
||||
|
||||
if ( date == null || type == null) {
|
||||
throw new IllegalArgumentException("요청 데이터에 누락된 값이 있습니다: " + request);
|
||||
@ -93,4 +94,14 @@ public class VacationController {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -21,6 +21,8 @@ public interface localvacaMapper {
|
||||
List<MapDto> getEmployeeRemainingVacation();
|
||||
|
||||
List<MapDto> getCommonCodeNames();
|
||||
|
||||
List<MapDto> countSentVacations(MapDto map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -238,4 +238,8 @@ public class localvacaService {
|
||||
// 데이터가 비어있으면 빈 리스트 반환 (null 방지)
|
||||
return (codeList != null) ? codeList : new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<MapDto> getSentVacationCount(MapDto map) {
|
||||
return localvacaMapper.countSentVacations(map);
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,5 +109,9 @@
|
||||
WHERE CMNCODVAL IN ('700101', '700102', '700103')
|
||||
</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>
|
||||
Loading…
Reference in New Issue
Block a user