用户管理添加解绑功能
This commit is contained in:
parent
d0c51f3bc4
commit
be7b2c2192
|
@ -133,7 +133,7 @@ public class WxLoginController extends BaseController {
|
||||||
String filePath = RuoYiConfig.getUploadPath();
|
String filePath = RuoYiConfig.getUploadPath();
|
||||||
// 上传并返回新文件名称
|
// 上传并返回新文件名称
|
||||||
String fileName = FileUploadUtils.upload(filePath, file);
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
String url = serverConfig.getUrl() + fileName;
|
String url = serverConfig.getUrl() + "/prod-api"+ fileName;
|
||||||
AjaxResult ajax = success();
|
AjaxResult ajax = success();
|
||||||
ajax.put("url", url);
|
ajax.put("url", url);
|
||||||
ajax.put("fileName", fileName);
|
ajax.put("fileName", fileName);
|
||||||
|
@ -216,6 +216,13 @@ public class WxLoginController extends BaseController {
|
||||||
String username = sysUser.getUserName();
|
String username = sysUser.getUserName();
|
||||||
String password = sysUser.getPassword();
|
String password = sysUser.getPassword();
|
||||||
String openid = sysUser.getOpenid();
|
String openid = sysUser.getOpenid();
|
||||||
|
List<SysUser> userList = iSysUserService.selectList();
|
||||||
|
List<SysUser> collect = userList.stream().filter(data -> data.getOpenid() != null
|
||||||
|
&& data.getOpenid().equals(openid)).collect(Collectors.toList());
|
||||||
|
if(collect.size() != 0){
|
||||||
|
//当前用户已绑定过角色
|
||||||
|
return error("当前用户已绑定过角色!");
|
||||||
|
}
|
||||||
//校验传递的用户名、密码、openid都不为空
|
//校验传递的用户名、密码、openid都不为空
|
||||||
if(StringUtils.isEmpty(username) || StringUtils.isEmpty(password) || StringUtils.isEmpty(openid)){
|
if(StringUtils.isEmpty(username) || StringUtils.isEmpty(password) || StringUtils.isEmpty(openid)){
|
||||||
return error();
|
return error();
|
||||||
|
|
|
@ -1,21 +1,5 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
@ -31,6 +15,16 @@ import com.ruoyi.system.service.ISysDeptService;
|
||||||
import com.ruoyi.system.service.ISysPostService;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
import com.ruoyi.system.service.ISysRoleService;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户信息
|
||||||
|
@ -248,4 +242,15 @@ public class SysUserController extends BaseController
|
||||||
{
|
{
|
||||||
return success(deptService.selectDeptTreeList(dept));
|
return success(deptService.selectDeptTreeList(dept));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解绑操作,将此用户openid置为空
|
||||||
|
* @param userId 用户表id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/unbinding")
|
||||||
|
public AjaxResult unbinding(@RequestParam Long userId){
|
||||||
|
SysUser user = userService.unbinding(userId);
|
||||||
|
return success(user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,4 +216,11 @@ public interface ISysUserService
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<SysUser> selectList();
|
public List<SysUser> selectList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解绑操作
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public SysUser unbinding(Long userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -568,4 +568,17 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
List<SysUser> userList = userMapper.selectList();
|
List<SysUser> userList = userMapper.selectList();
|
||||||
return userList;
|
return userList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解绑操作
|
||||||
|
* @param userId 用户表id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysUser unbinding(Long userId) {
|
||||||
|
SysUser user = iSysUserService.selectUserById(userId);
|
||||||
|
user.setOpenid("");
|
||||||
|
userMapper.updateUser(user);
|
||||||
|
return user;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue