package com.zcloud.basic.info.persistence.repository;

import com.alibaba.cola.dto.PageResponse;
import com.jjb.saas.framework.repository.repo.BaseRepository;
import com.zcloud.basic.info.domain.model.DepartmentE;
import com.zcloud.basic.info.persistence.dataobject.CorpInfoDO;
import com.zcloud.basic.info.persistence.dataobject.DepartmentDO;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;

/**
 * web-infrastructure
 *
 * @Author zhaokai
 * @Date 2025-10-29 16:03:20
 */
public interface DepartmentRepository extends BaseRepository<DepartmentDO> {
    PageResponse<DepartmentDO> listPage(Map<String, Object> parmas);

    List<DepartmentDO> listTree(Map<String, Object> parmas);

    List<DepartmentDO> listByParams(Map<String, Object> departParmas);

    Long countByParams(Map<String, Object> parmas);

    Long getCountByCorpInfoId(Long id);

    Long addCorpDepartment(DepartmentE departmentE);
    List<DepartmentDO> listByCorpInfoId(Long corpInfoId);

    void updateInfoById(DepartmentDO departmentDO);


    List<DepartmentDO> listAllTree();

    boolean existsByName(@NotNull(message = "父级id") Long parentId, @NotEmpty(message = "名称不能为空") String name, Long id);

    List<DepartmentDO> listAllTreeByCorpType(Map<String, Object> parmas);

    void deleteByCorpInfoId(Long corpInfoId);
}

