新增重置用户密码功能
This commit is contained in:
parent
89e501c3c7
commit
da342842d2
@ -59,4 +59,6 @@ public interface UserMapper extends BaseMapper<User> {
|
|||||||
int countByDepts(@Param("deptIds") Set<Long> deptIds);
|
int countByDepts(@Param("deptIds") Set<Long> deptIds);
|
||||||
|
|
||||||
int countByRoles(@Param("roleIds") Set<Long> roleIds);
|
int countByRoles(@Param("roleIds") Set<Long> roleIds);
|
||||||
|
|
||||||
|
void resetPwd(@Param("userIds") Set<Long> userIds, @Param("pwd") String pwd);
|
||||||
}
|
}
|
||||||
|
@ -166,6 +166,14 @@ public class UserController {
|
|||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("重置密码")
|
||||||
|
@PutMapping(value = "/resetPwd")
|
||||||
|
public ResponseEntity<Object> resetPwd(@RequestBody Set<Long> ids) {
|
||||||
|
String pwd = passwordEncoder.encode("123456");
|
||||||
|
userService.resetPwd(ids, pwd);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("修改头像")
|
@ApiOperation("修改头像")
|
||||||
@PostMapping(value = "/updateAvatar")
|
@PostMapping(value = "/updateAvatar")
|
||||||
public ResponseEntity<Object> updateUserAvatar(@RequestParam MultipartFile avatar){
|
public ResponseEntity<Object> updateUserAvatar(@RequestParam MultipartFile avatar){
|
||||||
|
@ -126,4 +126,11 @@ public interface UserService extends IService<User> {
|
|||||||
* @param resources /
|
* @param resources /
|
||||||
*/
|
*/
|
||||||
void updateCenter(User resources);
|
void updateCenter(User resources);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置密码
|
||||||
|
* @param ids 用户id
|
||||||
|
* @param pwd 密码
|
||||||
|
*/
|
||||||
|
void resetPwd(Set<Long> ids, String pwd);
|
||||||
}
|
}
|
||||||
|
@ -206,6 +206,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||||||
flushCache(username);
|
flushCache(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void resetPwd(Set<Long> ids, String pwd) {
|
||||||
|
userMapper.resetPwd(ids, pwd);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Map<String, String> updateAvatar(MultipartFile multipartFile) {
|
public Map<String, String> updateAvatar(MultipartFile multipartFile) {
|
||||||
|
@ -169,4 +169,12 @@
|
|||||||
#{roleId}
|
#{roleId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="resetPwd">
|
||||||
|
update sys_user set password = #{pwd}
|
||||||
|
where user_id in
|
||||||
|
<foreach collection="userIds" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user