|
|
@@ -2,6 +2,7 @@ package shop.alien.store.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
@@ -460,6 +461,25 @@ public class SystemServiceImpl implements SystemService {
|
|
|
return lifeSysMapper.selectPageAndRoleName(pageObj, queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public R clearUserDepartment(String userId) {
|
|
|
+ // 校验用户ID
|
|
|
+ if (userId == null || userId.isEmpty()) {
|
|
|
+ return R.fail("用户ID不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 清除用户的部门
|
|
|
+ UpdateWrapper<LifeSys> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.set("department_id", null)
|
|
|
+ .in("id", userId.split(","));
|
|
|
+ // 执行更新
|
|
|
+ int result = lifeSysMapper.update(null, updateWrapper);
|
|
|
+ if (result > 0) {
|
|
|
+ return R.success( "用户部门清除成功");
|
|
|
+ }
|
|
|
+ return R.fail("用户部门清除失败,请稍后重试");
|
|
|
+ }
|
|
|
+
|
|
|
public static String encryptToMD5(String input) {
|
|
|
try {
|
|
|
// 获取 MD5 算法的 MessageDigest 实例
|