<insertid="addBasicdataInfo"parameterType="Basicdata">
insert into basicdata(sid,first_name,last_name,email,gender,age,member,chinese_score,math_score,english_score,political_score,total_score,ip_address,address,contact_phone,join_date)
values(#{sid},#{firstName},#{lastName},#{eMail},#{gender},#{age},#{member},#{chineseScore},#{mathScore},#{englishScore},#{politicalScore},#{totalScore},#{ipAddress},#{address},#{contactPhone},#{joinDate,jdbcType=DATE})
</insert>
调用测试文件节选
@TestpublicvoidtestaddBasicdataInfo(){int num = sqlSession.insert("addBasicdataInfo",newBasicdata(21002022,"aaa11","bbb11","ssss@abc.com",(char)1,28,Boolean.FALSE,80.5F,89.00F,18.5F,25.00F,0.00F,"11.11.11.11","aabbcc","13311112222",Date.valueOf("2021-2-5")));System.out.println(num);}
划重点:
布尔型数据输入格式:Boolean.FALSE 或 Boolean.TURE 只有两种选择
字符型数据输入格式:(char)1
日期型数据输入格式:Date.valueOf("yyyy-mm-dd"), XML 中参数渗格式要有限定:#{joinDate,jdbcType=DATE}