使用mybatis自动实现接口封装返回结果集
import java.lang.annotation.Annotation; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.stereotype.Component; @Retention(RetentionPolicy.RUNTIME) @Target({java.lang.annotation.ElementType.TYPE}) @Documented @Component public @interface MyBatisDomain { public abstract String value();//自定义标签 }
@MyBatisRepository public interface CmsTGrarWarnRevaluationDao { /** * @author JY-IT-D001 * @description: 编写接口 * @date 2015-05-29 15:36:35 * @param searchParams * @return */ public List<CmsTGrarWarnRevaluationDTO> searchCmsTGrarWarnRevaluationByPaging(Map<String, Object> searchParams) ; }
<!--将此配置到spring-base.xml 扫描basePackage下所有以@MyBatisRepository标识的 接口--> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.test" /> <!--设置扫描路径-->
<property name="annotationClass" value="com.jy.platform.core.mybatis.MyBatisRepository"/> </bean><!--将标签路径注入-->