package com.zhongzheng.controller.base; import java.util.List; import java.util.Arrays; import com.zhongzheng.modules.base.bo.CertificateTpAddBo; import com.zhongzheng.modules.base.bo.CertificateTpEditBo; import com.zhongzheng.modules.base.bo.CertificateTpQueryBo; import com.zhongzheng.modules.base.service.ICertificateTpService; import com.zhongzheng.modules.base.vo.CertificateTpVo; import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo; import lombok.RequiredArgsConstructor; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.zhongzheng.common.annotation.Log; import com.zhongzheng.common.core.controller.BaseController; import com.zhongzheng.common.core.domain.AjaxResult; import com.zhongzheng.common.enums.BusinessType; import com.zhongzheng.common.utils.poi.ExcelUtil; import com.zhongzheng.common.core.page.TableDataInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; /** * 证书模板Controller * * @author hjl * @date 2022-02-16 */ @Api(value = "证书模板控制器", tags = {"证书模板管理"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/certificate/tp") public class CertificateTpController extends BaseController { private final ICertificateTpService iCertificateTpService; /** * 查询证书模板列表 */ @ApiOperation("查询证书模板列表") @PreAuthorize("@ss.hasPermi('system:tp:list')") @GetMapping("/list") public TableDataInfo list(CertificateTpQueryBo bo) { startPage(); List list = iCertificateTpService.selectListByBo(bo); return getDataTable(list); } /** * 导出证书模板列表 */ /*@ApiOperation("导出证书模板列表") @PreAuthorize("@ss.hasPermi('system:tp:export')") @Log(title = "证书模板", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(CertificateTpQueryBo bo) { List list = iCertificateTpService.queryList(bo); ExcelUtil util = new ExcelUtil(CertificateTpVo.class); return util.exportExcel(list, "证书模板"); }*/ /** * 获取证书模板详细信息 */ @ApiOperation("获取证书模板详细信息") @PreAuthorize("@ss.hasPermi('system:tp:query')") @GetMapping("/{tpId}") public AjaxResult getInfo(@PathVariable("tpId" ) Long tpId) { return AjaxResult.success(iCertificateTpService.queryById(tpId)); } /** * 新增证书模板 */ @ApiOperation("新增证书模板") @PreAuthorize("@ss.hasPermi('system:tp:add')") @Log(title = "证书模板", businessType = BusinessType.INSERT) @PostMapping() public AjaxResult add(@RequestBody CertificateTpAddBo bo) { return toAjax(iCertificateTpService.insertByAddBo(bo) ? 1 : 0); } /** * 修改证书模板 */ @ApiOperation("修改证书模板") @PreAuthorize("@ss.hasPermi('system:tp:edit')") @Log(title = "证书模板", businessType = BusinessType.UPDATE) @PostMapping("/edit") public AjaxResult edit(@RequestBody CertificateTpEditBo bo) { return toAjax(iCertificateTpService.updateByEditBo(bo) ? 1 : 0); } /** * 删除证书模板 */ @ApiOperation("生成证书图片") @PreAuthorize("@ss.hasPermi('system:tp:remove')") @Log(title = "证书模板" , businessType = BusinessType.DELETE) @GetMapping("/makePhoto") public AjaxResult makePhoto(ClassGradeUserQueryBo bo) { return AjaxResult.success(iCertificateTpService.makeCertificatePhoto(bo)); } }