package com.fs.statis.mapper;

import com.fs.common.annotation.DataSource;
import com.fs.common.enums.DataSourceType;
import com.fs.statis.domain.FsStatisTempParam;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface FsStatisTempParamMapper {

    /**
     * Inserts a new record.
     *
     * @param fsStatisTempParam The record to insert.
     * @return The number of rows affected.
     */
    int insert(FsStatisTempParam fsStatisTempParam);

    void batchSave(List<FsStatisTempParam> list);

    @DataSource(DataSourceType.SOP)
    void batchSaveToSop(List<FsStatisTempParam> list);

    /**
     * Inserts a new record, only if a field is not null.
     * (This would typically be implemented in XML with <if> tags)
     *
     * @param fsStatisTempParam The record to insert.
     * @return The number of rows affected.
     */
    int insertSelective(FsStatisTempParam fsStatisTempParam);

    /**
     * Selects a record by its primary key.
     *
     * @param id The primary key.
     * @return The found record, or null if not found.
     */
    FsStatisTempParam selectById(Integer id);

    /**
     * Updates an existing record by its primary key.
     * All fields will be updated.
     *
     * @param fsStatisTempParam The record with updated values.
     * @return The number of rows affected.
     */
    int updateById(FsStatisTempParam fsStatisTempParam);

    /**
     * Updates an existing record by its primary key.
     * Only non-null fields in fsStatisTempParam will be updated.
     * (This would typically be implemented in XML with <if> tags in the SET clause)
     *
     * @param fsStatisTempParam The record with updated values.
     * @return The number of rows affected.
     */
    int updateByIdSelective(FsStatisTempParam fsStatisTempParam);

    /**
     * Deletes a record by its primary key.
     *
     * @param id The primary key.
     * @return The number of rows affected.
     */
    int deleteById(Integer id);

    /**
     * Selects all records from the table.
     *
     * @return A list of all records.
     */
    List<FsStatisTempParam> selectAll();

    @Delete("truncate table fs_statis_temp_param")
    void clear();

    @DataSource(DataSourceType.SOP)
    @Delete("truncate table fs_statis_temp_param")
    void clearSop();

}
