This question I let me engage in the most of the day, really irritating, words do not say, directly on the code
<select id= "*" resultmap= "Blog" parametertype= "Integer" >
SELECT * (SELECT COUNT (*) from table_name C where c.bbs_id=t.id) as Plcount,//subquery plcount to sort virtual fields
From table_name t <! [cdata[where RowNum <=10]]> order BY t.pvcount Desc//mybatis not identified < or; [cdata[where rownum <=10]]> can
</select>
Writing the INSERT statement
<insert id= "*" parametertype= "Blog" >
<selectkey order= "Before" resulttype= "Java.lang.Long" keyproperty= "id" >
Select Zdcj_blog_seq. Nextval from dual//sequence, when added in the background, the constructor does not have a sequence ID
</selectKey>
INSERT INTO table_name (Id,bbs_title,bbs_center,bbs_date,author,ac,bankuai,pvcount,create_date,create_user, Popularity) VALUES (#{id,jdbctype=numeric},# {bbstitle,jdbctype=varchar},#{bbscenter,jdbctype=varchar},#{bbsdate, jdbctype=varchar},#{author,jdbctype=varchar},#{ac,jdbctype=varchar},# {Bankuai,jdbctype=varchar},#{pvcou Nt,jdbctype=varchar},#{createdate,jdbctype=varchar},#{createuserid,jdbctype=numeric},#{popularity,jdbctype= VARCHAR})
</insert>
This is my own thought out of the table connection query, the effect can be achieved, may not be too professional, please understand
<select id= "*" resulttype= "Blog" parametertype= "Integer" >
SELECT * from Table_name1 u,table_name2 t where u.blog_id = T.id and T.create_user=#{createuserid}
</select>
Writing various statements in Oracle is handy, but in the Mybatis.xml file?