package com.ibeetl.admin.flow.service;

import com.ibeetl.admin.core.service.BaseService;
import com.ibeetl.admin.flow.dao.DirectedFestivalProductDao;
import com.ibeetl.admin.flow.entity.DirectedFestivalProductEntity;
import com.ibeetl.admin.flow.entity.DirectedProductEntity;
import com.ibeetl.admin.flow.entity.DirectedSmsTemplateEntity;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class DirectedFestivalProductService extends BaseService<DirectedFestivalProductEntity> {

    @Autowired
    private DirectedFestivalProductDao directedFestivalProductDao;

    public PageQuery<DirectedFestivalProductEntity> searchFestivalProduct(PageQuery<DirectedFestivalProductEntity> page) {
        return directedFestivalProductDao.searchFestivalProduct(page);
    }

    public DirectedFestivalProductEntity findById(String id) {
        return directedFestivalProductDao.findById(id);
    }

    public DirectedFestivalProductEntity findByFescod(String fescod) {
        return directedFestivalProductDao.findByFescod(fescod);
    }

    @Transactional(rollbackFor = Exception.class)
    public void saveFestivalProduct(DirectedFestivalProductEntity entity) {
        directedFestivalProductDao.saveFestivalProduct(entity);
    }

    @Transactional(rollbackFor = Exception.class)
    public void updateFestivalProduct(DirectedFestivalProductEntity entity) {
        directedFestivalProductDao.updateFestivalProduct(entity);
    }

    @Transactional(rollbackFor = Exception.class)
    public void deleteFestivalProductById(DirectedFestivalProductEntity entity) {
        directedFestivalProductDao.deleteFestivalProductById(entity);
    }

    @Transactional(rollbackFor = Exception.class)
    public void deleteFestivalProductByFescod(DirectedFestivalProductEntity entity) {
        directedFestivalProductDao.deleteFestivalProductByFescod(entity);
    }

    @Transactional(rollbackFor = Exception.class)
    public List<DirectedProductEntity> findAllDirectedProduct() {
        return directedFestivalProductDao.findAllDirectedProduct();
    }

    public List<DirectedSmsTemplateEntity> findAllCpinfo() {
        return directedFestivalProductDao.findAllCpinfo();
    }
}
