PortalPropertyRepository 중복 키 조회 메서드 추가 - 무결성 점검용
eapim-portal CI (from elink-portal-common) / build (push) Has been cancelled
eapim-portal CI (from elink-portal-common) / build (push) Has been cancelled
This commit is contained in:
+15
@@ -4,8 +4,23 @@ import com.eactive.apim.portal.portalproperty.entity.PortalProperty;
|
||||
import com.eactive.apim.portal.portalproperty.entity.PortalPropertyId;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@EMSDataSource
|
||||
public interface PortalPropertyRepository extends BaseRepository<PortalProperty, PortalPropertyId> {
|
||||
|
||||
/**
|
||||
* (PROPERTY_GROUP_NAME, PROPERTY_NAME) 조합이 2건 이상인 중복 키를 조회한다.
|
||||
* DB에 유니크 제약을 걸지 않으므로 기동 시 무결성 점검용으로 사용한다.
|
||||
*
|
||||
* @return {@code Object[]{propertyGroupName, propertyName, count}} 목록 (중복 없으면 빈 리스트)
|
||||
*/
|
||||
@Query("SELECT p.id.propertyGroupName, p.id.propertyName, COUNT(p) "
|
||||
+ "FROM PortalProperty p "
|
||||
+ "GROUP BY p.id.propertyGroupName, p.id.propertyName "
|
||||
+ "HAVING COUNT(p) > 1")
|
||||
List<Object[]> findDuplicatePropertyKeys();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user