package com.zt.plat.module.base.dal.mysql.tmpltp;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.base.controller.admin.templtp.vo.TmpItmPageReqVO;
import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplItmDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface TmplItmMapper extends BaseMapperX<TmplItmDO> {
    default PageResult<TmplItmDO> selectPage(TmpItmPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TmplItmDO>()
                .eqIfPresent(TmplItmDO::getItmVal, reqVO.getItmVal())
                .likeIfPresent(TmplItmDO::getItmName, reqVO.getItmName())
                .likeIfPresent(TmplItmDO::getItmNum, reqVO.getItmNum())
                .eqIfPresent(TmplItmDO::getRmk, reqVO.getRmk())
                .eqIfPresent(TmplItmDO::getSts, reqVO.getSts())
                .betweenIfPresent(TmplItmDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TmplItmDO::getId));
    }
}
