Spring boot入门(三):SpringBoot集成结合AdminLTE(Freemarker),利用generate自动生成代码,利用DataTable和PageHelper进行分页显示

 关于SpringBoot和PageHelper,前篇博客已经介绍过

(2)SpringBoot后台集成AdminLTE

  首先在官网下载AdminLTE模板,然后将此模板的全部文件拷贝到项目下:

  拷贝后,将AdminLTE文件进行了拆分,其中base里面是AdminLTE自带的所有js包和css文件,main中是AdminLTE主页面渲染页面,index是入口。这么做的目的:直接将base通过FreeMarker中宏的形式引入到index入口页面中,那么所有的js文件将一直曾在最底层的页面下,在后期的其它页面的开发中,不需要再次引入js包,避免js包混乱。

  启动项目:

  (3)配置generate

  generate的介绍比较多,此处直接介绍配置的步骤及代码

  编写generatorConfig.xml文件,并放在templates根目录下,若放在其它目录中,则需要在pom.xml中配置路径,否则,编译的时候无法通过。具体错误:

复制代码
1 [ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5:generate (default-cli) on project edu: configfile D:\8_Project\learn\edu\src\main\resources\generatorConfig.xml does not exist -> [Help 1] 2 [ERROR]  3 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 4 [ERROR] Re-run Maven using the -X switch to enable full debug logging. 5 [ERROR]  6 [ERROR] For more information about the errors and possible solutions, please read the following articles: 7 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
复制代码

generatorConfig.xml的脚本如下,其中targetProject的路径需要曾在,否则会报错,参考https://blog.csdn.net/hh680821/article/details/79051870

复制代码
 1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE generatorConfiguration  3         PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"  4         "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> 5  6 <generatorConfiguration> 7    <!-- <properties resource="application.properties"/>--> 8  9     <context id="Mysql" targetRuntime="MyBatis3Simple" defaultModelType="flat">10         <!--属性配置  -->11         <property name="beginningDelimiter" value="`"/>12         <property name="endingDelimiter" value="`"/>13         <!--去除注释  -->14        
                        
关键字:
50000+
5万行代码练就真实本领
17年
创办于2008年老牌培训机构
1000+
合作企业
98%
就业率

联系我们

电话咨询

0532-85025005

扫码添加微信