<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="JcContent">
<resultMap id="RM.JcContent" class="com.ty.front.rcenter.resources.domain.JcContent">
<result property="contentId" column="content_id"/>
<result property="channelId" column="channel_id"/>
<result property="userId" column="user_id"/>
<result property="typeId" column="type_id"/>
<result property="siteId" column="site_id"/>
<result property="sortDate" column="sort_date"/>
<result property="topLevel" column="top_level"/>
<result property="hasTitleImg" column="has_title_img"/>
<result property="isRecommend" column="is_recommend"/>
<result property="status" column="status"/>
<result property="viewsDay" column="views_day"/>
<result property="commentsDay" column="comments_day"/>
<result property="downloadsDay" column="downloads_day"/>
<result property="upsDay" column="ups_day"/>
</resultMap>
<sql id="JcContent.columns">
<![CDATA[
content_id, channel_id, user_id, type_id, site_id, sort_date, top_level, has_title_img,
is_recommend, status, views_day, comments_day, downloads_day, ups_day
]]>
</sql>
<insert id="JcContent.insert">
<![CDATA[
INSERT INTO jc_content (
content_id, channel_id, user_id, type_id, site_id, sort_date, top_level, has_title_img,
is_recommend, status, views_day, comments_day, downloads_day, ups_day
) VALUES (
#contentId#,#channelId#, #userId#, #typeId#, #siteId#, #sortDate#, #topLevel#, #hasTitleImg#,
#isRecommend#, #status#, #viewsDay#, #commentsDay#, #downloadsDay#, #upsDay#
)
]]>
<selectKey resultClass="int" keyProperty="contentId">
<![CDATA[select last_insert_id() as id]]>
</selectKey>
</insert>
</sqlMap>
@Override
public int saveContent(JcContent jc) {
return (Integer) this.getSqlMapClientTemplate().insert("insert", jc);
}
数据库为mysql,自增长id号,执行结果已经返回了id,但数据库记录没了
本人刚接触ibtias,菜鸟一枚,求大神指教