package com.cpop.jambox.business.service.impl;

import com.cpop.core.base.entity.PageDomain;
import com.cpop.core.utils.sql.SqlUtils;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.cpop.jambox.business.entity.website.Development;
import com.cpop.jambox.business.mapper.DevelopmentMapper;
import com.cpop.jambox.business.service.DevelopmentService;
import org.springframework.stereotype.Service;

import java.time.LocalDate;

/**
 * 果酱模块化官网 发展历程表 服务层实现。
 *
 * @author Yxz
 * @since 2024-01-19
 */
@Service("developmentService")
public class DevelopmentServiceImpl extends ServiceImpl<DevelopmentMapper, Development> implements DevelopmentService {


    /**
     * 分页查询果酱模块化官网 合作平台表
     *
     * @author: Yxz
     * @date: 2024/1/21 15:59
     * @param: [title, link, publishTime]
     * @return: com.mybatisflex.core.paginate.Page<com.cpop.jambox.business.entity.website.Development>
     **/
    @Override
    public Page<Development> selectPage(String title, LocalDate startTime,LocalDate endTime) {
        PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
        Page<Development> cooperationPage = this.mapper.paginate(Page.of(pageDomain.getPageNum(), pageDomain.getPageSize()),
                QueryWrapper.create().like("title", title)
                        .between("publish_time",startTime,endTime));
        return cooperationPage;
    }
}
