
package org.sky.scientific.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.sky.core.tenant.annotation.TenantIgnore;
import org.sky.scientific.pojo.dto.AssetDTO;
import org.sky.scientific.pojo.dto.CostSummaryDTO;
import org.sky.scientific.pojo.dto.XmAssetCostQueryParam;
import org.sky.scientific.pojo.entity.AssetEntity;
import org.sky.scientific.pojo.vo.AssetVO;
import org.sky.scientific.pojo.vo.CostSummaryVO;
import org.sky.scientific.pojo.vo.XmAssetCostSummary;

import java.util.List;

/**
 * 资产表 Mapper 接口
 *
 * @author Kd
 * @since 2025-06-29
 */
public interface AssetMapper extends BaseMapper<AssetEntity> {

	/**
	 * 分页
	 * @param page
	 * @param asset
	 * @return
	 */
	List<AssetVO> selectAssetPage(IPage page, @Param("ew") AssetDTO asset);

	AssetEntity selectLastOneByZcbm(@Param("zcbm") String zcbm);

	List<AssetEntity> selectAssetList();

	AssetEntity selectByYearAndMonthAndBmOrMc(@Param("yearAndMonth") String yearAndMonth, @Param("zcbm") String zcbm, @Param("zcmc") String zcmc);
	/**
	 * 批量删除
	 * @param ids
	 * @return
	 */
	boolean physicalDeleteByIds(List<Long> ids);

	/**
	 * 折旧费用、长期待摊费用、无形资产摊销费用汇总表-按年月
	 * @param page
	 * @param dto
	 * @return
	 */
	@TenantIgnore
	List<XmAssetCostSummary> zjCqdtWxzctxFyHzbByYearAndMonth(IPage<XmAssetCostSummary> page, @Param("ew") XmAssetCostQueryParam dto);

	/**
	 * 折旧费用、长期待摊费用、无形资产摊销费用汇总表-按月
	 * @param page
	 * @param dto
	 * @return
	 */
	@TenantIgnore
	List<XmAssetCostSummary> zjCqdtWxzctxFyHzbByYear(IPage<XmAssetCostSummary> page, @Param("ew") XmAssetCostQueryParam dto);

	/**
	 * 研发费用统计-本年各月研发费用汇总表
 	 * @param dto
	 * @return
	 */
	@TenantIgnore
	List<CostSummaryVO> costSummary(CostSummaryDTO dto);

	/**
	 * 修改资产状态
	 * @param asset
	 */
	int updateStatus(@Param("assetId") Long assetId, @Param("status") Integer status);

	/**
	 * 查询资产在项目中的使用情况
	 * @param asset
	 */
	List<Long> checkAssetUsage(List<Long> ids);
}
