CertificateTpController.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package com.zhongzheng.controller.base;
  2. import java.util.List;
  3. import java.util.Arrays;
  4. import com.zhongzheng.modules.base.bo.CertificateTpAddBo;
  5. import com.zhongzheng.modules.base.bo.CertificateTpEditBo;
  6. import com.zhongzheng.modules.base.bo.CertificateTpQueryBo;
  7. import com.zhongzheng.modules.base.service.ICertificateTpService;
  8. import com.zhongzheng.modules.base.vo.CertificateTpVo;
  9. import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
  10. import lombok.RequiredArgsConstructor;
  11. import org.springframework.security.access.prepost.PreAuthorize;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.GetMapping;
  14. import org.springframework.web.bind.annotation.PostMapping;
  15. import org.springframework.web.bind.annotation.PutMapping;
  16. import org.springframework.web.bind.annotation.DeleteMapping;
  17. import org.springframework.web.bind.annotation.PathVariable;
  18. import org.springframework.web.bind.annotation.RequestBody;
  19. import org.springframework.web.bind.annotation.RequestMapping;
  20. import org.springframework.web.bind.annotation.RestController;
  21. import com.zhongzheng.common.annotation.Log;
  22. import com.zhongzheng.common.core.controller.BaseController;
  23. import com.zhongzheng.common.core.domain.AjaxResult;
  24. import com.zhongzheng.common.enums.BusinessType;
  25. import com.zhongzheng.common.utils.poi.ExcelUtil;
  26. import com.zhongzheng.common.core.page.TableDataInfo;
  27. import io.swagger.annotations.Api;
  28. import io.swagger.annotations.ApiOperation;
  29. /**
  30. * 证书模板Controller
  31. *
  32. * @author hjl
  33. * @date 2022-02-16
  34. */
  35. @Api(value = "证书模板控制器", tags = {"证书模板管理"})
  36. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  37. @RestController
  38. @RequestMapping("/certificate/tp")
  39. public class CertificateTpController extends BaseController {
  40. private final ICertificateTpService iCertificateTpService;
  41. /**
  42. * 查询证书模板列表
  43. */
  44. @ApiOperation("查询证书模板列表")
  45. @PreAuthorize("@ss.hasPermi('system:tp:list')")
  46. @GetMapping("/list")
  47. public TableDataInfo<CertificateTpVo> list(CertificateTpQueryBo bo) {
  48. startPage();
  49. List<CertificateTpVo> list = iCertificateTpService.selectListByBo(bo);
  50. return getDataTable(list);
  51. }
  52. /**
  53. * 导出证书模板列表
  54. */
  55. /*@ApiOperation("导出证书模板列表")
  56. @PreAuthorize("@ss.hasPermi('system:tp:export')")
  57. @Log(title = "证书模板", businessType = BusinessType.EXPORT)
  58. @GetMapping("/export")
  59. public AjaxResult<CertificateTpVo> export(CertificateTpQueryBo bo) {
  60. List<CertificateTpVo> list = iCertificateTpService.queryList(bo);
  61. ExcelUtil<CertificateTpVo> util = new ExcelUtil<CertificateTpVo>(CertificateTpVo.class);
  62. return util.exportExcel(list, "证书模板");
  63. }*/
  64. /**
  65. * 获取证书模板详细信息
  66. */
  67. @ApiOperation("获取证书模板详细信息")
  68. @PreAuthorize("@ss.hasPermi('system:tp:query')")
  69. @GetMapping("/{tpId}")
  70. public AjaxResult<CertificateTpVo> getInfo(@PathVariable("tpId" ) Long tpId) {
  71. return AjaxResult.success(iCertificateTpService.queryById(tpId));
  72. }
  73. /**
  74. * 新增证书模板
  75. */
  76. @ApiOperation("新增证书模板")
  77. @PreAuthorize("@ss.hasPermi('system:tp:add')")
  78. @Log(title = "证书模板", businessType = BusinessType.INSERT)
  79. @PostMapping()
  80. public AjaxResult<Void> add(@RequestBody CertificateTpAddBo bo) {
  81. return toAjax(iCertificateTpService.insertByAddBo(bo) ? 1 : 0);
  82. }
  83. /**
  84. * 修改证书模板
  85. */
  86. @ApiOperation("修改证书模板")
  87. @PreAuthorize("@ss.hasPermi('system:tp:edit')")
  88. @Log(title = "证书模板", businessType = BusinessType.UPDATE)
  89. @PostMapping("/edit")
  90. public AjaxResult<Void> edit(@RequestBody CertificateTpEditBo bo) {
  91. return toAjax(iCertificateTpService.updateByEditBo(bo) ? 1 : 0);
  92. }
  93. /**
  94. * 删除证书模板
  95. */
  96. @ApiOperation("生成证书图片")
  97. @PreAuthorize("@ss.hasPermi('system:tp:remove')")
  98. @Log(title = "证书模板" , businessType = BusinessType.DELETE)
  99. @GetMapping("/makePhoto")
  100. public AjaxResult<Void> makePhoto(ClassGradeUserQueryBo bo) {
  101. return AjaxResult.success(iCertificateTpService.makeCertificatePhoto(bo));
  102. }
  103. }