출퇴근 관리 api

This commit is contained in:
hylee 2024-08-29 09:43:48 +09:00
parent 736b343b1f
commit 1c3e25eee4
2 changed files with 56 additions and 0 deletions

View File

@ -48,6 +48,7 @@ public class SecurityConfig {
.requestMatchers("/user/register").permitAll()
.requestMatchers("/accessDenied").permitAll()
.requestMatchers("/static/**", "/plugins/**", "/dist/**").permitAll()
.requestMatchers("/api/**").permitAll()
.requestMatchers("/admin/**").hasRole("ADMIN")
.anyRequest().authenticated() // 모든 요청에 대해 인증 요구
)

View File

@ -0,0 +1,55 @@
package com.itn.admin.commute.web;
import com.itn.admin.cmn.msg.RestResponse;
import com.itn.admin.commute.mapper.domain.CommuteVO;
import com.itn.admin.commute.service.CommuteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
public class CommuteRestController {
private CommuteService commuteService;
@Autowired
public void setCommuteService(CommuteService commuteService) {
this.commuteService = commuteService;
}
@GetMapping(value = "/api/commute/list")
public ResponseEntity<RestResponse> list(@ModelAttribute("commuteVO") CommuteVO commuteVO, Model model) {
Map<String, Object> resultMap = commuteService.getList(commuteVO);
// model.addAttribute("list", resultMap.get("resultList"));
// model.addAttribute("commuteVO", resultMap.get("commuteVO"));
return ResponseEntity.ok().body(new RestResponse(HttpStatus.OK,"성공적으로 조회했습니다.",resultMap));
}
// @GetMapping(value = "/{pageNumber}")
// public String list(@ModelAttribute CommuteVO commuteVO, Model model) {
// Page<CommuteVO> page = commuteService.getList(commuteVO);
//
// int current = page.getNumber() + 1;
// int begin = Math.max(1, current - 5);
// int end = Math.min(begin + 10, page.getTotalPages());
//
// model.addAttribute("list", page);
// model.addAttribute("beginIndex", begin);
// model.addAttribute("endIndex", end);
// model.addAttribute("currentIndex", current);
//
// return "customers/list";
//
// }
}