package com.cool.store.mapper;

import com.cool.store.entity.HyInspectionSettingMappingDO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author zhangchenbiao
 * @date 2023-07-18 04:28
 */
public interface HyInspectionSettingMappingMapper {
    /**
     *
     * 默认插入方法，只会给有值的字段赋值
	 * 会对传进来的字段做判空处理，如果字段为空，则使用数据库默认字段或者null
     * dateTime:2023-07-18 04:28
     */
    int batchInsertSelective(@Param("insertList") List<HyInspectionSettingMappingDO> insertList);

    /**
     *
     * 默认更新方法，根据主键更新，不会把null值更新到数据库，避免覆盖之前有值的
     * dateTime:2023-07-18 04:28
     */
    int updateByPrimaryKeySelective(HyInspectionSettingMappingDO record);

    /**
     * 获取区域ids
     * @param inspectionSettingId
     * @return
     */
    List<Long> getOpenAreaMappingIds(@Param("inspectionSettingId") Long inspectionSettingId);

    /**
     * 删除不在的城市
     * @param inspectionSettingId
     * @param openAreaMappingIds
     * @return
     */
    Integer deleteNotInOpenAreaMappingIds(@Param("inspectionSettingId") Long inspectionSettingId, @Param("openAreaMappingIds") List<Long> openAreaMappingIds);

    /**
     * 删除
     * @param inspectionSettingId
     * @return
     */
    Integer deleteInspectionSettingMapping(@Param("inspectionSettingId") Long inspectionSettingId);

    /**
     *
     * @param inspectionSettingId
     * @param openAreaMappingIds
     * @return
     */
    List<HyInspectionSettingMappingDO> getConflictInspectionSetting(@Param("inspectionSettingId") Long inspectionSettingId, @Param("openAreaMappingIds") List<Long> openAreaMappingIds);

    /**
     * 删除
     * @param excludeInspectionSettingId
     * @param openAreaMappingIds
     * @return
     */
    Integer deleteInOpenAreaMappingIds(@Param("excludeInspectionSettingId") Long excludeInspectionSettingId, @Param("openAreaMappingIds") List<Long> openAreaMappingIds);
}