ãä¹ ãã¶ãã§ããä¸å°¾ã§ãã
é·ããã¨ããã°ãæ¸ãã¦ãã¾ããã§ããããå°ããã¤æ¸ããã¨æãã¾ãã
ä»å㯠MyBatis Generatorã§åºåããããã¡ã¤ã³ãªãã¸ã§ã¯ãåã«suffixãã¤ãã¦ã¿ã¾ãã
MyBatis Generatorã¯Tableãããã¡ã¤ã³ãªãã¸ã§ã¯ããä½æããæ©è½ãªã®ã§ããããã¡ã¤ã³ãªãã¸ã§ã¯ãåã¯ããã©ã«ãã§Tableåã«è¨å®ããã¾ãã
å¤æ´ããã«ã¯domainObjectRenamingRuleãè¨å®ãã¾ãã
<domainObjectRenamingRule searchString="^(.*)$" replaceString="$0Dto" />
domainObjectRenamingRuleã¯å
é¨ã§ã¯ java.util.regex.Matcher.replaceAll
ã使ã£ã¦ãããããæ£è¦è¡¨ç¾ã§Tableåãå
é ããæ«å°¾ã¾ã§ãåå¾ããsuffixã«æååãçµåãã¾ãã
ä¸è¨ã®ä¾ã ã¨ä»¥ä¸ã®ããã«ãªãã¾ãã
Tableå | ãã¡ã¤ã³ãªãã¸ã§ã¯ãå | domainObjectRenamingRuleãä½¿ç¨ |
---|---|---|
test_user | TestUser.java | TestUserDto.java |
ãã®ããã«ãDtoãæ«å°¾ã«ä»ãããã¾ããã
suffixã§ãprefixã§ãã©ã¡ããä»ãããã¾ãã
ãã¡ã¤ã³ãªãã¸ã§ã¯ãåãå¤æ´ãããã¨èãã¦ãã人ã¯åèã«ãã¦ããã ããã¨å¹¸ãã§ãã