package com.zhentao.service.impl;

import com.zhentao.entity.HomeFunctionGrid;
import com.zhentao.mapper.HomeFunctionGridMapper;
import com.zhentao.service.HomeFunctionGridService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * <p>
 * 首页金刚区功能表 服务实现类
 * </p>
 *
 * @author zhentao
 * @since 2024-05-20
 */
@Service
public class HomeFunctionGridServiceImpl extends ServiceImpl<HomeFunctionGridMapper, HomeFunctionGrid> implements HomeFunctionGridService {

    @Override
    public List<HomeFunctionGrid> getEnabledFunctionGrids() {
        // 查询启用的金刚区功能，按排序字段升序排列
        return baseMapper.selectList(new LambdaQueryWrapper<HomeFunctionGrid>()
                .eq(HomeFunctionGrid::getStatus, true)
                .orderByAsc(HomeFunctionGrid::getSort)
        );
    }
}
