package com.rf.psychological.wxpay.service.impl;

import com.rf.psychological.wxpay.repository.PromotionInfoRepository;
import com.rf.psychological.wxpay.model.PromotionInfo;
import com.rf.psychological.wxpay.service.PromotionInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description:量表价格接口
 * @Author: zsf
 * @Date: 2022/6/29
 */
@Service
public class PromotionInfoServiceImpl implements PromotionInfoService {


    @Autowired
    private PromotionInfoRepository promotionInfoRepository;

    /**
     * 查询收费信息
     * @param id 量表id
     * @return
     */
    @Override
    public PromotionInfo findInfoBySubjectId(String id) {
        return promotionInfoRepository.findBySubjectId(id);
    }

    @Override
    public PromotionInfo findInfoByFlag(String flag) {
        return promotionInfoRepository.findByFlag(flag);
    }

    /**
     * 保存或更新收费表单
     * @param info 收费表单
     */
    @Override
    public void saveOrUpdateInfo(PromotionInfo info) {
        promotionInfoRepository.save(info);
    }

    @Override
    public List<PromotionInfo> findAll() {
        return promotionInfoRepository.findAll();
    }
}
