|
@@ -0,0 +1,93 @@
|
|
|
|
|
+package cn.iocoder.yudao.module.rd.controller.admin.expertkeywordrel;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
|
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
|
|
+import cn.iocoder.yudao.module.rd.controller.admin.expertkeywordrel.vo.ExpertKeywordRelPageReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.rd.controller.admin.expertkeywordrel.vo.ExpertKeywordRelRespVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.rd.controller.admin.expertkeywordrel.vo.ExpertKeywordRelSaveReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.rd.dal.dataobject.expertkeywordrel.ExpertKeywordRelDO;
|
|
|
|
|
+import cn.iocoder.yudao.module.rd.service.expertkeywordrel.ExpertKeywordRelService;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
+
|
|
|
|
|
+@Tag(name = "管理后台 - 专家热词关联")
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/rd/expert-keyword-rel")
|
|
|
|
|
+@Validated
|
|
|
|
|
+public class ExpertKeywordRelController {
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private ExpertKeywordRelService expertKeywordRelService;
|
|
|
|
|
+
|
|
|
|
|
+ @PostMapping("/create")
|
|
|
|
|
+ @Operation(summary = "创建专家热词关联")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rd:expert-keyword-rel:create')")
|
|
|
|
|
+ public CommonResult<Long> createExpertKeywordRel(@Valid @RequestBody ExpertKeywordRelSaveReqVO createReqVO) {
|
|
|
|
|
+ return success(expertKeywordRelService.createExpertKeywordRel(createReqVO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PutMapping("/update")
|
|
|
|
|
+ @Operation(summary = "更新专家热词关联")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rd:expert-keyword-rel:update')")
|
|
|
|
|
+ public CommonResult<Boolean> updateExpertKeywordRel(@Valid @RequestBody ExpertKeywordRelSaveReqVO updateReqVO) {
|
|
|
|
|
+ expertKeywordRelService.updateExpertKeywordRel(updateReqVO);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @DeleteMapping("/delete")
|
|
|
|
|
+ @Operation(summary = "删除专家热词关联")
|
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rd:expert-keyword-rel:delete')")
|
|
|
|
|
+ public CommonResult<Boolean> deleteExpertKeywordRel(@RequestParam("id") Long id) {
|
|
|
|
|
+ expertKeywordRelService.deleteExpertKeywordRel(id);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/get")
|
|
|
|
|
+ @Operation(summary = "获得专家热词关联")
|
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rd:expert-keyword-rel:query')")
|
|
|
|
|
+ public CommonResult<ExpertKeywordRelRespVO> getExpertKeywordRel(@RequestParam("id") Long id) {
|
|
|
|
|
+ ExpertKeywordRelDO expertKeywordRel = expertKeywordRelService.getExpertKeywordRel(id);
|
|
|
|
|
+ return success(BeanUtils.toBean(expertKeywordRel, ExpertKeywordRelRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/page")
|
|
|
|
|
+ @Operation(summary = "获得专家热词关联分页")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rd:expert-keyword-rel:query')")
|
|
|
|
|
+ public CommonResult<PageResult<ExpertKeywordRelRespVO>> getExpertKeywordRelPage(@Valid ExpertKeywordRelPageReqVO pageReqVO) {
|
|
|
|
|
+ PageResult<ExpertKeywordRelDO> pageResult = expertKeywordRelService.getExpertKeywordRelPage(pageReqVO);
|
|
|
|
|
+ return success(BeanUtils.toBean(pageResult, ExpertKeywordRelRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/export-excel")
|
|
|
|
|
+ @Operation(summary = "导出专家热词关联 Excel")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rd:expert-keyword-rel:export')")
|
|
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
|
|
+ public void exportExpertKeywordRelExcel(@Valid ExpertKeywordRelPageReqVO pageReqVO,
|
|
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
+ List<ExpertKeywordRelDO> list = expertKeywordRelService.getExpertKeywordRelPage(pageReqVO).getList();
|
|
|
|
|
+ // 导出 Excel
|
|
|
|
|
+ ExcelUtils.write(response, "专家热词关联.xls", "数据", ExpertKeywordRelRespVO.class,
|
|
|
|
|
+ BeanUtils.toBean(list, ExpertKeywordRelRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|