UserArchivesInterviewController.java 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. package com.goafanti.Interview.controller;
  2. import com.goafanti.Interview.bo.UpdateUserBo;
  3. import com.goafanti.Interview.service.UserArchivesInterviewService;
  4. import com.goafanti.common.bo.Result;
  5. import com.goafanti.common.controller.BaseController;
  6. import com.goafanti.common.model.UserArchivesInterview;
  7. import com.goafanti.core.shiro.token.TokenManager;
  8. import com.goafanti.customer.bo.InputUserData;
  9. import com.goafanti.customer.service.CustomerService;
  10. import org.springframework.web.bind.annotation.GetMapping;
  11. import org.springframework.web.bind.annotation.PostMapping;
  12. import org.springframework.web.bind.annotation.RequestMapping;
  13. import org.springframework.web.bind.annotation.RestController;
  14. import javax.annotation.Resource;
  15. /**
  16. * 客户档案面谈表(UserArchivesInterview)表控制层
  17. *
  18. * @author makejava
  19. * @since 2025-04-10 17:09:23
  20. */
  21. @RestController
  22. @RequestMapping("/api/admin/interview")
  23. public class UserArchivesInterviewController extends BaseController {
  24. /**
  25. * 服务对象
  26. */
  27. @Resource
  28. private UserArchivesInterviewService userArchivesInterviewService;
  29. @Resource
  30. private CustomerService customerService;
  31. /**
  32. * 新增数据
  33. *
  34. * @param userArchivesInterview 实体
  35. * @return 新增结果
  36. */
  37. @PostMapping("/add")
  38. public Result add(UserArchivesInterview userArchivesInterview) {
  39. return new Result<>().data(this.userArchivesInterviewService.insert(userArchivesInterview));
  40. }
  41. /**
  42. * 通过主键查询单条数据
  43. *
  44. * @param id 主键
  45. * @return 单条数据
  46. */
  47. @GetMapping("/get")
  48. public Result<UserArchivesInterview> queryById(Integer id) {
  49. return new Result<>().data(this.userArchivesInterviewService.queryById(id));
  50. }
  51. /**
  52. * 编辑数据
  53. *
  54. * @param userArchivesInterview 实体
  55. * @return 编辑结果
  56. */
  57. @PostMapping("/update")
  58. public Result edit(UserArchivesInterview userArchivesInterview) {
  59. return new Result<>().data(this.userArchivesInterviewService.update(userArchivesInterview));
  60. }
  61. /**
  62. * 删除数据
  63. *
  64. * @param id 主键
  65. * @return 删除是否成功
  66. */
  67. @GetMapping("/delete")
  68. public Result deleteById(Integer id) {
  69. return new Result<>().data(this.userArchivesInterviewService.deleteById(id));
  70. }
  71. /**
  72. * 列表查询
  73. *
  74. * @param in 参数
  75. * @return
  76. */
  77. @GetMapping("/list")
  78. public Result<UserArchivesInterview> list(UserArchivesInterview in, Integer pageNo, Integer pageSize) {
  79. return new Result<>().data(this.userArchivesInterviewService.list(in, pageNo, pageSize));
  80. }
  81. /**
  82. * 更新企业档案与面谈 /updateUser
  83. * @return
  84. */
  85. @PostMapping("/updateUser")
  86. public Result updateUser(UpdateUserBo in, InputUserData in2 ) {
  87. Result res = new Result<>();
  88. in.setAid(TokenManager.getAdminId());
  89. if (in2.getOrgCode()!=null){
  90. in2.setOrgCode(in2.getOrgCode().trim());
  91. if (customerService.checkOrgCode(in2.getOrgCode(),in.getUid())){
  92. res.getError().add(buildError("","统一信用代码已存在"));
  93. return res;
  94. }
  95. }
  96. in2.setUid(in.getUid());
  97. customerService.updateUserDate(in2);
  98. return res.data(this.userArchivesInterviewService.updateUser(in));
  99. }
  100. }