Commit 5a4afdd8 authored by chenying's avatar chenying

3.19修改用户和修改密码接口

parent aef092bd
This diff is collapsed.
......@@ -5,6 +5,14 @@ public class UpdatePasswordVo {
private String password;
public UpdatePasswordVo() {
}
public UpdatePasswordVo(String userNumber, String password) {
this.userNumber = userNumber;
this.password = password;
}
public String getUserNumber() {
return userNumber;
}
......
package com.example.tdl.domain.vo;
public class UpdateUserVo {
private String userName;
private String userNumber;
private String nickName;
......@@ -11,6 +13,14 @@ public class UpdateUserVo {
private String roleName;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserNumber() {
return userNumber;
}
......
......@@ -29,7 +29,5 @@ public interface UserMapper {
int delUser(String userNumber);
int resetPassword(@Param("userNumber") String userNumber,@Param("password") String password);
int updatePassword(UpdatePasswordVo updatePasswordVo);
}
......@@ -62,10 +62,6 @@ public class UserService {
return userMapper.delUser(userNumber);
}
public int resetPassword(String userNumber,String password){
return userMapper.resetPassword(userNumber,password);
}
public int updatePassword(UpdatePasswordVo updatePasswordVo){
return userMapper.updatePassword(updatePasswordVo);
}
......
......@@ -169,6 +169,7 @@ public class UserController {
//修改用户
@ApiOperation(value = "修改用户",notes = "修改用户都要传" +
" userNumber:用户编号," +
" userName:用户名," +
" nickName:昵称," +
" phone:电话," +
" email:邮件," +
......@@ -256,7 +257,7 @@ public class UserController {
}
int a = userService.delUser(userNumber);
if (a>0){
fb.setCode(0);
fb.setCode(1);
fb.setMessage("删除用户成功");
}else{
fb.setCode(0);
......@@ -280,7 +281,7 @@ public class UserController {
return gson.toJson(fb);
}
String pwd=DigestUtils.sha256Hex("Witium123");
int a = userService.resetPassword(userNumber,pwd);
int a = userService.updatePassword(new UpdatePasswordVo(userNumber,pwd));
if (a>0){
fb.setCode(1);
fb.setMessage("重置密码成功");
......
......@@ -87,6 +87,7 @@
<!--修改用户-->
<update id="updateUser" parameterType="com.example.tdl.domain.vo.UpdateUserVo">
update `user` SET
userName=#{userName,jdbcType=VARCHAR},
nickName=#{nickName,jdbcType=VARCHAR},
phone=#{phone,jdbcType=VARCHAR},
email=#{email,jdbcType=VARCHAR},
......@@ -108,11 +109,4 @@
WHERE userNumber=#{userNumber,jdbcType=VARCHAR}
</update>
<!--重置密码-->
<update id="resetPassword" parameterType="String">
update `user` SET
password=#{password,jdbcType=VARCHAR},
updateTime=(unix_timestamp(now())*1000)
WHERE userNumber=#{userNumber,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment