<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.generator.mapper.front.AiUsageLedgerMapper">

    <insert id="insertAiUsageLedger" parameterType="AiUsageLedger" useGeneratedKeys="true" keyProperty="ledgerId">
        insert into front_ai_usage_ledger
        (task_id, generation_id, project_id, user_id, generate_type, provider, model, input_tokens,
         output_tokens, total_tokens, cost_cents, success, error_message, create_time)
        values
        (#{taskId}, #{generationId}, #{projectId}, #{userId}, #{generateType}, #{provider}, #{model}, #{inputTokens},
         #{outputTokens}, #{totalTokens}, #{costCents}, #{success}, #{errorMessage}, sysdate())
    </insert>
</mapper>
