package cn.iocoder.yudao.module.system.dal.mysql.assets;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.assets.AssetsTypeDO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.assets.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 资产类型 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface AssetsTypeMapper extends BaseMapperX<AssetsTypeDO> {

    default PageResult<AssetsTypeDO> selectPage(AssetsTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AssetsTypeDO>()
                .likeIfPresent(AssetsTypeDO::getName, reqVO.getName())
                .eqIfPresent(AssetsTypeDO::getType, reqVO.getType())
                .eqIfPresent(AssetsTypeDO::getPid, reqVO.getPid())
                .betweenIfPresent(AssetsTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AssetsTypeDO::getId));
    }

    /**
     * 通过资产id获取资产类型
     * @param assetsId
     * @return
     */
    AssetsTypeDO getByAssetsId(Long assetsId);

    List<AssetsTypeDO> getByAssetsIds(@Param("assetsIds") List<Long> assetsIds);
}