package com.emergency.avenue.admin.service;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.emergency.avenue.admin.api.entity.SysTreeDict;
import com.emergency.avenue.admin.api.vo.TreeNode;
import com.emergency.avenue.common.core.constant.CacheConstants;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;

/**
 * 工单字典表
 *
 * @author pig code generator
 * @date 2019-04-19 17:11:53
 */
public interface SysTreeDictService extends IService<SysTreeDict> {

	/**
	 * 工单字典表简单分页查询
	 *
	 * @param orderDict 工单字典表
	 * @return
	 */
	IPage<SysTreeDict> getOrderDictPage(Page<SysTreeDict> page, SysTreeDict orderDict);

	/**
	 * 查询字典表
	 *
	 * @param type
	 * @return
	 */
	@Cacheable(value = CacheConstants.SYS_TREE_DICTTREE_DETAILS, key = "#type", unless = "#result.size() == 0")
	List<TreeNode> getDictTree(Integer type);

	/**
	 * 新增工单字典
	 *
	 * @param entity
	 * @return
	 */
	int insert(SysTreeDict entity);

	/**
	 * @param type
	 * @return
	 */
	List<SysTreeDict> getList(Integer type);

	/**
	 * @param typeList
	 * @return
	 */
	List<SysTreeDict> getTypesList(List<Integer> typeList);

	List<SysTreeDict> selectByDicIds(List<String> dictList);

	/**
	 * 根据末级ID查询全部路径
	 * @param  dictId 字典类型
	 * @return list
	 */
	List<SysTreeDict> getOrderDictPath(String dictId);
}
