mybatis generator columnRenamingRule使用

    xiaoxiao2021-04-17  38

    使用generator生成代码的时候,可能因为表有前缀,生成的代码也会带出前缀如:

    表字段c_product_code,生成的代码为private String cProductCode;

    解决的方案是使用columnRenamingRule,如:<columnRenamingRule searchString="^c" replaceString=""/>,原理就是把道字母的c字符替换掉。

    但如果字段中有c_product_code又有l_loan,这样多种字符开头的呢?

    解决的方案是<columnRenamingRule searchString="^." replaceString=""/>,意思是把所有的首字母去掉;

    其内部就是使用正则表达式,如有其它规则可以研究正则表达式的使用。

    转载请注明原文地址: https://ju.6miu.com/read-674116.html

    最新回复(0)