package com.cool.store.dao.menu;

import com.cool.store.entity.menu.MiniMenuDO;
import com.cool.store.mapper.menu.MiniMenuMapper;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 * 小程序菜单DAO
 * </p>
 *
 * @author wangff
 * @since 2025/11/28
 */
@Repository
@RequiredArgsConstructor
public class MiniMenuDAO {
    private final MiniMenuMapper miniMenuMapper;

    public List<MiniMenuDO> getByIds(List<Long> ids) {
        if (CollectionUtils.isEmpty(ids)) {
            return Collections.emptyList();
        }
        Example example = new Example(MiniMenuDO.class);
        example.createCriteria().andIn("id", ids);
        return miniMenuMapper.selectByExample(example);
    }
}
