Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
MybatisTraning
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
training
MybatisTraning
Commits
ea38d2a5
Commit
ea38d2a5
authored
Jan 02, 2020
by
Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
27fc30a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
0 deletions
+69
-0
IUserDao.xml
张志墙_Mybatis2/src/main/resource/mapper/IUserDao.xml
+69
-0
No files found.
张志墙_Mybatis2/src/main/resource/mapper/IUserDao.xml
0 → 100644
View file @
ea38d2a5
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.ces.mybatis.dao.IUserDao"
>
<resultMap
id=
"BaseResultMap"
type=
"com.ces.mybatis.model.User"
>
<id
column=
"user_id"
property=
"userId"
/>
<result
column=
"user_name"
property=
"userName"
/>
<result
column=
"password"
property=
"password"
/>
<result
column=
"context"
property=
"context"
typeHandler=
"com.ces.mybatis.typeHandler.ContentTypeHandler"
/>
</resultMap>
<insert
id=
"insert"
useGeneratedKeys=
"true"
keyProperty=
"userId"
keyColumn=
"user_id"
parameterType=
"com.ces.mybatis.model.User"
>
insert into t_sys_user(user_id,user_name,password,context) values(#{userId},#{userName},#{password},#{context})
</insert>
<insert
id=
"insertOrUpdateByBatch"
keyProperty=
"userId"
useGeneratedKeys=
"true"
keyColumn=
"user_id"
>
insert into t_sys_user (user_id,user_name,password,context)
VALUES
<foreach
item=
"user"
index=
"index"
collection =
"list"
separator =
"),("
open=
"("
close=
")"
>
user.userId,user.userName,user.password,user.context
</foreach>
ON DUPLICATE KEY UPDATE
user_name = VALUES(user_name)
password = VALUES(password)
context = VALUES(context)
</insert>
<update
id=
"update"
parameterType=
"com.ces.mybatis.model.User"
>
update t_sys_user
<set>
<if
test=
"userName != null"
>
user_name=#{userName},
</if>
<if
test=
"password != null"
>
password=#{password},
</if>
<if
test=
"context != null"
>
context=#{context},
</if>
</set>
where user_id=#{userId}
</update>
<delete
id=
"delete"
>
delete from t_sys_user where user_id=#{userId}
</delete>
<select
id=
"getAll"
resultType=
"com.ces.mybatis.model.User"
>
select user_id,user_name,password,context from t_sys_user order by user_id desc
</select>
<select
id=
"find"
resultType=
"com.ces.mybatis.model.User"
>
select user_id,user_name,password,context from t_sys_user where user_id = #{userId}
</select>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment