Repository navigation
Expand file tree
/
Copy pathAdmin.xml
More file actions
56 lines (46 loc) · 2.02 KB
/
Copy pathAdmin.xml
File metadata and controls
56 lines (46 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?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.example.springboot.mapper.AdminMapper">
<insert id="save">
insert into admin(username, password, phone, email)
values(#{username}, #{password}, #{phone}, #{email})
</insert>
<update id="updateById">
update admin set username = #{username}, phone = #{phone}, email = #{email}, updatetime = #{updatetime}, status = #{status} where id = #{id}
</update>
<update id="updatePassword">
update admin set password = #{newPass} where username = #{username} and password = #{password}
</update>
<delete id="deleteById">
delete from admin where id = #{id}
</delete>
<select id="list" resultType="com.example.springboot.entity.Admin">
select * from admin order by id desc
</select>
<select id="listByCondition" resultType="com.example.springboot.entity.Admin">
select * from admin
<where>
<if test="username != null and username != ''">
username like concat('%', #{ username }, '%')
</if>
<if test="phone != null and phone != ''">
and phone like concat('%', #{ phone }, '%')
</if>
<if test="email != null and email != ''">
and email like concat('%', #{ email }, '%')
</if>
</where>
order by id desc
</select>
<select id="getById" resultType="com.example.springboot.entity.Admin">
select * from admin where id = #{id}
</select>
<select id="getByUsernameAndPassword" resultType="com.example.springboot.entity.Admin">
select * from admin where username = #{username} and password = #{password}
</select>
<select id="getByUsername" resultType="com.example.springboot.entity.Admin">
select * from admin where username = #{username}
</select>
</mapper>