用户管理增删改查全部完成
This commit is contained in:
@@ -4,10 +4,48 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cxyxiaomo.epp.user.dao.UserDao">
|
||||
<insert id="addUser" parameterType="com.cxyxiaomo.epp.common.pojo.User">
|
||||
INSERT INTO user (username, password)
|
||||
VALUES (#{username}, #{password})
|
||||
INSERT INTO user (username, `password`, realname, id_number, phone_number, role_id, building_id, doorplate,
|
||||
permission, permission_time)
|
||||
VALUES (#{username}, #{password}, #{realname}, #{idNumber}, #{phoneNumber}, #{roleId}, #{buildingId},
|
||||
#{doorplate}, #{permission}, #{permissionTime})
|
||||
</insert>
|
||||
<select id="getUserById" parameterType="java.lang.Long" resultType="com.cxyxiaomo.epp.common.pojo.User">
|
||||
<update id="updateUser" parameterType="com.cxyxiaomo.epp.common.pojo.User">
|
||||
UPDATE user
|
||||
<set>
|
||||
<if test="username != null and username != ''">
|
||||
username = #{username},
|
||||
</if>
|
||||
<if test="password != null and password != ''">
|
||||
`password` = #{password},
|
||||
</if>
|
||||
<if test="realname != null and realname != ''">
|
||||
realname = #{realname},
|
||||
</if>
|
||||
<if test="idNumber != null and idNumber != ''">
|
||||
id_number = #{idNumber},
|
||||
</if>
|
||||
<if test="phoneNumber != null and phoneNumber != ''">
|
||||
phone_number = #{phoneNumber},
|
||||
</if>
|
||||
<if test="roleId != null">
|
||||
role_id = #{roleId},
|
||||
</if>
|
||||
<if test="buildingId != null and buildingId != ''">
|
||||
building_id = #{buildingId},
|
||||
</if>
|
||||
<if test="doorplate != null and doorplate != ''">
|
||||
doorplate = #{doorplate},
|
||||
</if>
|
||||
<if test="permission != null">
|
||||
permission = #{permission},
|
||||
</if>
|
||||
<if test="permissionTime != null">
|
||||
permission_time = #{permissionTime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
<select id="getUserById" parameterType="java.lang.Integer" resultType="com.cxyxiaomo.epp.common.pojo.User">
|
||||
SELECT *
|
||||
FROM user
|
||||
WHERE id = #{id}
|
||||
@@ -43,4 +81,10 @@
|
||||
AND doorplate LIKE concat('%',#{doorplate,jdbcType=VARCHAR},'%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<delete id="deleteUserById">
|
||||
DELETE
|
||||
FROM user
|
||||
WHERE id = #{userId}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
Reference in New Issue
Block a user