增加注销账号功能
This commit is contained in:
parent
6191a835bb
commit
873b7cf90f
@ -7,12 +7,15 @@ import ink.wgink.exceptions.ParamsException;
|
||||
import ink.wgink.interfaces.consts.IFileConstant;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.interfaces.manager.ISystemConfigManager;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.result.*;
|
||||
import ink.wgink.pojo.vos.IdsVO;
|
||||
import ink.wgink.pojo.vos.UpdatePasswordVO;
|
||||
import ink.wgink.service.user.pojo.vos.*;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.service.user.pojo.vos.RestPasswordVO;
|
||||
import ink.wgink.service.user.pojo.vos.UpdateExpiredDateVO;
|
||||
import ink.wgink.service.user.pojo.vos.UpdateUsernameVO;
|
||||
import ink.wgink.service.user.pojo.vos.UserVO;
|
||||
import ink.wgink.service.user.service.IUserService;
|
||||
import ink.wgink.util.ReflectUtil;
|
||||
import ink.wgink.util.RegexUtil;
|
||||
@ -68,6 +71,17 @@ public class UserController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除用户", notes = "删除用户接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ids", value = "用户ID列表,用下划线分隔", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@DeleteMapping("delete/user-id/{userId}")
|
||||
public SuccessResult deleteByUserId(@PathVariable("userId") String userId) {
|
||||
userService.delete(Arrays.asList(userId));
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改用户", notes = "修改用户接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "path"),
|
||||
|
@ -49,6 +49,17 @@ public class UserAppController extends DefaultBaseController {
|
||||
@Autowired(required = false)
|
||||
private ISmsBaseService smsBaseService;
|
||||
|
||||
@ApiOperation(value = "注销用户", notes = "注销用户接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@DeleteMapping("log-off")
|
||||
public SuccessResult deleteByUserId(@RequestHeader("token") String token) {
|
||||
userService.deleteByToken(token);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改用户信息", notes = "修改用户信息接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
|
@ -41,6 +41,15 @@ public interface IUserDao extends IInitBaseTable {
|
||||
*/
|
||||
void remove(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param params
|
||||
* @throws RemoveException
|
||||
*/
|
||||
void delete(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
@ -100,6 +109,7 @@ public interface IUserDao extends IInitBaseTable {
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
|
@ -94,6 +94,21 @@ public interface IUserService extends IUserBaseService, IUserCheckService {
|
||||
*/
|
||||
void remove(List<String> ids);
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
void delete(List<String> ids);
|
||||
|
||||
/**
|
||||
* 注销用户
|
||||
*
|
||||
* @param token
|
||||
*/
|
||||
void deleteByToken(String token);
|
||||
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*
|
||||
@ -332,4 +347,5 @@ public interface IUserService extends IUserBaseService, IUserCheckService {
|
||||
* @param token
|
||||
*/
|
||||
void isExpiredByToken(String token);
|
||||
|
||||
}
|
||||
|
@ -149,6 +149,22 @@ public class UserServiceImpl extends DefaultBaseService implements IUserService
|
||||
updateMongoLoginUser(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(List<String> ids) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("userIds", ids);
|
||||
userDao.delete(params);
|
||||
// 删除关联用户
|
||||
deleteRelationUser(ids);
|
||||
updateMongoLoginUser(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByToken(String token) {
|
||||
String userId = getAppTokenUser(token).getId();
|
||||
delete(Arrays.asList(userId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String userId, UserVO userVO) {
|
||||
if (!StringUtils.isBlank(userVO.getUserPassword())) {
|
||||
|
@ -140,6 +140,17 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 删除用户 -->
|
||||
<update id="delete" parameterType="map" flushCache="true">
|
||||
DELETE FROM
|
||||
sys_user
|
||||
WHERE
|
||||
user_id IN
|
||||
<foreach collection="userIds" index="index" open="(" separator="," close=")">
|
||||
#{userIds[${index}]}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 修改菜单 -->
|
||||
<update id="update" parameterType="map" flushCache="true">
|
||||
UPDATE
|
||||
|
Loading…
Reference in New Issue
Block a user