alexmao86 / mybatis-generator-plugin

mybatis generator plugin extentions
3 stars 1 forks source link

compile error for plugin SelectOneByExamplePlugin generate BLOB field #4

Open daileyet opened 4 years ago

daileyet commented 4 years ago

table

CREATE TABLE IF NOT EXISTS `b_shop` (
  `id` BIGINT(20) NOT NULL,
  `name` VARCHAR(45) NOT NULL ,
  `code` VARCHAR(45) NULL DEFAULT NULL,
  `desc` LONGTEXT NULL DEFAULT NULL ,
  `cover_image` BLOB NULL DEFAULT NULL ,
  `parent_id` BIGINT(20) NULL DEFAULT NULL ,
  `address` VARCHAR(100) NULL DEFAULT NULL ,
  `contact` VARCHAR(45) NULL DEFAULT NULL ,
  PRIMARY KEY (`id`),
  UNIQUE INDEX `code_UNIQUE` (`code` ASC)
)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8

generatorConfig.xml

<plugin type="net.sourceforge.jweb.mybatis.generator.plugins.SelectOneByExamplePlugin">
   <property name="methodToGenerate" value="selectOneByExample" />
</plugin>

error

 // should define return type BizShop
    default BizShopWithBLOBs selectOneByExampleSafely(BizShopExample example) {
        List<BizShop> list=this.selectByExample(example);
        if(list.isEmpty()) return null;
        if(list.size()>1) {LoggerFactory.getLogger(BizShopMapper.class).info("select one retured {} rows",list.size());}
        return list.get(0);
    }

picture

daileyet commented 4 years ago
BizShopWithBLOBs selectOneByExampleWithBLOBs(BizShopExample example);
BizShopWithBLOBs selectOneByExample(BizShopExample example);

实际上SelectOneByExamplePlugin先生成了两个返回值一样的类型, 再生成带safely时clone了同样的返回类型