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

TargetPackagePlugin #106

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

luodexin
Copy link

@luodexin luodexin commented Dec 1, 2019

有的项目组要求按照业务逻辑划分子包,在业务子包中进一步分controller、service, entity、mapper...., ModelClass需要生成在entity包中,ClientClass需要生成在mapper包中,而SQLMAP文件需要在/src/map/xxx/文件夹下,targetPackage属性和domainObjectName无法实现
TargetPackagePlugin可用为一个表的ModelClass、ClientClass、SQLMap分别设置不同的targetPackage

插件:

<xml>
    <plugin type="com.itfsw.mybatis.generator.plugins.TargetPackagePlugin"/>
    
    <table schema="FG_DB" tableName="USER">
        <property name="modelTargetPackage" value="account.entity" />
        <property name="clientTargetPackage" value="account.mapper"/>
        <property name="sqlMapTargetPackage" value="account" />
    </table>
</xml>

生成的三类文件的包名分别为<javaModelGenerator><javaClientGenerator><sqlMapGenerator>标签中配置的targetPackage属性与<table>标签中配置的xxxTargetPackage属性的拼接结果

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

Successfully merging this pull request may close these issues.

None yet

1 participant