package cn.aagro.ag.module.pay.dal.mysql.demo;

import cn.aagro.ag.framework.common.pojo.PageParam;
import cn.aagro.ag.framework.common.pojo.PageResult;
import cn.aagro.ag.framework.mybatis.core.mapper.BaseMapperX;
import cn.aagro.ag.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.aagro.ag.module.pay.dal.dataobject.demo.PayDemoOrderDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 示例订单 Mapper
 *
 * @author AIOTAGRO
 */
@Mapper
public interface PayDemoOrderMapper extends BaseMapperX<PayDemoOrderDO> {

    default PageResult<PayDemoOrderDO> selectPage(PageParam reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PayDemoOrderDO>()
                .orderByDesc(PayDemoOrderDO::getId));
    }

    default int updateByIdAndPayed(Long id, boolean wherePayed, PayDemoOrderDO updateObj) {
        return update(updateObj, new LambdaQueryWrapperX<PayDemoOrderDO>()
                .eq(PayDemoOrderDO::getId, id).eq(PayDemoOrderDO::getPayStatus, wherePayed));
    }

}
