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

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.yh.saas.common.support.util.IdGenerator;
import com.yh.saas.plugin.yiliangyiyun.entity.StorageFeeRecordCharge;
import com.yh.saas.plugin.yiliangyiyun.mapper.StorageFeeRecordChargeMapper;
import com.yh.saas.plugin.yiliangyiyun.service.IStorageFeeRecordChargeService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 记录代储费收费信息 服务实现类
 * </p>
 *
 * @author Gdc
 * @since 2022-01-18
 */
@Service
public class StorageFeeRecordChargeServiceImpl extends ServiceImpl<StorageFeeRecordChargeMapper, StorageFeeRecordCharge> implements IStorageFeeRecordChargeService {

    /**
     * 收费
     * @param storageFeeRecordCharge
     * @return
     */
    @Override
    public String addCharge(StorageFeeRecordCharge storageFeeRecordCharge) {
        storageFeeRecordCharge.setId(IdGenerator.generateUUID());
        this.insert(storageFeeRecordCharge);
        return "ok";
    }

    @Override
    public List<StorageFeeRecordCharge> feeRecord(String contractId) {
        List<StorageFeeRecordCharge> storageFeeRecordCharges=this.selectList(new EntityWrapper<StorageFeeRecordCharge>()
            .eq("contract_id",contractId));
        return storageFeeRecordCharges;
    }
}
