package org.sky.scientific.mapper;

import com.alibaba.fastjson.JSONObject;
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.XmCostDetailsDTO;
import org.sky.scientific.pojo.entity.XmCostDetailsEntity;
import org.sky.scientific.pojo.vo.CostItemVO;
import org.sky.scientific.pojo.vo.DeductionCostDetailVO;
import org.sky.scientific.pojo.vo.FinanceCostDetailVO;
import org.sky.scientific.pojo.vo.HighTechCostDetailVO;

import java.util.List;

/**
 * 研发费用支出明细账 Mapper 接口
 *
 * @author Kd
 * @since 2025-07-30
 */
public interface XmCostDetailsMapper extends BaseMapper<XmCostDetailsEntity> {

	/**
	 * 月分页
	 *
	 * @param page 分页参数
	 * @param dto 查询参数
	 * @return List<XmCostDetailsEntity>
	 */
	List<XmCostDetailsEntity> selectPageByYearAndMonth(IPage<XmCostDetailsEntity> page, @Param("ew") XmCostDetailsDTO dto);

	/**
	 * 年-分页
	 * @param page
	 * @param dto
	 * @return
	 */
	List<XmCostDetailsEntity> selectPageByYear(IPage<XmCostDetailsEntity> page, @Param("ew") XmCostDetailsDTO dto);

	int physicalDeleteByIds(List<Long> ids);

	/**
	 * 会计口径-研发费用辅助明细账
	 * @param dto
	 * @return
	 */

	@TenantIgnore
    List<FinanceCostDetailVO> financeCostDetail(XmCostDetailsDTO dto);

	/**
	 * 高新口径-研发费用辅助明细账
	 * @param dto
	 * @return
	 */
	@TenantIgnore
	List<HighTechCostDetailVO> highTechCostDetail(XmCostDetailsDTO dto);

	/**
	 * 加计扣除-研发支出辅助明细账
	 * @param dto
	 * @return
	 */
	@TenantIgnore
	List<DeductionCostDetailVO> deductionCostDetail(XmCostDetailsDTO dto);

	/**
	 * 会计/高新/加计扣除口径-研发费用辅助账汇总表
	 * @param page
	 * @param dto
	 * @return
	 */
	@TenantIgnore
	List<JSONObject> costSummary(IPage<JSONObject> page, @Param("ew") XmCostDetailsDTO dto);

	@TenantIgnore
	List<CostItemVO> selectCostItemByCondition(@Param("yearAndMonth") String yearAndMonth, @Param("xmId") Long xmId);

}
