/**
 * Copyright 2008-2009. Chongqing Communications Industry Services Co.,Ltd Information Technology Branch. All rights reserved.
 * <a>http://www.crunii.com</a>
 */
package com.crunii.micro.service.sysmgr.jdbc;

import com.crunii.micro.domain.common.jdbc.BaseJdbcTemplate;
import org.springframework.stereotype.Repository;

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

/**
 * @author shenhs create 2023/7/17 11:26
 */
@Repository
public class AppButtonJdbcDao {

	@Resource(name = "mainJT")
	protected BaseJdbcTemplate JT;

	private static final String sql = "select distinct parent_id from tsm_app_button where parent_id IN ";

	public List<Integer> findParentId(List<Integer> ids){
		String collect = ids.stream().map(item -> "?").collect(Collectors.joining(",", "(", ")"));
		collect = sql+ collect;
		return JT.queryForRawObjects(Integer.class, collect, ids.toArray());
	}
}
