You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.2 KiB
66 lines
2.2 KiB
<?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.dao.UserDAO">
|
|
|
|
<resultMap type="com.entity.User" id="BaseResultMap">
|
|
<id column="id" property="id" jdbcType="INTEGER"/>
|
|
<result column="username" property="username" jdbcType="VARCHAR"/>
|
|
<result column="userpassword" property="userpassword" jdbcType="VARCHAR"/>
|
|
<result column="realname" property="realname" jdbcType="VARCHAR"/>
|
|
<result column="sex" property="sex" jdbcType="VARCHAR"/>
|
|
<result column="tel" property="tel" jdbcType="VARCHAR"/>
|
|
<result column="delstatus" property="delstatus" jdbcType="VARCHAR"/>
|
|
<result column="usertype" property="usertype" jdbcType="VARCHAR"/>
|
|
</resultMap>
|
|
|
|
|
|
<select id="selectOne" resultMap="BaseResultMap">
|
|
select * from user where username = #{username} and userpassword = #{userpassword}
|
|
</select>
|
|
|
|
<select id="findById" resultType="User" parameterType="int">
|
|
select * from user where id=#{id}
|
|
</select>
|
|
|
|
<update id="update" parameterType="User" >
|
|
update user set realname=#{realname},sex=#{sex},tel=#{tel} where id=#{id}
|
|
</update>
|
|
|
|
<update id="updatepwd" >
|
|
update user set userpassword=#{1} where id=#{0}
|
|
</update>
|
|
|
|
<select id="selectAll" resultMap="BaseResultMap">
|
|
select * from user where usertype!='管理员' order by id desc
|
|
</select>
|
|
|
|
<insert id="add">
|
|
insert into user values(null,#{username},#{userpassword},#{realname},#{sex},#{tel},0,#{usertype})
|
|
</insert>
|
|
|
|
<select id="usernamecheck" parameterType="String" resultMap="BaseResultMap">
|
|
select * from user where username =#{username}
|
|
</select>
|
|
|
|
<select id="searchUser" parameterType="String" resultMap="BaseResultMap">
|
|
select * from user where usertype!='管理员' and (username like "%"#{0}"%" or realname like "%"#{0}"%") order by id desc
|
|
</select>
|
|
|
|
<update id="userEdit" parameterType="User">
|
|
update user set realname=#{realname},sex=#{sex},tel=#{tel} where id=#{id}
|
|
</update>
|
|
|
|
|
|
<delete id="deleteUser" parameterType="int">
|
|
delete from user where id=#{id}
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|
|
|