package com.kcim.dao.repository;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kcim.common.util.UserContext;
import com.kcim.dao.mapper.CostReportIndexMapper;
import com.kcim.dao.model.CostReportIndex;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @program: CostAccount
 * @description:
 * @author: Wang.YS
 * @create: 2024-11-05 14:25
 **/
@Repository
public class CostReportIndexRepository extends ServiceImpl<CostReportIndexMapper,CostReportIndex> {
    public void removeByReportCode(Long code) {
        LambdaQueryWrapper<CostReportIndex> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(CostReportIndex::getReportCode, code);
        queryWrapper.eq(CostReportIndex::getHospId, UserContext.getHospId());
        this.remove(queryWrapper);
    }

    public List<CostReportIndex> getByReportCode(List<Long> collect) {
        LambdaQueryWrapper<CostReportIndex> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(CostReportIndex::getReportCode, collect);
        queryWrapper.eq(CostReportIndex::getHospId, UserContext.getHospId());
        return this.list(queryWrapper);
    }
}
