package com.happy.service.impl;

import com.happy.Model.Advertise;
import com.happy.dao.AdvertiseDao;
import com.happy.service.AdvertiseService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("AdvertiseService")
public class AdvertiseImplService implements AdvertiseService {

    @Resource
    public AdvertiseDao advertiseDao;

    public int insertAdvertise(Advertise advertise){
        return advertiseDao.insertAdvertise(advertise);
    }

    public int updateAdvertise(Advertise advertise){
        return advertiseDao.updateAdvertise(advertise);
    }

    public int delAdvertise(int id){
        return advertiseDao.delAdvertise(id);
    }

    // 查询已开启的广告
    public List<Advertise> queryOpenAdvertise(){
        return advertiseDao.queryOpenAdvertise();
    }

    public Advertise queryById(int id){
        return advertiseDao.queryById(id);
    }

    public Advertise queryByTitle(String title){
        return advertiseDao.queryByTitle(title);
    }

    public List<Advertise> queryAdvertisePage(int page, int rows, String sqlx){
        return advertiseDao.queryAdvertisePage(page, rows, sqlx);
    }

    public int queryAdvertiseTotal(String sqlx){
        return advertiseDao.queryAdvertiseTotal(sqlx);
    }

    public int updateState(Integer id, Integer state,String create_time){
        return advertiseDao.updateState(id, state,create_time);
    }
}
