新增管理员的注册、登录、更改密码接口

This commit is contained in:
freeebird
2018-10-13 19:37:31 +08:00
parent a626863732
commit 132506deef
7 changed files with 167 additions and 32 deletions

View File

@@ -39,12 +39,8 @@
<if test="password != null">
password,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="adminId != null">
@@ -56,12 +52,8 @@
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
now(),
now()
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.Admin">
@@ -90,4 +82,25 @@
update_time = #{updateTime,jdbcType=TIMESTAMP}
where admin_id = #{adminId,jdbcType=INTEGER}
</update>
<select id="selectByUserName" parameterType="java.lang.String" resultMap="BaseResultMap">
select * from admin
where user_name = #{userName,jdbcType=VARCHAR}
</select>
<select id="selectByUserNameAndPassword" parameterType="cn.mafangui.hotel.entity.Admin">
select * from admin
where user_name = #{userName,jdbcType=VARCHAR} and password = #{password,jdbcType=VARCHAR}
</select>
<select id="findAll" resultMap="BaseResultMap">
select * from admin
</select>
<update id="updateByUserNameSelective" parameterType="cn.mafangui.hotel.entity.Admin">
update admin
<set>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
update_time = now(),
</set>
where user_name = #{userName,jdbcType=VARCHAR}
</update>
</mapper>

View File

@@ -64,12 +64,8 @@
<if test="idNumber != null">
id_number,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
@@ -96,12 +92,8 @@
<if test="idNumber != null">
#{idNumber,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
now(),
now(),
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.User">
@@ -186,12 +178,7 @@
<if test="idNumber != null">
id_number = #{idNumber,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
update_time = now(),
</set>
where user_name = #{userName,jdbcType=INTEGER}
</update>