/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.manager.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.manager.entity.WbsFormElement;
import org.springblade.manager.entity.WbsTree;
import org.springblade.manager.vo.WbsNodeTableVO;
import org.springblade.manager.vo.WbsTreeVO;

import java.util.List;

/**
 *  Mapper 接口
 *
 * @author liuyc
 * @since 2022-04-25
 */
public interface WbsTreeMapper extends BaseMapper<WbsTree> {

	/**
	 * 自定义分页
	 *
	 * @param page
	 * @param wbsTree
	 * @return
	 */
	List<WbsTreeVO> selectWbsTreePage(IPage page, WbsTreeVO wbsTree);


	/**
	 * 懒加载获取树形节点
	 *
	 * @param tenantId
	 * @param parentId
	 * @return
	 */
	List<WbsTreeVO> lazyTree(String tenantId, Long parentId);

	/**
	 * 获取树形节点
	 *
	 * @param tenantId
	 * @return
	 */
	List<WbsTreeVO> tree(String tenantId);


	/**
	 *表单查询（根据节点ID查询当前表单）
	 */
	List<WbsNodeTableVO> selectByNodeTable(@Param("id") String id);

	/**
	 * 根据Ids查询元素
	 */
	List<String> selectByElementsTotal(@Param("ids") List<String> ids);

	/**
	 * 表单删除
	 */
	Integer removeTableById(String id);

	/**
	 * 表单元素
	 */
	List<WbsFormElement> selectFormElements(@Param("id") String id);

	/**
	 * 新增元素
	 */
	boolean addFormElement(WbsFormElement wbsFormElement);

}
