package com.yd.csf.service.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yd.csf.feign.dto.salarysplit.ApiSalarySplitPageDto;
import com.yd.csf.feign.dto.salarysplit.ApiSalarySplitSummaryPageDto;
import com.yd.csf.feign.request.salarysplit.ApiSalarySplitExportSummaryListRequest;
import com.yd.csf.feign.request.salarysplit.ApiSalarySplitPageRequest;
import com.yd.csf.feign.request.salarysplit.ApiSalarySplitSummaryPageRequest;
import com.yd.csf.service.model.SalarySplit;
import com.yd.csf.service.dao.SalarySplitMapper;
import com.yd.csf.service.service.ISalarySplitService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 薪资拆分应发表 服务实现类
 * </p>
 *
 * @author zxm
 * @since 2026-03-30
 */
@Service
public class SalarySplitServiceImpl extends ServiceImpl<SalarySplitMapper, SalarySplit> implements ISalarySplitService {

    @Override
    public IPage<ApiSalarySplitSummaryPageDto> summaryPage(Page<ApiSalarySplitSummaryPageDto> page,
                                                           ApiSalarySplitSummaryPageRequest request) {
        return this.baseMapper.summaryPage(page,request);
    }

    @Override
    public List<ApiSalarySplitSummaryPageDto> summaryList(ApiSalarySplitExportSummaryListRequest request) {
        return this.baseMapper.summaryList(request);
    }

    @Override
    public IPage<ApiSalarySplitPageDto> page(Page<ApiSalarySplitPageDto> page,
                                            ApiSalarySplitPageRequest request) {
        return this.baseMapper.page(page,request);
    }

    @Override
    public List<String> queryList(ApiSalarySplitSummaryPageRequest request){
        return this.baseMapper.queryList(request);
    }

    /**
     * 根据出账记录删除对应薪资拆分记录信息
     * @param fortuneAccountBizId
     * @return
     */
    @Override
    public Boolean deleteByFortuneAccountBizId(String fortuneAccountBizId) {
        return this.remove(new LambdaQueryWrapper<SalarySplit>()
                .eq(SalarySplit::getFortuneAccountBizId,fortuneAccountBizId));
    }
}
