package com.fzm.mall.server.front.goods.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fzm.mall.server.front.goods.model.Function;
import com.fzm.mall.server.front.goods.mapper.FunctionMapper;
import com.fzm.mall.server.front.goods.service.IFunctionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 首页功能区 服务实现类
 * </p>
 *
 * @author fzm
 * @since 2021-03-15
 */
@Service
public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> implements IFunctionService {

    @Override
    public List<Function> getFunction() {
        QueryWrapper<Function> query = new QueryWrapper<>();
        query.eq("status",1);
        Long time = System.currentTimeMillis();
        query.ge("end_time",time);
        query.le("start_time",time);
        query.orderByAsc("order_index");
        return list(query);
    }
}
