package com.zt.plat.module.base.dal.dao.businessdictionarytype;

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

/**
 * 业务字典类型 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface BusinessDictionaryTypeMapper extends BaseMapperX<BusinessDictionaryTypeDO> {

    default PageResult<BusinessDictionaryTypeDO> selectPage(BusinessDictionaryTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BusinessDictionaryTypeDO>()
                .likeIfPresent(BusinessDictionaryTypeDO::getName, reqVO.getName())
                .likeIfPresent(BusinessDictionaryTypeDO::getType, reqVO.getType())
                .eqIfPresent(BusinessDictionaryTypeDO::getStatus, reqVO.getStatus())
                .orderByDesc(BusinessDictionaryTypeDO::getId));
    }

    default BusinessDictionaryTypeDO selectByType(String type) {
        return selectOne(BusinessDictionaryTypeDO::getType, type);
    }

}