Ibatis2.5对应的xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd" >
<sqlMap namespace="importantGroup">
<!-- 根据组名和空间代码进行添加操作,要关联灯光视图 -->
<insert id="insertImportantGroups" parameterClass="java.util.HashMap" >
insert into l_important_group (id,name,gid,equpment_id)
select l_important_group_SEQ.Nextval,#name#,gid,id from v_light_infos where gid in
<iterate property="gidList" open="(" conjunction="," close=")">
     #gidList[]# 
</iterate>
and gid not in(select gid from L_IMPORTANT_GROUP where name =#name#)
</insert>
<!-- 根据组名进行删除 -->
<delete parameterClass="java.lang.String" id="delectGroupbyName">
<![CDATA[
delete from L_IMPORTANT_GROUP IG where 1=2
]]>
<dynamic>
<isNotNull prepend="OR">
NAME=#groupName#
</isNotNull>
</dynamic>
</delete>

<!-- 根据组名name和空间代码gids进行删除 -->
<delete id="deleteGroupByGids" parameterClass="java.util.HashMap">
delete from L_IMPORTANT_GROUP where name=#name#
and gid in 
<iterate property="gidList" open="(" conjunction="," close=")">
#gidList[]#
</iterate>
</delete>
<!-- 改变分组名称 -->
<update id="updateGroupName" parameterClass="java.util.HashMap">
update (select * from L_IMPORTANT_GROUP where name=#oldGroupName#) LIG SET LIG.NAME=#newGroupName#
</update>
<select id="searchGroupNames" resultClass="java.lang.String">
select name from L_IMPORTANT_GROUP ig  where grouptype='0' group by name
</select>
<!-- 根据分组名称查询数量 -->
<select id="NumberByGroupName" parameterClass="java.lang.String" resultClass="java.lang.String">
select count(*) from L_IMPORTANT_GROUP where name=#groupName#
</select>
<!-- 根据分组名称查询所有灯光gid -->
<select id="gidsByGroupName" parameterClass="java.lang.String" resultClass="java.lang.String">
select gid from L_IMPORTANT_GROUP where name=#groupName#
</select>
</sqlMap>
























猜你喜欢

转载自godagodago.iteye.com/blog/2226319