diff --git a/.idea/webContexts.xml b/.idea/webContexts.xml index 86260cc..aabcb9e 100644 --- a/.idea/webContexts.xml +++ b/.idea/webContexts.xml @@ -6,6 +6,8 @@ + + diff --git a/lib/sitemesh-2.4.2.jar b/lib/sitemesh-2.4.2.jar deleted file mode 100644 index e881e47..0000000 Binary files a/lib/sitemesh-2.4.2.jar and /dev/null differ diff --git a/pom.xml b/pom.xml index 19c82d6..01c213a 100644 --- a/pom.xml +++ b/pom.xml @@ -437,6 +437,12 @@ spring-boot-starter-data-jpa + + org.sitemesh + sitemesh + 3.0.1 + + diff --git a/src/main/java/me/mofun/config/MySiteMeshFilter.java b/src/main/java/me/mofun/config/MySiteMeshFilter.java new file mode 100644 index 0000000..9977955 --- /dev/null +++ b/src/main/java/me/mofun/config/MySiteMeshFilter.java @@ -0,0 +1,27 @@ +package me.mofun.config; + +import org.sitemesh.builder.SiteMeshFilterBuilder; +import org.sitemesh.config.ConfigurableSiteMeshFilter; +import org.springframework.stereotype.Component; + +@Component +public class MySiteMeshFilter extends ConfigurableSiteMeshFilter { + + @Override + protected void applyCustomConfiguration(SiteMeshFilterBuilder builder) { + + // 添加排除规则 + builder.addExcludedPath("*/productTypeMenuList.jsp"); + builder.addExcludedPath("/menuList/productTypeMenuList.jsp"); + builder.addExcludedPath("/WEB-INF/template/my/list/menuList/productTypeMenuList.jsp"); + builder.addExcludedPath("/WEB-INF/template/my/list/menuList/productTypeMenuListResult.jsp"); + builder.addExcludedPath("/editor/*"); + + // 添加装饰器映射 + builder.addDecoratorPath("*/WEB-INF/template/*", "/my/template_footer.jsp") + .addDecoratorPath("*/WEB-INF/template/**", "/root/index_template.jsp") + .addDecoratorPath("*/WEB-INF/admin/*", "/admin_main.jsp") + .addDecoratorPath("*/WEB-INF/admin/*", "/admin_template.jsp") + .addDecoratorPath("*/WEB-INF/template/my/products/serviceLogic/*", "/serviceLogic_template.jsp"); + } +} \ No newline at end of file diff --git a/src/main/java/me/mofun/controller/IndexController.java b/src/main/java/me/mofun/controller/IndexController.java index 8efd721..dafcfe8 100644 --- a/src/main/java/me/mofun/controller/IndexController.java +++ b/src/main/java/me/mofun/controller/IndexController.java @@ -110,9 +110,9 @@ public class IndexController { initRecommendProduct(mav); initNewsList(mav); initIndexImgList(mav); -// initUpcomingProducts(mav); + initUpcomingProducts(mav); - mav.setViewName("/WEB-INF/template/my/index/index-new"); + mav.setViewName("/WEB-INF/template/my/index/index"); return mav; } diff --git a/src/main/java/me/mofun/util/ProductTypeMenuList.java b/src/main/java/me/mofun/util/ProductTypeMenuList.java index 7c9fd90..10570fe 100644 --- a/src/main/java/me/mofun/util/ProductTypeMenuList.java +++ b/src/main/java/me/mofun/util/ProductTypeMenuList.java @@ -12,14 +12,20 @@ import java.util.List; @Component public class ProductTypeMenuList { - @Autowired - IProducttypeService productTypeService; - -// // 直接通过 Bean 调用,无需静态 -// public List getTypeSubList() { -// return productTypeService.getAllProductTypeTree(); -// } -// - + @Autowired + private IProducttypeService productTypeService; + + private static IProducttypeService theProductTypeService; + + @PostConstruct + public void init() { + theProductTypeService = this.productTypeService; + } + + // 直接通过 Bean 调用,无需静态 + public static List getTypeSubList() { + return theProductTypeService.getAllProductTypeTree(); + } + } diff --git a/src/main/resources/mapper/SpellbuyproductMapper.xml b/src/main/resources/mapper/SpellbuyproductMapper.xml index d723d2d..f32e811 100644 --- a/src/main/resources/mapper/SpellbuyproductMapper.xml +++ b/src/main/resources/mapper/SpellbuyproductMapper.xml @@ -123,10 +123,51 @@ + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +