| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- package com.ruoyi.web.controller.benyun;
- import cn.dev33.satoken.annotation.SaIgnore;
- import com.ruoyi.common.core.domain.R;
- import com.ruoyi.system.domain.vo.OpenAccountVO;
- import com.ruoyi.system.service.AccountService;
- import com.ruoyi.system.service.IUserinfoService;
- import lombok.RequiredArgsConstructor;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.validation.annotation.Validated;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RestController;
- import java.util.ArrayList;
- @RestController
- @RequiredArgsConstructor
- public class IUserinfoController {
- @Autowired
- private IUserinfoService iUserinfoService;
- @Autowired
- private AccountService accountService;
- /**
- * 创建管理员
- * @param openAccountVO
- * @return
- */
- @PostMapping("/createAdmin")
- public R createAdmin(@Validated @RequestBody OpenAccountVO openAccountVO) {
- ArrayList<Integer> integers = new ArrayList<>();
- integers.add(1); //管理员
- openAccountVO.setRoles(integers);
- R admin = iUserinfoService.createAdmin(openAccountVO);
- return admin;
- }
- /**
- * 创建用户
- * @param openAccountVO
- * @return
- */
- @PostMapping("/createUser")
- public R createUser(@Validated @RequestBody OpenAccountVO openAccountVO) {
- ArrayList<Integer> integers = new ArrayList<>();
- integers.add(2); //管理员
- openAccountVO.setRoles(integers);
- R user = iUserinfoService.createUser(openAccountVO);
- return user;
- }
- @PostMapping("/disableUser")
- public R disableUser(@Validated @RequestBody OpenAccountVO openAccountVO) {
- iUserinfoService.disableUser(openAccountVO);
- return R.ok();
- }
- /**
- * uId免密登录
- * @Author Yyz
- * @Date 2020/12/1 13:58
- */
- @SaIgnore
- @PostMapping("/loginByUId")
- public R login(String uId) {
- R<Object> ok = R.ok();
- ok.setData(accountService.login(uId));
- return ok;
- }
- }
|