package com.yc.ship.module.marketing.dal.mysql.column;

import com.yc.ship.framework.common.pojo.PageResult;
import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yc.ship.module.marketing.controller.admin.column.vo.ColumnPageReqVO;
import com.yc.ship.module.marketing.dal.dataobject.column.ColumnDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 小程序-栏目管理 Mapper
 *
 * @author lfy
 */
@Mapper
public interface ColumnMapper extends BaseMapperX<ColumnDO> {

    default PageResult<ColumnDO> selectPage(ColumnPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ColumnDO>()
                .likeIfPresent(ColumnDO::getName, reqVO.getName())
                .likeIfPresent(ColumnDO::getSubName, reqVO.getSubName())
                .eqIfPresent(ColumnDO::getType, reqVO.getType())
                .eqIfPresent(ColumnDO::getRecommend, reqVO.getRecommend())
                .eqIfPresent(ColumnDO::getStatus, reqVO.getStatus())
                .orderByAsc(ColumnDO::getSort));
    }

}