package com.xindazhou.vehicle.dal.mysql.category;

import com.xindazhou.framework.common.pojo.PageResult;
import com.xindazhou.framework.mybatis.core.mapper.BaseMapperX;
import com.xindazhou.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.xindazhou.vehicle.controller.admin.vehicle.vo.VehicleCategoryPageReqVO;
import com.xindazhou.vehicle.dal.dataobject.category.VehicleCategoryDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 分类管理 Mapper
 *
 * @author xindazhou
 */
@Mapper
public interface VehicleCategoryMapper extends BaseMapperX<VehicleCategoryDO> {

    default PageResult<VehicleCategoryDO> selectPage(VehicleCategoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VehicleCategoryDO>()
                .likeIfPresent(VehicleCategoryDO::getName, reqVO.getName())
                .eqIfPresent(VehicleCategoryDO::getIsDisplay, reqVO.getStatus())
                .betweenIfPresent(VehicleCategoryDO::getUpdateTime, reqVO.getUpdateTime())
                .orderByDesc(VehicleCategoryDO::getSort)
                .orderByDesc(VehicleCategoryDO::getId));
    }

}

