UserCertificateController.java 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package com.zhongzheng.controller.user;
  2. import com.zhongzheng.common.core.controller.BaseController;
  3. import com.zhongzheng.common.core.domain.AjaxResult;
  4. import com.zhongzheng.common.core.page.TableDataInfo;
  5. import com.zhongzheng.common.utils.ServletUtils;
  6. import com.zhongzheng.framework.web.service.WxTokenService;
  7. import com.zhongzheng.modules.user.bo.UserCertificateQueryBo;
  8. import com.zhongzheng.modules.user.entity.ClientLoginUser;
  9. import com.zhongzheng.modules.user.service.IUserCertificateService;
  10. import com.zhongzheng.modules.user.vo.UserCertificateVo;
  11. import io.swagger.annotations.Api;
  12. import io.swagger.annotations.ApiOperation;
  13. import lombok.RequiredArgsConstructor;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.security.access.prepost.PreAuthorize;
  16. import org.springframework.web.bind.annotation.GetMapping;
  17. import org.springframework.web.bind.annotation.PathVariable;
  18. import org.springframework.web.bind.annotation.RequestMapping;
  19. import org.springframework.web.bind.annotation.RestController;
  20. import java.util.List;
  21. /**
  22. * 用户证书Controller
  23. *
  24. * @author hjl
  25. * @date 2022-02-17
  26. */
  27. @Api(value = "用户证书控制器", tags = {"用户证书管理"})
  28. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  29. @RestController
  30. @RequestMapping("/user/certificate")
  31. public class UserCertificateController extends BaseController {
  32. private final IUserCertificateService iUserCertificateService;
  33. private final WxTokenService wxTokenService;
  34. /**
  35. * 查询用户证书列表
  36. */
  37. @ApiOperation("查询用户证书列表")
  38. @PreAuthorize("@ss.hasPermi('system:certificate:list')")
  39. @GetMapping("/list")
  40. public TableDataInfo<UserCertificateVo> list(UserCertificateQueryBo bo) {
  41. ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
  42. bo.setUserId(loginUser.getUser().getUserId());
  43. startPage();
  44. List<UserCertificateVo> list = iUserCertificateService.selectList(bo);
  45. return getDataTable(list);
  46. }
  47. /**
  48. * 获取用户证书详细信息
  49. */
  50. @ApiOperation("用户证书详细信息")
  51. @PreAuthorize("@ss.hasPermi('system:certificate:query')")
  52. @GetMapping("/{id}")
  53. public AjaxResult<UserCertificateVo> getInfo(@PathVariable("id" ) Long id) {
  54. return AjaxResult.success(iUserCertificateService.queryById(id));
  55. }
  56. }