+ * 首页 Controller + *
+ * + * @package: com.xkcoding.springbootdemotemplatebeetl.controller + * @description: 首页 Controller + * @author: yangkai.shen + * @date: Created in 2018/4/26 下午4:36 + * @copyright: Copyright (c) 2018 + * @version: V1.0 + * @modified: yangkai.shen + */ +@Controller +public class HomeController { + + @GetMapping({"", "/", "/index"}) + public ModelAndView index() { + ModelAndView view = new ModelAndView("/index.btl"); + User admin = new User(0, "admin", "phone0",true); + List序号 | +编号 | +姓名 | +手机 | +职位 | +注册日期 | +|
---|---|---|---|---|---|---|
${uLP.index} | +${u.id} | +${u.name} | +${u.tel} | +${u.admin?"管理员":"员工"} | + <%if(uLP.even){%> +<%var today = date();%> ${today,dateFormat="yyyy-MM-dd HH:mm:ss"} | + <%}else{%> +<%var today = date();%> ${today,dateFormat="yyyy-MM-dd"} | + <%}%> +
+ * 首页 Controller + *
+ * + * @package: com.xkcoding.springbootdemotemplatebeetl.controller + * @description: 首页 Controller + * @author: yangkai.shen + * @date: Created in 2018/4/26 下午4:36 + * @copyright: Copyright (c) 2018 + * @version: V1.0 + * @modified: yangkai.shen + */ +@Controller +public class HomeController { + + @GetMapping({"", "/", "/index"}) + public ModelAndView index() { + ModelAndView view = new ModelAndView("/index.btl"); + User admin = new User(0, "admin", "phone0",true); + List+ * 用户实体类 + *
+ * + * @package: com.xkcoding.springbootdemotemplatebeetl.model + * @description: 用户实体类 + * @author: yangkai.shen + * @date: Created in 2018/4/26 下午4:46 + * @copyright: Copyright (c) 2018 + * @version: V1.0 + * @modified: yangkai.shen + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class User implements Serializable { + private Integer id; + private String name; + private String tel; + private Boolean admin; +} diff --git a/spring-boot-demo-template-beetl/src/main/resources/application.yml b/spring-boot-demo-template-beetl/src/main/resources/application.yml new file mode 100644 index 0000000..172dc29 --- /dev/null +++ b/spring-boot-demo-template-beetl/src/main/resources/application.yml @@ -0,0 +1,5 @@ +server: + port: 8080 + context-path: /demo +beetlSql: + enabled: false diff --git a/spring-boot-demo-template-beetl/src/main/resources/templates/index.btl b/spring-boot-demo-template-beetl/src/main/resources/templates/index.btl new file mode 100644 index 0000000..0017df3 --- /dev/null +++ b/spring-boot-demo-template-beetl/src/main/resources/templates/index.btl @@ -0,0 +1,62 @@ + + + + + + +序号 | +编号 | +姓名 | +手机 | +职位 | +注册日期 | +|
---|---|---|---|---|---|---|
${uLP.index} | +${u.id} | +${u.name} | +${u.tel} | +${u.admin?"管理员":"员工"} | + <%if(uLP.even){%> +<%var today = date();%> ${today,dateFormat="yyyy-MM-dd HH:mm:ss"} | + <%}else{%> +<%var today = date();%> ${today,dateFormat="yyyy-MM-dd"} | + <%}%> +