Young87

SmartCat's Blog

So happy to code my life!

游戏开发交流QQ群号60398951

当前位置:首页 >跨站数据

mybatis-plus和mybatis-plus-boot-starter异同

mybatis-plus 和 mybatis-plus-boot-starter 的主要异同点就在于:

mybatis-plus-boot-starter将xml中basemap中定义的id全部已经实现了

而mybatis-plus这个包还需要自己实现basemap中的定义。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mrk.dx.system.dao.SkyUserDao">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mrk.dx.system.entity.SkyUser">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="nickname" property="nickname" />
        <result column="sex" property="sex" />
        <result column="phone" property="phone" />
        <result column="identifier" property="identifier" />
        <result column="openid" property="openid" />
        <result column="created_at" property="createdAt" />
        <result column="updated_at" property="updatedAt" />
        <result column="headimgurl" property="headimgurl" />
        <result column="root_organization_ids" property="rootOrganizationIds" />
    </resultMap>

    <select id="selectList" resultMap="BaseResultMap">
        select * from sky_user
    </select>

BUG:

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
 
Thu May 23 14:54:08 CST 2019
There was an unexpected error (type=Internal Server Error, status=500).
Invalid bound statement (not found): com.mrk.dx.system.dao.SkyUserDao.selectList
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.mrk.dx.system.dao.SkyUserDao.selectList
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:232)
	at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:50)
	at org.apache.ibatis.binding.MapperProxy.lambda$cachedMapperMethod$0(MapperProxy.java:62)
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
	at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:62)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:57)
	at com.sun.proxy.$Proxy101.selectList(Unknown Source)
	at com.baomidou.mybatisplus.service.impl.ServiceImpl.selectList(ServiceImpl.java:292)
	at com.baomidou.mybatisplus.service.impl.ServiceImpl$$FastClassBySpringCGLIB$$3e2398a4.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)
	at com.mrk.dx.system.service.impl.SkyUserServiceImpl$$EnhancerBySpringCGLIB$$d0192f7b.selectList(<generated>)

原因

<dependency>
    <groupId>com.baomidou</groupId>
    <artifactId>mybatis-plus</artifactId>
    <version>2.0.6</version>
</dependency>
<!--generator时使用-->
<!--<dependency>-->
    <!--<groupId>com.baomidou</groupId>-->
    <!--<artifactId>mybatis-plus-boot-starter</artifactId>-->
    <!--<version>2.2.0</version>-->
<!--</dependency>-->

除特别声明,本站所有文章均为原创,如需转载请以超级链接形式注明出处:SmartCat's Blog

上一篇: Java经典面试题整理及答案详解(三)

下一篇: 为什么说 Flink + AI 值得期待?

精华推荐