|
|
@ -145,6 +145,12 @@ public class UserServiceImpl extends CrudServiceImpl<UserMapper, SysUser, UserMo
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean delete(String id) {
|
|
|
|
public boolean delete(String id) {
|
|
|
|
|
|
|
|
// 杜绝我删我自己行为
|
|
|
|
|
|
|
|
UserModel currUser = UserUtil.getUser();
|
|
|
|
|
|
|
|
if(StringUtils.equals(currUser.getId(), id)){
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
UserModel userModel = super.get(id);
|
|
|
|
UserModel userModel = super.get(id);
|
|
|
|
boolean ret = super.delete(id);
|
|
|
|
boolean ret = super.delete(id);
|
|
|
|
if(ret){
|
|
|
|
if(ret){
|
|
|
@ -159,20 +165,42 @@ public class UserServiceImpl extends CrudServiceImpl<UserMapper, SysUser, UserMo
|
|
|
|
UserModel userModel = null;
|
|
|
|
UserModel userModel = null;
|
|
|
|
if(model != null){
|
|
|
|
if(model != null){
|
|
|
|
userModel = this.get(model.getId());
|
|
|
|
userModel = this.get(model.getId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 非法判断
|
|
|
|
|
|
|
|
if(userModel == null){
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 杜绝我删我自己行为
|
|
|
|
|
|
|
|
UserModel currUser = UserUtil.getUser();
|
|
|
|
|
|
|
|
if(StringUtils.equals(currUser.getId(), userModel.getId())){
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
boolean ret = super.delete(model);
|
|
|
|
boolean ret = super.delete(model);
|
|
|
|
if(ret){
|
|
|
|
if(ret){
|
|
|
|
if(userModel != null){
|
|
|
|
|
|
|
|
// 刷新用户缓存
|
|
|
|
// 刷新用户缓存
|
|
|
|
this.clearCache(Collections.singletonList(userModel));
|
|
|
|
this.clearCache(Collections.singletonList(userModel));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean deleteAll(String[] ids) {
|
|
|
|
public boolean deleteAll(String[] ids) {
|
|
|
|
|
|
|
|
// 非法判断
|
|
|
|
|
|
|
|
if(ids == null){
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 杜绝我删我自己行为
|
|
|
|
|
|
|
|
UserModel currUser = UserUtil.getUser();
|
|
|
|
|
|
|
|
for (String id : ids) {
|
|
|
|
|
|
|
|
if(StringUtils.equals(currUser.getId(), id)){
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QueryBuilder<SysUser> queryBuilder = new GenQueryBuilder<>();
|
|
|
|
QueryBuilder<SysUser> queryBuilder = new GenQueryBuilder<>();
|
|
|
|
QueryWrapper<SysUser> queryWrapper = queryBuilder.build();
|
|
|
|
QueryWrapper<SysUser> queryWrapper = queryBuilder.build();
|
|
|
|
List<String> idList = Convert.toList(String.class, ids);
|
|
|
|
List<String> idList = Convert.toList(String.class, ids);
|
|
|
@ -192,12 +220,19 @@ public class UserServiceImpl extends CrudServiceImpl<UserMapper, SysUser, UserMo
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean deleteAll(Collection<UserModel> models) {
|
|
|
|
public boolean deleteAll(Collection<UserModel> models) {
|
|
|
|
|
|
|
|
// 非法判断
|
|
|
|
if(CollUtil.isEmpty(models)){
|
|
|
|
if(CollUtil.isEmpty(models)){
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 杜绝我删我自己行为
|
|
|
|
|
|
|
|
UserModel currUser = UserUtil.getUser();
|
|
|
|
|
|
|
|
|
|
|
|
List<String> idList = Lists.newArrayListWithCapacity(models.size());
|
|
|
|
List<String> idList = Lists.newArrayListWithCapacity(models.size());
|
|
|
|
for (UserModel model : models) {
|
|
|
|
for (UserModel model : models) {
|
|
|
|
|
|
|
|
if(StringUtils.equals(currUser.getId(), model.getId())){
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
idList.add(model.getId());
|
|
|
|
idList.add(model.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|