package com.backendsys.modules.cms.template;

import com.backendsys.modules.common.aspect.Pages;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class ViewIndexController {

    @Pages
    @GetMapping({"/"})
    public String index(Model model, HttpServletRequest request) {

        model.addAttribute("title","首页");

//        model.addAttribute("bannerList", cmsBannerService.queryBannerPublic());
//
//        CmsArticleDTO cmsArticleDTO = new CmsArticleDTO();
//        cmsArticleDTO.setLang((String) model.getAttribute("lang"));
//
//        // 分类1
//        cmsArticleDTO.setCategory_id(1L);
//        Map<String, Object> list1 = cmsArticleService.queryArticle(1, 4, cmsArticleDTO);
//        model.addAttribute("articleList1", list1);
//
//        // 分类2
//        cmsArticleDTO.setCategory_id(2L);
//        Map<String, Object> list2 = cmsArticleService.queryArticle(1, 4, cmsArticleDTO);
//        model.addAttribute("articleList2", list2);

        // -- Layout ---------------------------------------------
        model.addAttribute("layout", "index");
        return "layout/layout";
    }

}
