package com.yc.ship.module.otc.dal.mysql.storecard;

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.otc.controller.admin.storecard.vo.StoreCardPageReqVO;
import com.yc.ship.module.otc.dal.dataobject.storecard.StoreCardDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 门店资金卡 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface StoreCardMapper extends BaseMapperX<StoreCardDO> {

    default PageResult<StoreCardDO> selectPage(StoreCardPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StoreCardDO>()
                .eqIfPresent(StoreCardDO::getStoreId, reqVO.getStoreId())
                .eqIfPresent(StoreCardDO::getBalance, reqVO.getBalance())
                .eqIfPresent(StoreCardDO::getCreditType, reqVO.getCreditType())
                .eqIfPresent(StoreCardDO::getBalanceType, reqVO.getBalanceType())
                .eqIfPresent(StoreCardDO::getCredit, reqVO.getCredit())
                .eqIfPresent(StoreCardDO::getSurplus, reqVO.getSurplus())
                .betweenIfPresent(StoreCardDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StoreCardDO::getId));
    }

}
