UserArchivesController.java 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. package com.goafanti.customer.controller;
  2. import com.goafanti.common.bo.Result;
  3. import com.goafanti.common.constant.AFTConstants;
  4. import com.goafanti.common.controller.BaseController;
  5. import com.goafanti.common.model.UserArchives;
  6. import com.goafanti.core.shiro.token.TokenManager;
  7. import com.goafanti.customer.service.UserArchivesService;
  8. import org.springframework.web.bind.annotation.GetMapping;
  9. import org.springframework.web.bind.annotation.PostMapping;
  10. import org.springframework.web.bind.annotation.RequestMapping;
  11. import org.springframework.web.bind.annotation.RestController;
  12. import javax.annotation.Resource;
  13. /**
  14. * 客户档案表(UserArchives)表控制层
  15. *
  16. * @author makejava
  17. * @since 2024-07-12 11:52:01
  18. */
  19. @RestController
  20. @RequestMapping("/api/admin/userArchives")
  21. public class UserArchivesController extends BaseController {
  22. /**
  23. * 服务对象
  24. */
  25. @Resource
  26. private UserArchivesService userArchivesService;
  27. /**
  28. * 新增数据
  29. *
  30. * @param userArchives 实体
  31. * @return 新增结果
  32. */
  33. @PostMapping("/add")
  34. public Result add(UserArchives userArchives) {
  35. return new Result<>().data(this.userArchivesService.insert(userArchives));
  36. }
  37. /**
  38. * 通过主键查询单条数据
  39. *
  40. * @param id 主键
  41. * @return 单条数据
  42. */
  43. @GetMapping("/get")
  44. public Result<UserArchives> queryById( Integer id) {
  45. return new Result<>().data(this.userArchivesService.queryById(id));
  46. }
  47. /**
  48. * 编辑用户档案数据
  49. *
  50. * @param userArchives 实体
  51. * @return 编辑结果
  52. */
  53. @PostMapping("/update")
  54. public Result edit(UserArchives userArchives) {
  55. return new Result<>().data(this.userArchivesService.update(userArchives));
  56. }
  57. /**
  58. * 删除数据
  59. *
  60. * @param id 主键
  61. * @return 删除是否成功
  62. */
  63. @GetMapping("/delete")
  64. public Result deleteById(Integer id) {
  65. return new Result<>().data(this.userArchivesService.deleteById(id));
  66. }
  67. /**
  68. * 列表查询
  69. * @param in 参数
  70. * @return
  71. */
  72. @GetMapping("/list")
  73. public Result<UserArchives> list(UserArchives in, Integer pageNo, Integer pageSize) {
  74. return new Result<>().data(this.userArchivesService.list(in, pageNo, pageSize));
  75. }
  76. /**
  77. * 查询企业档案
  78. *
  79. * @param id 主键
  80. * @return 单条数据
  81. */
  82. @GetMapping("/queryByUid")
  83. public Result<UserArchives> queryByUid( String id) {
  84. return new Result<>().data(this.userArchivesService.queryByUid(id));
  85. }
  86. /**
  87. * 微信查询查询企业其他信息与档案信息
  88. *
  89. * @param id 主键
  90. * @return 单条数据
  91. */
  92. @GetMapping("/queryByUidAll")
  93. public Result queryByUidAll( String id) {
  94. Result res = new Result<>();
  95. if (!TokenManager.hasRole(AFTConstants.SUPERADMIN)&&!TokenManager.hasRole(AFTConstants.SALESMAN_MANAGER)
  96. &&!TokenManager.hasRole(AFTConstants.SALESMAN_ADMIN)){
  97. res.error(buildError("查看权限不足"));
  98. return res;
  99. }
  100. res.data(this.userArchivesService.queryByUidAll(id));
  101. return res;
  102. }
  103. }