日期:2014-05-16 浏览次数:20340 次
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <sqlMap> <sql id="selectUserWhere"> <dynamic prepend="where"> ...这里省略部分 <isPropertyAvailable prepend="or" property="user_Or_NotNull_State"><![CDATA[STATE_C is not null]]> </isPropertyAvailable> </dynamic> </sql> <delete id="deleteUser" parameterClass="String"><![CDATA[ Delete From demo.user_t Where USER_ID=#userId# ]]> </delete> <select id="getUserRolesByUser" parameterClass="String" resultMap="userRoleResult"><![CDATA[ Select USER_ID, ROLE_ID from demo.user_role_t Where USER_ID=#userId# ]]> </select> <select id="doCountUser" parameterClass="java.util.Map" resultClass="int"><![CDATA[ Select count(*) From demo.user_t $Where$ $condition$]]> </select> <update id="updateUser" parameterClass="user"><![CDATA[ Update demo.user_t SET USER_ID=#userId# , USER_NAME=#userName# , PASSWORD=#password# , VALID_FROM=#validFrom# , VALID_TO=#validTo# , TITLE=#title# , DESCRIPTION=#description# , DOMAIN_C=#domain# , GROUP_C=#group# , ORDER_C=#order# , STATE_C=#state# Where USER_ID=#userId# ]]> </update> <insert id="insertUser" parameterClass="user"><![CDATA[ Insert Into demo.user_t(USER_ID , USER_NAME , PASSWORD , VALID_FROM , VALID_TO , TITLE , DESCRIPTION , DOMAIN_C , GROUP_C , ORDER_C , STATE_C) Values(#userId# , #userName# , #password# , #validFrom# , #validTo# , #title# , #description# , #domain# , #group# , #order# , #state#) ]]> </insert> <select id="doSelectUser" parameterClass="java.util.Map" resultMap="userResult"><![CDATA[ Select USER_ID, USER_NAME, PASSWORD, VALID_FROM, VALID_TO, TITLE, DESCRIPTION, DOMAIN_C, GROUP_C, ORDER_C, STATE_C from demo.user_t $Where$ $condition$]]> </select> <select id="selectUser" parameterClass="java.util.Map" resultMap="userResult"><![CDATA[ Select USER_ID, USER_NAME, PASSWORD, VALID_FROM, VALID_TO, TITLE, DESCRIPTION, DOMAIN_C, GROUP_C, ORDER_C, STATE_C from demo.user_t ]]> <include refid="selectUserWhere"/> </select> <select id="selectUserByID" parameterClass="String" resultMap="userResult"><![CDATA[ Select USER_ID, USER_NAME, PASSWORD, VALID_FROM, VALID_TO, TITLE, DESCRIPTION, DOMAIN_C, GROUP_C, ORDER_C, STATE_C from demo.user_t Where USER_ID=#userId# ]]> </select> <select id="doDeleteUser" parameterClass="java.util.Map"><![CDATA[ Delete From demo.user_t $Where$ $condition$]]> </select> <delete id="deleteUserByID" parameterClass="String"><![CDATA[ Delete From demo.user_t ]]> <include refid="selectUserWhere"/> </delete> </sqlMap>