1.打开idea模板配置功能
找到idea 的file -> Settings -> Editor -> File and Code Templates
2.将以下脚本贴进去
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")
package ${PACKAGE_NAME};
import java.io.Serializable;
#end
#if(${NAME.indexOf("DTO")} != -1 || ${NAME.indexOf("VO")} != -1 ||
${NAME.indexOf("DO")} != -1 || ${NAME.indexOf("Entity")} != -1 ||
${NAME.indexOf("Param")} != -1 || ${NAME.indexOf("POJO")} != -1)
#parse("File Header.java")
public class ${NAME} implements Serializable{
}
#else
#parse("File Header.java")
public class ${NAME}{
}
#end
3.演示效果