package com.goafanti.common.dao;

import com.goafanti.admin.bo.AdminCustomerBo;
import com.goafanti.admin.bo.AdminListBo;
import com.goafanti.admin.bo.DepCountBo;
import com.goafanti.common.model.Department;
import com.goafanti.organization.bo.DepOut;
import com.goafanti.organization.bo.InputDep;
import com.goafanti.organization.bo.OrganizationListOut;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author Administrator
* @description 针对表【department】的数据库操作Mapper
* @createDate 2024-06-14 09:40:31
* @Entity com.goafanti.common.model.Department
*/
public interface DepartmentMapper {
    int deleteByPrimaryKey(String id);

    int insert(Department record);

    int insertSelective(Department record);

    Department selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(Department record);

    int updateByPrimaryKey(Department record);


    /**
     *
     * @param hideSign 0不显示 1显示
     * @param lvl 层级
     * @param id 上级编号
     * @return
     */
    List<DepOut> selectSuperId(@Param("hideSign")Integer hideSign, @Param("lvl")Integer lvl, @Param("id")String id);
    /**
     * 根据组织名称查组织编号
     */
    String selectDepNoByName(String name);

    /**
     * 根据上级组织查组织编号
     */
    String  selectDepNo(String id);
    /**


     /**
     * 查询相同上级下编号数量
     */
    int selectDepNoCount(String superId);
    /**
     * 模糊查询负责人名称
     */
    List<AdminListBo> selectName(String name);

    OrganizationListOut selectAllById(String id);

    int deleteById(String id);

    String selectAdminNameById(String name);

    String selectIdByDepNo(String depNo);
    /**
     * 查询有相同上级组织的信息
     * @param superId
     * @return
     */
    List<OrganizationListOut> selectIDNBySuperId(String superId);

    int updateByNumber(OrganizationListOut olo);

    int selectCountBySuperId(String superId);

    String selectIdByName(String name);

    String selectNameById(String id);

    String selectDepNoById(String id);

    int selectUserById(String id);

    /**
     * 查询下级集合
     * @param superIds
     * @return
     */
    List<String> selectSubDeps(@Param("superIds")String superIds);
    List<Department> selectSubDepsList(@Param("superIds")String superIds);

    List<DepCountBo> selectBysuperId(String id);

    List<DepCountBo> selectBysuperName(String name);
    /**
     * 查询当前集合
     * @return
     */
    List<String> selectCurrentDeps(@Param("aid")String aid);

    /**
     * 查询所有部门
     * @return
     */
    List<Department> selectAllDeps();
    /**
     * 查询最大编号
     * @param abbreviation
     * @return
     */
    String getMaxAbbreviation(String abbreviation);

    List<AdminCustomerBo> getDepAll(@Param("depId")String depId,
                                    @Param("adminName")String adminName, @Param("startTime")String startTime, @Param("endTime")String endTime);


    List<AdminCustomerBo> AlldepCount(@Param("depIds")List<Department> depIds ,@Param("startTime")String startTime, @Param("endTime")String endTime);

    Department selectByDepNo(String superId);

    void updateDepFinance(@Param("aid") String aid, @Param("transferId") String transferId);


    void updateOrderDepFinanceNotExamine(@Param("newFinanceId") String newFinanceId, @Param("useFinanceId") String useFinanceId, @Param("depId") String depId);

    void updateExpenseFinanceNotExamine(@Param("newFinanceId") String newFinanceId, @Param("useFinanceId") String useFinanceId);

    void updateNull(InputDep in);

    int selectByApproval(String aid);
}
