UserController.java 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package com.ims.eval.controller;
  2. import com.ims.eval.dao.result.R;
  3. import com.ims.eval.entity.Myuser;
  4. import com.ims.eval.entity.OrganizationEvaluationRule;
  5. import com.ims.eval.service.IUserService;
  6. import io.swagger.annotations.ApiOperation;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.web.bind.annotation.*;
  9. import java.util.List;
  10. import java.util.concurrent.atomic.AtomicBoolean;
  11. /**
  12. * <p>
  13. * 前端控制器
  14. * </p>
  15. *
  16. * @author wang
  17. * @since 2023-03-03
  18. */
  19. @RestController
  20. @RequestMapping("//user")
  21. public class UserController {
  22. @Autowired
  23. private IUserService userService;
  24. //@ImsPreAuth("eval:dataDictionary:edit")
  25. @PostMapping(value = "/save")
  26. @ApiOperation(value = "新增(修改)", notes = "新增(修改)")
  27. public R addAll(@RequestBody List<Myuser> user) {
  28. AtomicBoolean b = new AtomicBoolean(false);
  29. user.stream().forEach(i -> {
  30. b.set(userService.saveOrUpdate(i));
  31. });
  32. if (b.get()) {
  33. return R.ok().data(b);
  34. } else {
  35. return R.error().data("保存失败!");
  36. }
  37. }
  38. /**
  39. * 查询所有数据
  40. * @param id 主键
  41. * @param orgId 组织id
  42. * @return
  43. */
  44. //@ImsPreAuth("eval:organizationEvaluationRule:view")
  45. @GetMapping(value = "listAll")
  46. public R listAll(
  47. @RequestParam(value = "id", required = false) String id,
  48. @RequestParam(value = "orgId", required = false) String orgId,
  49. @RequestParam(value = "unitId", required = false) String unitId) {
  50. List<Myuser> list = userService.listAll(id, orgId,unitId);
  51. return R.ok().data(list);
  52. }
  53. /**
  54. * 查询所有数据
  55. * @param id 主键
  56. * @return
  57. */
  58. //@ImsPreAuth("eval:organizationEvaluationRule:view")
  59. @GetMapping(value = "getId")
  60. public R getByid(
  61. @RequestParam(value = "id", required = false) String id) {
  62. Myuser user = userService.getById(id);
  63. return R.ok().data(user);
  64. }
  65. }