Redis cache function upgrade
This commit is contained in:
@@ -7,7 +7,10 @@ import com.kamco.cd.kamcoback.code.dto.CommonCodeDto.OrderReq;
|
||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||
import com.kamco.cd.kamcoback.postgres.core.CommonCodeCoreService;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -23,6 +26,7 @@ public class CommonCodeService {
|
||||
*
|
||||
* @return 모튼 코드 정보
|
||||
*/
|
||||
@Cacheable(value = "commonCodes")
|
||||
public List<Basic> getFindAll() {
|
||||
return commonCodeCoreService.findAll();
|
||||
}
|
||||
@@ -44,6 +48,7 @@ public class CommonCodeService {
|
||||
* @return 생성된 코드 id
|
||||
*/
|
||||
@Transactional
|
||||
@CacheEvict(value = "commonCodes", allEntries = true)
|
||||
public ApiResponseDto.ResponseObj save(AddReq req) {
|
||||
return commonCodeCoreService.save(req);
|
||||
}
|
||||
@@ -55,6 +60,7 @@ public class CommonCodeService {
|
||||
* @param req 수정요청 정보
|
||||
*/
|
||||
@Transactional
|
||||
@CacheEvict(value = "commonCodes", allEntries = true)
|
||||
public ApiResponseDto.ResponseObj update(Long id, ModifyReq req) {
|
||||
return commonCodeCoreService.update(id, req);
|
||||
}
|
||||
@@ -65,6 +71,7 @@ public class CommonCodeService {
|
||||
* @param id 코드 아이디
|
||||
*/
|
||||
@Transactional
|
||||
@CacheEvict(value = "commonCodes", allEntries = true)
|
||||
public ApiResponseDto.ResponseObj removeCode(Long id) {
|
||||
return commonCodeCoreService.removeCode(id);
|
||||
}
|
||||
@@ -75,6 +82,7 @@ public class CommonCodeService {
|
||||
* @param req id, order 정보를 가진 List
|
||||
*/
|
||||
@Transactional
|
||||
@CacheEvict(value = "commonCodes", allEntries = true)
|
||||
public ApiResponseDto.ResponseObj updateOrder(OrderReq req) {
|
||||
return commonCodeCoreService.updateOrder(req);
|
||||
}
|
||||
@@ -99,4 +107,15 @@ public class CommonCodeService {
|
||||
public ApiResponseDto.ResponseObj getCodeCheckDuplicate(Long parentId, String code) {
|
||||
return commonCodeCoreService.getCodeCheckDuplicate(parentId, code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통코드 이름 조회
|
||||
*
|
||||
* @param parentCodeCd 상위 코드
|
||||
* @param childCodeCd 하위 코드
|
||||
* @return 공통코드명
|
||||
*/
|
||||
public Optional<String> getCode(String parentCodeCd, String childCodeCd) {
|
||||
return commonCodeCoreService.getCode(parentCodeCd, childCodeCd);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user