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

[Bug] DDL中的column name如果是驼峰规则,生成的Java field会变成全小写 #108

Open
Anilople opened this issue Feb 8, 2021 · 1 comment

Comments

@Anilople
Copy link

Anilople commented Feb 8, 2021

复现步骤

1. 使用特定的DDL

使用

CREATE TABLE 'sys_user_info' (
  'userId' int(11) NOT NULL AUTO_INCREMENT COMMENT '用户编号',
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户信息'

image

column name是userId不是user_id

2. web界面点击

image

3. 查看生成的代码

image

    @Id
    @GeneratedValue
    /**
    * 用户编号
    */
    @Column(name="userid")
    private Integer userid;

期望得到的是userId,而不是全小写的userid

@Anilople
Copy link
Author

Anilople commented Feb 8, 2021

源码在方法com.softdev.system.generator.util.TableParseUtil#processTableIntoClassInfo

中的

        //deal with special character
        tableSql = tableSql.trim().replaceAll("'", "`").replaceAll("\"", "`").replaceAll(",", ",").toLowerCase();

将整个DDL转为了小写,所以userId在这里被转为了userid

请问这里设计的初衷是?

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

1 participant