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

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.print.vo.PrintPageReqVO;
import com.yc.ship.module.otc.dal.dataobject.print.PrintDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 打印模板 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface PrintMapper extends BaseMapperX<PrintDO> {

    default PageResult<PrintDO> selectPage(PrintPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PrintDO>()
                .likeIfPresent(PrintDO::getTemplateName, reqVO.getTemplateName())
                .likeIfPresent(PrintDO::getPrinterName, reqVO.getPrinterName())
                .eqIfPresent(PrintDO::getTemplateType, reqVO.getTemplateType())
                .eqIfPresent(PrintDO::getTemplateCode, reqVO.getTemplateCode())
                .eqIfPresent(PrintDO::getIsDefault, reqVO.getIsDefault())
                .eqIfPresent(PrintDO::getIsUse, reqVO.getIsUse())
                .betweenIfPresent(PrintDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PrintDO::getId));
    }

}
