In the previous post, we have passed the idea on a database connection, here, according to the database to generate POJO fields by IDEA comes with features
1. Select a table, right ---> Scripted Extensions ---> select Generate POJOS.clj or Generate POJOS.groovy, select the path you need to store complete
Pojo generated in this way there is a problem, the primary key id type is long, not what we expected
Can be achieved by modifying the groovy script, first open the directory script:
、
As follows: You can see the script inside a default package name and data type definitions:
And the package name data type is changed to the type we need to save and then re-generated code (which may be output directly to a packet routing path to the idea works pojo)
Generating good as follows: