|
@@ -0,0 +1,121 @@
|
|
|
+package com.ruoyi.web.controller.asking;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+import com.ruoyi.common.core.domain.R;
|
|
|
+import com.sooka.jnb.asking.domain.JnbQuestionCollect;
|
|
|
+import com.sooka.jnb.asking.service.IJnbQuestionCollectService;
|
|
|
+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.ruoyi.common.annotation.Log;
|
|
|
+import com.ruoyi.common.core.controller.BaseController;
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.enums.BusinessType;
|
|
|
+import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 问题收藏Controller
|
|
|
+ *
|
|
|
+ * @author 韩福成
|
|
|
+ * @date 2024-03-13
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/asking/collect")
|
|
|
+public class JnbQuestionCollectController extends BaseController {
|
|
|
+ @Autowired
|
|
|
+ private IJnbQuestionCollectService jnbQuestionCollectService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询问题收藏列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:collect:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo list(JnbQuestionCollect jnbQuestionCollect) {
|
|
|
+ startPage();
|
|
|
+ List<JnbQuestionCollect> list = jnbQuestionCollectService.selectJnbQuestionCollectList(jnbQuestionCollect);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出问题收藏列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:collect:export')")
|
|
|
+ @Log(title = "问题收藏", businessType = BusinessType.EXPORT)
|
|
|
+ @PostMapping("/export")
|
|
|
+ public void export(HttpServletResponse response, JnbQuestionCollect jnbQuestionCollect) {
|
|
|
+ List<JnbQuestionCollect> list = jnbQuestionCollectService.selectJnbQuestionCollectList(jnbQuestionCollect);
|
|
|
+ ExcelUtil<JnbQuestionCollect> util = new ExcelUtil<JnbQuestionCollect>(JnbQuestionCollect.class);
|
|
|
+ util.exportExcel(response, list, "问题收藏数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取问题收藏详细信息
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:collect:query')")
|
|
|
+ @GetMapping(value = "/{id}")
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") String id) {
|
|
|
+ return success(jnbQuestionCollectService.selectJnbQuestionCollectById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增问题收藏
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:collect:add')")
|
|
|
+ @Log(title = "问题收藏", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping
|
|
|
+ public AjaxResult add(@RequestBody JnbQuestionCollect jnbQuestionCollect) {
|
|
|
+ return toAjax(jnbQuestionCollectService.insertJnbQuestionCollect(jnbQuestionCollect));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改问题收藏
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:collect:edit')")
|
|
|
+ @Log(title = "问题收藏", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping
|
|
|
+ public AjaxResult edit(@RequestBody JnbQuestionCollect jnbQuestionCollect) {
|
|
|
+ return toAjax(jnbQuestionCollectService.updateJnbQuestionCollect(jnbQuestionCollect));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除问题收藏
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:collect:remove')")
|
|
|
+ @Log(title = "问题收藏", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public AjaxResult remove(@PathVariable String[] ids) {
|
|
|
+ return toAjax(jnbQuestionCollectService.deleteJnbQuestionCollectByIds(ids));
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 小程序-添加(取消)收藏
|
|
|
+ *
|
|
|
+ * @author 韩福成
|
|
|
+ * @date 2024/3/13 14:22
|
|
|
+ */
|
|
|
+ @GetMapping("/addCollect")
|
|
|
+ public AjaxResult addCollect(JnbQuestionCollect jnbQuestionCollect) {
|
|
|
+ return toAjax(jnbQuestionCollectService.addCollect(jnbQuestionCollect));
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 小程序-判断是否收藏
|
|
|
+ *
|
|
|
+ * @author 韩福成
|
|
|
+ * @date 2024/3/14 9:05
|
|
|
+ */
|
|
|
+ @GetMapping("/selectCollect")
|
|
|
+ public R selectCollect(JnbQuestionCollect jnbQuestionCollect) {
|
|
|
+ return R.ok(jnbQuestionCollectService.selectCollect(jnbQuestionCollect));
|
|
|
+ }
|
|
|
+}
|