表中存在類型爲dateTime的字段,而且插入語句,不包括該字段時,會插入失敗

<insert id="insertLoanRecord" parameterType="loanRecord">
        INSERT INTO
        loan_record (
            serial_number,
            user_id,
            loan_id,
            bank_id,
            bank_province_id,
            apply_amount,
            apply_time,
            status,
            update_time,
            passed_time,
            repay_deadline,
            description
        )
        VALUES (
            #{serialNumber},
            #{userId},
            #{loanId},
            #{bankId},
            #{bankProvinceId},
            #{applyAmount},
            now(),
            #{status},
            now(),
            null,
            #{repayDeadline},
            #{desc}
        )
    </insert>

代碼中,以前沒有加passed_time這個字段,而後加進去以後,就會報passed_time字段不能默認爲空的sql異常,在此記下,以防以後遺忘。sql

相關文章
相關標籤/搜索