|
@@ -1,11 +1,14 @@
|
|
|
package com.jd.brume.controller
|
|
|
|
|
|
import cn.hutool.core.codec.Base64
|
|
|
+import cn.hutool.json.JSONObject
|
|
|
import com.jd.brume.common.annotation.Log
|
|
|
import com.jd.brume.common.enums.Module
|
|
|
import com.jd.brume.common.enums.OpertateType
|
|
|
+import com.jd.brume.util.TokenUtil
|
|
|
|
|
|
import javax.annotation.Resource
|
|
|
+import javax.servlet.http.HttpServletRequest
|
|
|
import javax.validation.constraints.NotNull
|
|
|
|
|
|
import org.springframework.validation.annotation.Validated
|
|
@@ -125,7 +128,15 @@ class UserController {
|
|
|
*/
|
|
|
@Log(title = Module.USER, opertateType = OpertateType.DELETE)
|
|
|
@DeleteMapping('delete')
|
|
|
- def deleteUser(@NotNull Integer userId) {
|
|
|
+ def deleteUser(@NotNull Integer userId, HttpServletRequest req) {
|
|
|
+ if(userId == null){
|
|
|
+ return new Result().msg(100, '删除失败,参数缺失')
|
|
|
+ }
|
|
|
+ JSONObject loignParams = TokenUtil.getParamStr(['userId'], req)
|
|
|
+ Integer loginUserId = loignParams.getInt('userId', null)
|
|
|
+ if(loginUserId != null && loginUserId.intValue() == userId.intValue()){
|
|
|
+ return new Result().msg(100, '删除失败,当前账号正在使用,不能删除')
|
|
|
+ }
|
|
|
return new Result().ok(userService.removeById(userId))
|
|
|
}
|
|
|
|