package com.gic.haoban.manage.service.dao.mapper;

import java.util.List;

import com.gic.haoban.manage.api.dto.DepartmentShortDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.xpath.operations.Bool;

import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.github.pagehelper.Page;
import retrofit2.http.PATCH;

public interface DepartmentMapper {
    int deleteByPrimaryKey(String departmentId);

    int insert(TabHaobanDepartment record);

    int insertSelective(TabHaobanDepartment record);

    TabHaobanDepartment selectByPrimaryKey(String departmentId);

    int updateByPrimaryKeySelective(TabHaobanDepartment record);

    int updateByPrimaryKey(TabHaobanDepartment record);

	List<TabHaobanDepartment> listByParentId(@Param("parentId")String parentId);

	List<TabHaobanDepartment> listDepartmentLikeName(@Param("departmentName")String departmentName);

	long selectMaxSort(@Param("parentDepartmentId")String parentDepartmentId);

	List<TabHaobanDepartment> selectByRelatedId(@Param("relatedId")String relatedId);

	List<TabHaobanDepartment> getByWxId(@Param("wxDepartmentId")String wxDepartmentId, @Param("wxEnterpriseId") String wxEnterpriseId);
	
	List<TabHaobanDepartment> listByDepartmentIds(@Param("departmentIds")List<String> departmentIds,@Param("storeFlag")Integer storeFlag);

	List<TabHaobanDepartment> listByRelatedIds(@Param("relatedIds")List<String> relatedIds);
	
	Page<TabHaobanDepartment> pageDepartmentByParams(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("keyword")String keyword, 
			@Param("storeFlag")Integer storeFlag, @Param("recycleFlag")Integer recycleFlag);
	
//	List<TabHaobanDepartment> listStoreByWxEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId);
	
	List<TabHaobanDepartment> getRootByEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId);
	
	Page<TabHaobanDepartment> pageFullStoreByWxEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId,@Param("search")String search,@Param("storeIds")List<String> storeIds,@Param("minCount")int minCount);
	
	Page<TabHaobanDepartment> pageFullStoreByWxEnterpriseId2(@Param("wxEnterpriseId")String wxEnterpriseId,@Param("search")String search,@Param("storeIds")List<String> storeIds,@Param("minCount")int minCount);

	Page<TabHaobanDepartment> pageByParentId(@Param("parentId")String parentId, @Param("keyword")String keyword);

	List<TabHaobanDepartment> listByChainId(@Param("chainId")String chainId, @Param("wxEnterpriseId")String wxEnterpriseId);

	Integer departmentRecycleCount(@Param("wxEnterpriseId")String wxEnterpriseId);

	int countSyncDepartmentByEnterpriseId(@Param("enterpriseId")String enterpriseId);

	int countByDepartment(@Param("departmentId")String departmentId);


	Integer totalStoreCountByEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId);

	public int cleanDepartment(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("dIds") List<String> wxDeIds);

	public List<TabHaobanDepartment> listDepartmentByWxDepartIds(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("dIds") List<String> wxDeIds);

	/**
	 * 查询所有部门
	 * @param wxEnterpriseId
	 * @return
	 */
	public List<TabHaobanDepartment> listAllDepartment(String wxEnterpriseId);

	/**
	 * 查询所有部门
	 * @param wxEnterpriseId
	 * @return
	 */
	public List<TabHaobanDepartment> searchDepartment(String search,String wxEnterpriseId);


}