Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

生成的Mapper没有生成@mapper注解 #96

Open
strongyc opened this issue Jun 20, 2023 · 1 comment
Open

生成的Mapper没有生成@mapper注解 #96

strongyc opened this issue Jun 20, 2023 · 1 comment

Comments

@strongyc
Copy link

2.0.5版本生成的Mapper没有生成@Mapper注解

@yhl452493373
Copy link

估计后面会加。现阶段的办法,自己传mapperAnnotationClass参数。模板根据这个参数来决定是否引入Mapper注解:

        GeneratorConfig config = GeneratorConfig.builder()
                .jdbcUrl(url)
                .userName(username)
                .password(password)
                .driverClassName(driverClassName)
                .dateType(DateType.TIME_PACK)
                //数据库schema,MSSQL,PGSQL,ORACLE,DB2类型的数据库需要指定
                //.schemaName("myBusiness")
                //数据库表前缀,生成entity名称时会去掉(v2.0.3新增)
                .tablePrefix(tablePrefix)
                .nameConverter(new NameConverter() {
                    /**
                     * 自定义Service类文件的名称规则
                     */
                    @Override
                    public String serviceNameConvert(String entityName) {
                        return entityName + "Service";
                    }
                })
                .templateVaribleInjecter(tableInfo -> {
                    Map<String, Object> map = new HashMap<>();
                    map.put("mapperAnnotationClass", org.apache.ibatis.annotations.Mapper.class);
                    return map;
                })
                //所有生成的java文件的父包名,后续也可单独在界面上设置
                .basePackage(parent)
                .port(8068)
                .build();
        MybatisPlusToolsApplication.run(config);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants