package com.cf.imes.module.system.dal.mysql.label;

import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.system.controller.admin.label.vo.LabelPageReqVO;
import com.cf.imes.module.system.controller.admin.labeltemplate.vo.LabelTemplatePageReqVO;
import com.cf.imes.module.system.dal.dataobject.lable.LabelDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 标签模板 Mapper
 *
 * @author 晨丰科技
 */
@Mapper
public interface LabelMapper extends BaseMapperX<LabelDO> {

    default PageResult<LabelDO> selectPage(LabelPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LabelDO>()
                .eqIfPresent(LabelDO::getType, reqVO.getType())
                .likeIfPresent(LabelDO::getName, reqVO.getName())
                .eqIfPresent(LabelDO::getRemark, reqVO.getRemark())
                .eqIfPresent(LabelDO::getWidth, reqVO.getWidth())
                .eqIfPresent(LabelDO::getHeight, reqVO.getHeight())
                .betweenIfPresent(LabelDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(LabelDO::getId));
    }

}