crud/main/resources/com/mapper/UserMapper.xml

27 lines
951 B
XML
Raw Normal View History

2023-05-24 15:00:58 +00:00
<?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.mapper.UserMapper">
<select id="findAll" resultType="com.domain.User">
select * from sys_user
</select>
<insert id="save">
insert into sys_user values(null,#{username},#{email},#{password},#{phoneNum})
</insert>
<insert id="saveUserRoleRel" >
<foreach collection="roleIds" item="roleId" separator=",">
insert into sys_user_role values(#{id},#{roleId})
</foreach>
</insert>
<delete id="delUserRoleRel">
delete from sys_user_role where userId=#{id}
</delete>
<delete id="del">
delete from sys_user where id=#{id}
</delete>
<select id="findByUsernameAndPassword" resultType="com.domain.User">
select * from sys_user where username=#{username} and password=#{password}
</select>
</mapper>