IBAtisHelper 源代码放出,需要的下载吧
不知道 IbatisHelper 是什么东东的请先参看这里
http://www.cnblogs.com/suyuan/archive/2008/12/26/1362745.html
自从IbatisHelper发布以来,很多朋友给我邮件,需要源代码,以前都是通过email发个需要的人,但是随着收到的email增多,感觉一个个分发好麻烦!
索性直接在这里发布了,需要的自己下载吧!
自己认为自己的代码写的很生硬,如果哪个朋友有精力完善该功能,就再接再厉,目前这个能满足我们的需求就懒得做了.如果你们完善了 就麻烦回馈给我一份代码
废话不多说了 直接提供下载地址吧
/Files/suyuan/IbatisHelper_src.rar
如果对您有帮助 麻烦捧个人场 呵呵~~~~~~~
另外贴一个比较比较完整的sqlmap模板,目前我们生成就是用这个模板,具体应用自己改吧
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://java.plugbase.org/dtd/sql-map-2.dtd">
<sqlMap namespace="${table}">
<typeAlias alias="${table}" type="${package}.${table}"/>
<typeAlias alias="SQLPager" type="org.plugbase.sql.SQLPager"/>
<resultMap id="${table}resultMap" class="${table}">
#foreach($item in $list)
<result property="${item.name.ToLower()}" column="${item.name.ToLower()}"/>
#end
</resultMap>
<select id="Count${table}" resultClass="int">
select count(*) from ${table}
</select>
<select id="Select${table}ById" parameterClass="int" resultMap="${table}resultMap">
select * from ${table} where id=#value#
</select>
<insert id="Insert${table}" parameterClass = "${table}">
insert into ${table}
(
#foreach($item in $list)
#if(${item.name.ToLower()}!="id")
#if($velocityCount==$list.Count())
${item.name.ToLower()}
#else
${item.name.ToLower()},
#end
#end
#end
)
values
(
#foreach($item in $list)
#if(${item.name.ToLower()}!="id")
#if($velocityCount==$list.Count())
#${item.name.ToLower()}#
#else
#${item.name.ToLower()}#,
#end
#end
#end
)
</insert>
<update id="Update${table}" parameterClass = "${table}">
update ${table}
#foreach($item in $list)
#if($velocityCount==1)
set
#end
#if(${item.name.ToLower()}!="id")
#if($velocityCount==$list.Count())
${item.name.ToLower()}=#${item.name.ToLower()}#
#else
${item.name.ToLower()}=#${item.name.ToLower()}#,
#end
#end
#end
where id=#value#
</update>
<delete id="Delete${table}ById" parameterClass="int">
delete from ${table} where id=#value#
</delete>
</sqlMap>
<!DOCTYPE sqlMap
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://java.plugbase.org/dtd/sql-map-2.dtd">
<sqlMap namespace="${table}">
<typeAlias alias="${table}" type="${package}.${table}"/>
<typeAlias alias="SQLPager" type="org.plugbase.sql.SQLPager"/>
<resultMap id="${table}resultMap" class="${table}">
#foreach($item in $list)
<result property="${item.name.ToLower()}" column="${item.name.ToLower()}"/>
#end
</resultMap>
<select id="Count${table}" resultClass="int">
select count(*) from ${table}
</select>
<select id="Select${table}ById" parameterClass="int" resultMap="${table}resultMap">
select * from ${table} where id=#value#
</select>
<insert id="Insert${table}" parameterClass = "${table}">
insert into ${table}
(
#foreach($item in $list)
#if(${item.name.ToLower()}!="id")
#if($velocityCount==$list.Count())
${item.name.ToLower()}
#else
${item.name.ToLower()},
#end
#end
#end
)
values
(
#foreach($item in $list)
#if(${item.name.ToLower()}!="id")
#if($velocityCount==$list.Count())
#${item.name.ToLower()}#
#else
#${item.name.ToLower()}#,
#end
#end
#end
)
</insert>
<update id="Update${table}" parameterClass = "${table}">
update ${table}
#foreach($item in $list)
#if($velocityCount==1)
set
#end
#if(${item.name.ToLower()}!="id")
#if($velocityCount==$list.Count())
${item.name.ToLower()}=#${item.name.ToLower()}#
#else
${item.name.ToLower()}=#${item.name.ToLower()}#,
#end
#end
#end
where id=#value#
</update>
<delete id="Delete${table}ById" parameterClass="int">
delete from ${table} where id=#value#
</delete>
</sqlMap>