package com.yh.saas.plugin.yiliangyiyun.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.yh.saas.plugin.yiliangyiyun.entity.ExpenseAllocationInfo;
import com.yh.saas.plugin.yiliangyiyun.mapper.ExpenseAllocationInfoMapper;
import com.yh.saas.plugin.yiliangyiyun.service.IExpenseAllocationInfoService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 记录费用分配表信息 服务实现类
 * </p>
 *
 * @author Gdc
 * @since 2022-06-02
 */
@Service
public class ExpenseAllocationInfoServiceImpl extends ServiceImpl<ExpenseAllocationInfoMapper, ExpenseAllocationInfo> implements IExpenseAllocationInfoService {

    /**
     * 单条删除
     * @param id
     */
    @Override
    public void deleteInfo(String id) {
        ExpenseAllocationInfo expenseAllocationInfo=this.selectById(id);
        if (expenseAllocationInfo != null) {
            this.deleteById(expenseAllocationInfo.getId());
        }
    }

    @Override
    public ExpenseAllocationInfo getExpenseAllocationInfo(String contractNo, String costType) {
        ExpenseAllocationInfo expenseAllocationInfo=this.selectOne(new EntityWrapper<ExpenseAllocationInfo>()
        .eq("contract_no",contractNo)
        .eq("cost_type",costType));
        return expenseAllocationInfo;
    }
}
