与不同框架整合时mybatis的使用区别

阅读更多

与不同框架整合时mybatis的使用区别1,mapper,2,普通

 

 

 

 

//集成通用mapper的mybatis使用

 

       

         

       

       

       

       

                classpath:config_mybatis/**/*.xml

           

      

       

           

             

                   

                       

                            dialect=oracle

                            reasonable=true

                       

                     

                 

               

           

         

   

 

 //通用mapper直接根据sqlSession这个名字自动装配sqlSession,直接通过mapper用

       

       

       

   

 

@Override

@Cacheable(value="getMenuItems",key="'menufolderid='+#item.menufolderid")

public List getMenuItems(OpmMenuitem item) {

// TODO Auto-generated method stub

return opmMenuitemMapper.select(item);

}

 

 

 

 

 

//普通的mybatis使用,如jpa,获取这个sqlSessionTemplate实例用

 

 

   

     

       

         

           dialect=oracle

            reasonable=true

            offsetAsPageNum=true

         

       

     

   

 

 

@Autowired

public ESteelSqlSessionTemplate sqlSessionTemplate;

 

@Override

public List spsxPartKeycdpzzzMap() {

return sqlSessionTemplate.selectList("basSpsxValue.spsxPartKeycdpzzzMap");

}

 

 

 

 

 

 

你可能感兴趣的:(Mybatis)