{"action":"reopened","issue":{"url":"https://api.github.com/repos/baomidou/mybatis-plus/issues/520","repository_url":"https://api.github.com/repos/baomidou/mybatis-plus","labels_url":"https://api.github.com/repos/baomidou/mybatis-plus/issues/520/labels{/name}","comments_url":"https://api.github.com/repos/baomidou/mybatis-plus/issues/520/comments","events_url":"https://api.github.com/repos/baomidou/mybatis-plus/issues/520/events","html_url":"https://github.com/baomidou/mybatis-plus/issues/520","id":364336049,"node_id":"MDU6SXNzdWUzNjQzMzYwNDk=","number":520,"title":"AutoGenerator是否可以支持自动跳过父类的字段？","user":{"login":"acxlam","id":30719115,"node_id":"MDQ6VXNlcjMwNzE5MTE1","avatar_url":"https://avatars0.githubusercontent.com/u/30719115?v=4","gravatar_id":"","url":"https://api.github.com/users/acxlam","html_url":"https://github.com/acxlam","followers_url":"https://api.github.com/users/acxlam/followers","following_url":"https://api.github.com/users/acxlam/following{/other_user}","gists_url":"https://api.github.com/users/acxlam/gists{/gist_id}","starred_url":"https://api.github.com/users/acxlam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acxlam/subscriptions","organizations_url":"https://api.github.com/users/acxlam/orgs","repos_url":"https://api.github.com/users/acxlam/repos","events_url":"https://api.github.com/users/acxlam/events{/privacy}","received_events_url":"https://api.github.com/users/acxlam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-09-27T07:17:36Z","updated_at":"2018-10-20T01:07:51Z","closed_at":null,"author_association":"NONE","body":"### `当前使用版本`\r\n3.0.3\r\n\r\n\r\n### 该问题是怎么引起的？\r\n系统不同的实体使用不同的父类，能否尝试通过Classs.forName自行跳过父类的字段？现在只能自己写代码获取，不是很方便。\r\n\r\n\r\n```  \r\n//  strategy.setSuperEntityColumns(fieldsToUnderScore(Class.forName(\"xxxx\")));\r\n\r\nprivate static List<String> fieldsToUnderScore(Class<?> clazz) {\r\n\r\n\t\tList<String> allFields =  Arrays.stream(clazz.getDeclaredFields())\r\n\t\t\t\t.map(field -> CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, field.getName())).collect(\r\n\t\t\t\t\t\tCollectors.toList());\r\n\r\n\t\t//父类属性一并加上\r\n\t\tClass<?> parentClass = clazz.getSuperclass();\r\n\r\n\t\tif (parentClass != null) {\r\n\t\t\tallFields.addAll(fieldsToUnderScore(parentClass));\r\n\t\t}\r\n\r\n\t\treturn allFields;\r\n\r\n\t}\r\n   \r\n\t\r\n\r\n\r\n\r\n```\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"qmdx"}}