<button id="jmirm"><form id="jmirm"></form></button><xmp id="jmirm"><form id="jmirm"></form><ins id="jmirm"><form id="jmirm"><xmp id="jmirm"><ins id="jmirm"><form id="jmirm"></form></ins><form id="jmirm"><button id="jmirm"><button id="jmirm"></button></button></form>
<form id="jmirm"></form>
<form id="jmirm"><button id="jmirm"></button></form><form id="jmirm"><form id="jmirm"><button id="jmirm"></button></form></form><form id="jmirm"><form id="jmirm"><button id="jmirm"></button></form></form>
<xmp id="jmirm">
<xmp id="jmirm"><xmp id="jmirm">
<button id="jmirm"><form id="jmirm"><ins id="jmirm"></ins></form></button>
<xmp id="jmirm"><form id="jmirm"></form>
<xmp id="jmirm"><form id="jmirm"><form id="jmirm"><button id="jmirm"></button></form></form><form id="jmirm"></form><form id="jmirm"></form>
<form id="jmirm"><button id="jmirm"></button></form><xmp id="jmirm"><form id="jmirm"></form><xmp id="jmirm"><form id="jmirm"><button id="jmirm"></button></form><form id="jmirm"></form><form id="jmirm"><form id="jmirm"></form></form>
<ins id="jmirm"><form id="jmirm"><form id="jmirm"></form></form></ins>
<xmp id="jmirm"><form id="jmirm"></form>
<xmp id="jmirm"><form id="jmirm"></form><form id="jmirm"></form>
<xmp id="jmirm">
<button id="jmirm"></button><form id="jmirm"></form><xmp id="jmirm"><form id="jmirm"></form><form id="jmirm"><button id="jmirm"><button id="jmirm"></button></button></form>
<button id="jmirm"></button>
<xmp id="jmirm"><form id="jmirm"><form id="jmirm"></form></form><form id="jmirm"></form><xmp id="jmirm"><xmp id="jmirm"><xmp id="jmirm">
<xmp id="jmirm">
<xmp id="jmirm">
歡迎光臨
一個學習的網站

關于mybatis-plus 和 mybatis-plus-boot-starter 不同之處分析

在采用mybatis-plus做代碼生成器時,我前面的文章https://blog.csdn.net/u012329294/article/details/90473681 講過,必須把其他的mybatis-plus刪掉,只留下mybatis-plus-boot-starter。

但用mybatis-plus-boot-starter生成的代碼,放在mybatis-plus依賴環境中,

<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>-->

總是報錯

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>)

這個報錯很有迷惑性,反復查找名字映射等都不行。

后來經過提醒才發覺,原來mybatis-plus并沒有自動生成那些命令。

即其中的selectList方法要自己來實現。

<?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>
</mapper>
如上圖,加上紅色那一句后就可以了,這個耽誤了將近1天時間。

而在mybatis-plus-boot-starter中不需要寫,它已經完全自動實現了。

因此,mybatis-plus 和 mybatis-plus-boot-starter 的主要異同點就在于:

mybatis-plus-boot-starter將xml中basemap中定義的id全部已經實現了,

而mybatis-plus這個包還需要自己實現basemap中的定義。

贊(0) 打賞
版權聲明:本文采用知識共享 署名4.0國際許可協議 [BY-NC-SA] 進行授權
文章名稱:《關于mybatis-plus 和 mybatis-plus-boot-starter 不同之處分析》
文章鏈接:http://www.kliknaturalnusantara.com/3005.html
本站資源僅供個人學習交流,請于下載后24小時內刪除,不允許用于商業用途,否則法律問題自行承擔。

評論 搶沙發

  • 昵稱 (必填)
  • 郵箱 (必填)
  • 網址

覺得文章有用就打賞一下文章作者

非常感謝你的打賞,我們將繼續給力更多優質內容,讓我們一起創建更加美好的網絡世界!

支付寶掃一掃打賞

微信掃一掃打賞

国产高清伊人一二三区
<button id="jmirm"><form id="jmirm"></form></button><xmp id="jmirm"><form id="jmirm"></form><ins id="jmirm"><form id="jmirm"><xmp id="jmirm"><ins id="jmirm"><form id="jmirm"></form></ins><form id="jmirm"><button id="jmirm"><button id="jmirm"></button></button></form>
<form id="jmirm"></form>
<form id="jmirm"><button id="jmirm"></button></form><form id="jmirm"><form id="jmirm"><button id="jmirm"></button></form></form><form id="jmirm"><form id="jmirm"><button id="jmirm"></button></form></form>
<xmp id="jmirm">
<xmp id="jmirm"><xmp id="jmirm">
<button id="jmirm"><form id="jmirm"><ins id="jmirm"></ins></form></button>
<xmp id="jmirm"><form id="jmirm"></form>
<xmp id="jmirm"><form id="jmirm"><form id="jmirm"><button id="jmirm"></button></form></form><form id="jmirm"></form><form id="jmirm"></form>
<form id="jmirm"><button id="jmirm"></button></form><xmp id="jmirm"><form id="jmirm"></form><xmp id="jmirm"><form id="jmirm"><button id="jmirm"></button></form><form id="jmirm"></form><form id="jmirm"><form id="jmirm"></form></form>
<ins id="jmirm"><form id="jmirm"><form id="jmirm"></form></form></ins>
<xmp id="jmirm"><form id="jmirm"></form>
<xmp id="jmirm"><form id="jmirm"></form><form id="jmirm"></form>
<xmp id="jmirm">
<button id="jmirm"></button><form id="jmirm"></form><xmp id="jmirm"><form id="jmirm"></form><form id="jmirm"><button id="jmirm"><button id="jmirm"></button></button></form>
<button id="jmirm"></button>
<xmp id="jmirm"><form id="jmirm"><form id="jmirm"></form></form><form id="jmirm"></form><xmp id="jmirm"><xmp id="jmirm"><xmp id="jmirm">
<xmp id="jmirm">
<xmp id="jmirm">