package com.backendsys.modules.cms.page.service.impl;

import com.backendsys.exception.CustException;
import com.backendsys.modules.cms.page.dao.PageDao;
import com.backendsys.modules.cms.page.entity.Page;
import com.backendsys.modules.cms.page.service.PageService;
import com.backendsys.utils.response.PageEntity;
import com.backendsys.utils.response.PageInfoResult;
import com.backendsys.utils.v2.PageUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class PageServiceImpl implements PageService {

    @Autowired
    private PageDao pageDao;

    /**
     * 获取单页列表
     */
    @Override
    public PageEntity selectPageList(Page page) {
        PageUtils.startPage();  // 分页
        List<Page> list = pageDao.selectPageList(page);
        return new PageInfoResult(list).toEntity();
    }

    /**
     * 获取单页详情
     */
    @Override
    public Map<String, Object> selectPageDetail(Page page) {
        return pageDao.selectPageDetail(page);
    }

}
