package com.fs.statis.mapper;

import com.fs.statis.domain.FsStatisQwTempParam;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Mapper interface for operations on the fs_statis_qw_temp_param table.
 * The method names should correspond to the 'id' attributes in FsStatisQwTempParamMapper.xml.
 */
@Mapper // This annotation is commonly used with Spring Boot to mark it as a MyBatis mapper
public interface FsStatisQwTempParamMapper {

    /**
     * Selects a record by its primary key.
     * Corresponds to the SQL statement with id="selectByPrimaryKey" in the XML.
     *
     * @param id The primary key.
     * @return The FsStatisQwTempParam object, or null if not found.
     */
    FsStatisQwTempParam selectByPrimaryKey(Integer id);

    /**
     * Deletes a record by its primary key.
     * Corresponds to the SQL statement with id="deleteByPrimaryKey" in the XML.
     *
     * @param id The primary key.
     * @return The number of rows affected.
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * Inserts a new record.
     * Corresponds to the SQL statement with id="insert" in the XML.
     * The 'id' property of the 'record' parameter will be populated with the generated ID
     * if 'useGeneratedKeys="true"' is set in the XML.
     *
     * @param record The FsStatisQwTempParam object to insert.
     * @return The number of rows affected.
     */
    int insert(FsStatisQwTempParam record);

    /**
     * Inserts a new record, only including non-null fields.
     * Corresponds to the SQL statement with id="insertSelective" in the XML.
     * The 'id' property of the 'record' parameter will be populated with the generated ID
     * if 'useGeneratedKeys="true"' is set in the XML.
     *
     * @param record The FsStatisQwTempParam object to insert.
     * @return The number of rows affected.
     */
    int insertSelective(FsStatisQwTempParam record);

    /**
     * Updates an existing record by its primary key, only including non-null fields in the update.
     * Corresponds to the SQL statement with id="updateByPrimaryKeySelective" in the XML.
     *
     * @param record The FsStatisQwTempParam object containing the fields to update and the primary key.
     * @return The number of rows affected.
     */
    int updateByPrimaryKeySelective(FsStatisQwTempParam record);

    /**
     * Updates an existing record by its primary key, updating all fields.
     * Corresponds to the SQL statement with id="updateByPrimaryKey" in the XML.
     *
     * @param record The FsStatisQwTempParam object containing all fields to update and the primary key.
     * @return The number of rows affected.
     */
    int updateByPrimaryKey(FsStatisQwTempParam record);

    /**
     * Selects all records from the table.
     * Corresponds to the SQL statement with id="selectAll" in the XML.
     *
     * @return A list of all FsStatisQwTempParam objects.
     */
    List<FsStatisQwTempParam> selectAll();

    /**
     * Selects records based on the provided criteria.
     * Corresponds to the SQL statement with id="selectByParams" in the XML.
     * The 'criteria' object's properties are used in the WHERE clause.
     *
     * @param criteria An FsStatisQwTempParam object containing the query parameters.
     * @return A list of FsStatisQwTempParam objects matching the criteria.
     */
    List<FsStatisQwTempParam> selectByParams(FsStatisQwTempParam criteria);

    // --- You can add more custom query methods here ---
    // For example, if you wanted to find records by a specific company_user_id and this_date:
    /*
    List<FsStatisQwTempParam> findByCompanyUserAndDate(
            @Param("companyUserId") Long companyUserId,
            @Param("thisDate") String thisDate
    );
    */
    // If you add such a method, you'd also need to add a corresponding <select>
    // statement in your FsStatisQwTempParamMapper.xml, like:
    /*
    <select id="findByCompanyUserAndDate" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM fs_statis_qw_temp_param
        WHERE company_user_id = #{companyUserId,jdbcType=BIGINT}
          AND this_date = #{thisDate,jdbcType=VARCHAR}
    </select>
    */

    int insertList(@Param("list") List<FsStatisQwTempParam> recordList);

    @Delete("truncate table fs_statis_qw_temp_param")
    void clear();
}
