/*
 *      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.modules.system.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.system.entity.Bzdz;
import org.springblade.modules.system.entity.Dept;
import org.springblade.modules.system.excel.DeptExcel;
import org.springblade.modules.system.vo.*;

import java.util.List;
import java.util.Map;

/**
 * Mapper 接口
 *
 * @author Chill
 */
public interface DeptMapper extends BaseMapper<Dept> {

	/**
	 * 懒加载部门列表
	 *
	 * @param tenantId
	 * @param parentId
	 * @param param
	 * @return
	 */
	List<DeptVO> lazyList(String tenantId, Long parentId, Map<String, Object> param);

	/**
	 * 获取树形节点
	 *
	 * @param tenantId
	 * @return
	 */
	List<DeptVO> tree(@Param("tenantId") String tenantId, @Param("deptId") String deptId);

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

	/**
	 * 获取部门名
	 *
	 * @param ids
	 * @return
	 */
	List<String> getDeptNames(Long[] ids);


	String getDeptIdByDeptname(String deptName);

	List<DeptVO> getXfbm();

	List<DeptListVo> getDeptList(Long userId);

	List<FjVO> getfJList(String deptId);

	List<PcsVO> getPcsList(@Param("deptId") String deptId, @Param("fjId") Long fjId);

	List<SqVO> getSqList(@Param("deptId") String deptId, @Param("pcsId") Long pcsId);

    List<Dept> selectSq(String deptId);

	List<Dept> selectPcs(String deptId);

	Dept selectSsfjBm(String ssfjMc);

	Dept selectSspcsBm(@Param("sspcsMc") String sspcsMc, @Param("ssfjMc") String ssfjMc);

	Dept selectSssqBm(@Param("sssqMc") String sssqMc, @Param("parentId") Long parentId);

	Long getParentId(DeptExcel deptExcel);

    List<Dept> getJsByFj(String deptId);

	List<Dept> getJsByPcs(Long parentId);

	List<Dept> getJsBySq(Long parentId);

	List<Dept> getJsByFjDownPcs(String value);

	List<Dept> getJsByPcsDownPcs(String deptId);

	List<Dept> getJsBySqDownPcs(Long parentId);

	List<Dept> getJsByFjDownSq(String value);

	List<Dept> getJsByPcsDownSq(String value);

	Dept getJsBySqDownSq(String deptId);

	List<Dept> getJsBySj(String deptId);

    List<Dept> getQsga(String deptId);

	Dept getJxcspc(Long id);

	Dept getJxcsjc(Long id);

	IPage<DeptVOS> getQsyhcsjc(IPage<Object> page, DeptVOS deptVOS, String str, String strEnd);

	List<DeptVOS> getQsyhcsjcfj(String id, String str, String strEnd);
	@InterceptorIgnore(tenantLine = "true")
	Dept getDeptname(String id);

	Dept getName(String deptId);

	Dept getPublicName(String deptName);

	List<Dept> getJl();

	List<Bzdz> getLdByPcsbm(String deptId,String wzxxdz);
	Bzdz getLdInfoByLdbh(String xxzjbh,String deptId);
	void updateSSSqDmByxxzjbh(String xxzjbh,String sqId,String deptId);
	void updateSSSqDmIsNUll(String xxzjbh,String deptId);
	boolean updateSSSqDmIsNUllnew(String dzbm,String sssqBm);
	void deleteByLdId(String id);

    boolean updateId(Dept dept);

	Dept getDeptCategory(String deptId);

	List<ZdbVo> getShi();
	List<ZdbVo> getXqShiZddm(String shiZddm);
	List<ZdbVo> getJdByXqZddm(String xqZddm);
	List<ZdbVo> getSqByJdZddm(String jdZddm);

	void updateXqParent(String shiZddm);
	void updateJdParent(String xqzddm,String parents);
	void updateSqParent(String jdzddm,String parents);


	MjDeptVO getDeptDetail(String deptId);

	List<Dept> getSqByPcs(MjDeptVO mjDeptVO);

    int countDeptById(Long deptId);

    Long getDeptByQhAndCategory(String xzqh);

    List<ZdVOSS> getDept(String deptId);

	List<ZdldVo> getZdLdBySssqbm(String sssqBm);

	List<ZdVO> getBmByDept(String deptId);

	Bzdz getSssqBmBydzbm(String dzbm);

	boolean updatePlsc(String[] dzbms, String sssqBm);

	List<ZdVO> getDeptNameById(String deptId, Dept byId);

    Dept selectSjByFj(String deptId);

	Dept selectSjByPcs(String deptId);

	Dept selectSjBySqmj(String deptId);

	Dept getParentDept(String deptId);

    boolean getBmxg(Dept dept);

    Dept getFjPcsBySq(Long sssqBm);

	List<FjVOS> getfJLists(String deptId);

	List<PcsVOS> getPcsLists(@Param("deptId") String deptId, @Param("fjId") String fjId);

    List<FjVOS> getSfjZdb(String deptId);

	List<PcsVOS> getPcsZdb(String value);

	int getDeptById(Long id);

	List<ZdVO> getPcsByFjId(String deptId);

	boolean updateAncestors(String str, Long id, String ancestors);

	boolean deleteByPcsId(String str);

	@InterceptorIgnore(tenantLine = "true")
	Dept getDeptCategoryByAccount(String username);

    Dept getSjByAccount(String deptId);
}
