UserSchoolInfoController.java 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package com.zhongzheng.controller.user;
  2. import java.util.List;
  3. import java.util.Arrays;
  4. import com.zhongzheng.common.utils.ServletUtils;
  5. import com.zhongzheng.framework.web.service.WxTokenService;
  6. import com.zhongzheng.modules.user.bo.UserSchoolInfoAddBo;
  7. import com.zhongzheng.modules.user.bo.UserSchoolInfoEditBo;
  8. import com.zhongzheng.modules.user.bo.UserSchoolInfoQueryBo;
  9. import com.zhongzheng.modules.user.entity.ClientLoginUser;
  10. import com.zhongzheng.modules.user.service.IUserBankRecordService;
  11. import com.zhongzheng.modules.user.service.IUserSchoolInfoService;
  12. import com.zhongzheng.modules.user.vo.UserSchoolInfoVo;
  13. import lombok.RequiredArgsConstructor;
  14. import org.springframework.security.access.prepost.PreAuthorize;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.web.bind.annotation.GetMapping;
  17. import org.springframework.web.bind.annotation.PostMapping;
  18. import org.springframework.web.bind.annotation.PutMapping;
  19. import org.springframework.web.bind.annotation.DeleteMapping;
  20. import org.springframework.web.bind.annotation.PathVariable;
  21. import org.springframework.web.bind.annotation.RequestBody;
  22. import org.springframework.web.bind.annotation.RequestMapping;
  23. import org.springframework.web.bind.annotation.RestController;
  24. import com.zhongzheng.common.annotation.Log;
  25. import com.zhongzheng.common.core.controller.BaseController;
  26. import com.zhongzheng.common.core.domain.AjaxResult;
  27. import com.zhongzheng.common.enums.BusinessType;
  28. import com.zhongzheng.common.utils.poi.ExcelUtil;
  29. import com.zhongzheng.common.core.page.TableDataInfo;
  30. import io.swagger.annotations.Api;
  31. import io.swagger.annotations.ApiOperation;
  32. /**
  33. * 用户学校信息Controller
  34. *
  35. * @author ruoyi
  36. * @date 2021-06-24
  37. */
  38. @Api(value = "用户学校信息控制器", tags = {"用户学校信息管理"})
  39. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  40. @RestController
  41. @RequestMapping("/school/info")
  42. public class UserSchoolInfoController extends BaseController {
  43. private final IUserSchoolInfoService iUserSchoolInfoService;
  44. private final WxTokenService wxTokenService;
  45. /**
  46. * 获取用户学校信息详细信息
  47. */
  48. @ApiOperation("获取用户学校信息详细信息")
  49. @GetMapping("/getInfo")
  50. public AjaxResult getInfo() {
  51. ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
  52. return AjaxResult.success(iUserSchoolInfoService.queryByUserId(loginUser.getUser().getUserId()));
  53. }
  54. /**
  55. * 修改用户学校信息
  56. */
  57. @ApiOperation("修改用户学校信息")
  58. @Log(title = "用户学校信息", businessType = BusinessType.UPDATE)
  59. @PostMapping("/edit")
  60. public AjaxResult<Void> edit(@RequestBody UserSchoolInfoEditBo bo) throws IllegalAccessException {
  61. ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
  62. if(loginUser.getUser().getUserId()!=bo.getUserId()){
  63. return AjaxResult.error("无权限修改");
  64. }
  65. return toAjax(iUserSchoolInfoService.updateByEditBo(bo) ? 1 : 0);
  66. }
  67. }