GithubHelp home page GithubHelp logo

Comments (4)

itfsw avatar itfsw commented on June 6, 2024

您好,已经看到您的提交,这里返回统一都使用的resultType来做的参数绑定,请问会出什么问题吗?
使用resultType来做是因为如果在代码生成时如果采用resultMap当代码生成开启

<property name="constructorBased" value="true"/>

最终会因为构造函数参数个数不对应产生错误,所以当时考虑使用resultType来做属性绑定。
如果您使用中有什么异常,能具体描述一下吗?

from mybatis-generator-plugin.

ttarcher avatar ttarcher commented on June 6, 2024
        <result column="redundant_school_region" jdbcType="VARCHAR" property="schoolRegion"/>

需要数据库字段名称跟resultType的model字段是,不用resultMap的话无法关联

from mybatis-generator-plugin.

itfsw avatar itfsw commented on June 6, 2024

了解,那这里可能要单独再生成一个属性绑定的resultMap而不能使用原生那个,不然在启用constructorBased会出异常,我尽快修正。谢谢您的反馈!

from mybatis-generator-plugin.

itfsw avatar itfsw commented on June 6, 2024

已修复这个bug,请使用最新版本

<dependency>
    <groupId>com.itfsw</groupId>
    <artifactId>mybatis-generator-plugin</artifactId>
    <version>1.1.1</version>
</dependency>

UPDATE:

  • bugfix(issues#16):SelectSelectivePlugin插件返回类型之前是使用resultType进行返回(规避在启用constructorBased时因为参数个数不同导致的异常),但是在用户使用自定义column时会出现属性不对应的BUG,所以修复成使用resultMap进行属性绑定;
  • PS:如果没有自定义column之前版本不影响正常使用,而且改为使用resultMap进行属性绑定时,当某一行所有数据都为null时会存在list中存在空元素情况,使用时一定要注意进行null判断(这个是Mybatis自身机制不是插件异常,Mybatis对于不存在值的行不会生成对象,当然如果有更好的处理办法欢迎大家提出来)!

from mybatis-generator-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.