package com.jpsoft.shinestar.modules.base.dao;

import com.jpsoft.shinestar.modules.base.entity.CompanyInfo;
import com.jpsoft.shinestar.modules.common.dto.Sort;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

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

@Repository
public interface CompanyInfoDAO {
	int insert(CompanyInfo entity);

	int update(CompanyInfo entity);

	int exist(String id);

	CompanyInfo get(String id);

	int delete(String id);

	List<CompanyInfo> list();

	List<CompanyInfo> search(Map<String, Object> searchParams, List<Sort> sortList);

	List<CompanyInfo> findByCompanyCode(String code);

	long countByParentId(@Param("parentId") String parentId);

	long countByCompanyCode(String code, Long personId);

	int updateCode(String oldCode, int startIndex, String newCode);

    List<CompanyInfo> findByCompanyCode(String code, Long personId);

    List<CompanyInfo> findByParentId(@Param("parentId") String parentId);

	CompanyInfo findByName(String name);

	List<CompanyInfo> findByCompanyCodeAndType(@Param("code") String code, @Param("type") String type);


    List<CompanyInfo> findByRegionIdAndSceneId(@Param("regionId") String regionId, @Param("sceneId") String sceneId);

	List<CompanyInfo> findAllCompanyByCode(String code);

    List<CompanyInfo> findBySceneIdAndType(@Param("sceneId") String sceneId, @Param("type") String type);

	List<CompanyInfo> findByRelationCompanyId(String relationCompanyId);

	List<CompanyInfo> findByRegionIdAndSceneIdAndEnableRegister(@Param("regionId") String regionId, @Param("sceneId") String sceneId, @Param("enableRegister") boolean enableRegister);

    List<CompanyInfo> findByType(String type);

    List<CompanyInfo> findByUnitType(String unitType);

    List<CompanyInfo> findByHealthyReportTime(String healthyReportTime);

    CompanyInfo findByIdIgnoreDel(String companyId);

	List<CompanyInfo> findByOutscourcer(Boolean isOutsourcer);

	List<CompanyInfo> findByCompanyCodeAndOutscourcer(String code, Long personId,Boolean isOutsourcer);

	List<CompanyInfo> findByClassify(String classify);
}
