本文主要是介绍在spring中配置ibatis 03_xml配置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
UserEntity.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="user"><resultMap id="result" class="com.iss.beans.UserBean"><result property="userId" column="user_id"/><result property="userName" column="user_name"/><result property="password" column="user_password"/><result property="age" column="age"/><result property="birthday" column="birthday"/><result property="registTime" column="regist_time"/></resultMap><resultMap id="result1" class="com.iss.beans.UserBean"><result property="userId" column="user_id"/><result property="userName" column="user_name"/></resultMap><!-- 添加用户 --><insert id="insertUser"><![CDATA[INSERT INTO t_user(user_id,user_name,user_password,age,birthday,regist_time) VALUES(#userId#,#userName#,#password#,#age#,#birthday#,#registTime#)]]></insert><!-- 查看特定用户 --><select id="queryUserById" parameterClass="long" resultMap="result"><![CDATA[SELECT * FROM t_user WHERE user_id=#value#]]></select><select id="userCount" resultClass="int"><![CDATA[ SELECT count(user_id) FROM t_user ]]> </select><update id="updateUser">update t_user set user_name=#userName#,user_password=#password#,age=#age# where user_id=#userId#</update><delete id="deleteUser">delete from t_user where user_id=#userId#</delete><parameterMap class="java.util.HashMap" id="loginMap"><parameter property="userName" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN"/><parameter property="password" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN"/><parameter property="FLAG" javaType="java.lang.Integer" jdbcType="INTEGER" mode="OUT"/></parameterMap><!-- 调用存储过程 --><procedure id="loginProcedure" parameterMap="loginMap" resultClass="java.lang.Integer">{call proc_login(?,?,?)} </procedure><select id="queryAllUser1" resultMap="result1">select user_id,user_name from t_user</select></sqlMap>
这篇关于在spring中配置ibatis 03_xml配置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!