내 질문과 관련하여 설명서에서 내용을 볼 수 없었습니다. 배포시 응용 프로그램이 제대로 작동하지 않습니다 (그 이상은 초 단위 임). 나는 MyBatis에서MyBatis의 매개 변수를 통해 FROM 절 설정
<select id="getLookupRows" parameterType="map" resultMap="lookupMap">
select id, name, active, valid
from #{table}
</select>
과 같은 것을하려고 노력하고 있습니다. 공유 열이있는 조회 테이블이 여러 개 있으므로보기 수준의 사용자가 궁극적으로 사용되는 조회 테이블을 결정합니다. 내가 getLookupRows을 실행하려고 할 때 내가 오류는 다음과 같이
Cause: org.apache.ibatis.executor.ExecutorException: There was no TypeHandler found for parameter table of statement info.pureshasta.mapper.LookupMapper.getLookupRows
org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:77)
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:69)
org.apache.ibatis.binding.MapperMethod.executeForList(MapperMethod.java:85)
org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:65)
org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:38)
$Proxy15.getLookupRows(Unknown Source)
info.pureshasta.service.FieldTitleService.getLookupRows(FieldTitleService.java:33)
내 매퍼 인터페이스입니다 :
List<Lookup> getLookupRows(@Param("specificColumn") String specificColumn,
@Param("table") String table);
그래서 우리는 내가이 쿼리, 특별한 아무것도 문자열을 전달하기 위해 노력하고 있음을 알고있다. 그게 내 다음 과제이기 때문에 나는 특정한 칼럼을 가지고있다. 정말 각 룩업 테이블의 열 중 하나는 고유하므로 적절한 specificColumn을 호출해야하지만 테이블 매개 변수와 FROM 절이 작동하면 정말 행복 할 것입니다.
1 개의 설명을 추가하고 싶습니다. 테이블에 따라 동적 컬럼 이름 인 specificColumn을 언급했습니다. 쿼리는'select $ {specificColumn} as sc, id, name, active, valid'와 같이 쓰면 더 좋을 것입니다. 이것은 우리가 와 같은 결과 맵에서 specificColumn을 참조 할 수있게합니다.이 별칭이 없으면 resultMap의 specificColumn을 참조 할 수없는 것처럼 보입니다. –
demongolem