package io.renren.modules.admin.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.admin.dao.AdvertiseDao;
import io.renren.modules.admin.entity.AdvertiseEntity;
import io.renren.modules.admin.service.AdvertiseService;

@Service("advertiseService")
public class AdvertiseServiceImpl extends ServiceImpl<AdvertiseDao, AdvertiseEntity> implements AdvertiseService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<AdvertiseEntity> page = this.page(new Query<AdvertiseEntity>().getPage(params),
                new QueryWrapper<AdvertiseEntity>());

        return new PageUtils(page);
    }

    @Override
    public List<AdvertiseEntity> queryList() {
        return this.list(new QueryWrapper<AdvertiseEntity>().last("limit 6"));
    }

}