123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- package com.zhongzheng.controller.collect;
- import com.zhongzheng.common.annotation.Log;
- import com.zhongzheng.common.core.controller.BaseController;
- import com.zhongzheng.common.core.domain.AjaxResult;
- import com.zhongzheng.common.core.page.TableDataInfo;
- import com.zhongzheng.common.enums.BusinessType;
- import com.zhongzheng.common.utils.ServletUtils;
- import com.zhongzheng.framework.web.service.WxTokenService;
- import com.zhongzheng.modules.bank.vo.QuestionVo;
- import com.zhongzheng.modules.collect.bo.CollectQuestionAddBo;
- import com.zhongzheng.modules.collect.bo.CollectQuestionQueryBo;
- import com.zhongzheng.modules.collect.domain.CollectQuestion;
- import com.zhongzheng.modules.collect.service.ICollectQuestionService;
- import com.zhongzheng.modules.user.entity.ClientLoginUser;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import lombok.RequiredArgsConstructor;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.Arrays;
- import java.util.List;
- /**
- * 收藏题目Controller
- *
- * @author ruoyi
- * @date 2021-06-24
- */
- @Api(value = "收藏题目控制器", tags = {"收藏题目管理"})
- @RequiredArgsConstructor(onConstructor_ = @Autowired)
- @RestController
- @RequestMapping("/collect/question")
- public class CollectQuestionController extends BaseController {
- private final ICollectQuestionService iCollectQuestionService;
- private final WxTokenService wxTokenService;
- /**
- * 查询收藏题目列表
- */
- @ApiOperation("查询收藏题目列表,按题型")
- @GetMapping("/list")
- public TableDataInfo<QuestionVo> list(CollectQuestionQueryBo bo) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- startPage();
- List<QuestionVo> list = iCollectQuestionService.selectList(bo);
- return getDataTable(list);
- }
- /**
- * 查询收藏题目列表
- */
- @ApiOperation("查询收藏题目列表,按试卷")
- @GetMapping("/exam_list")
- public TableDataInfo<QuestionVo> exam_list(CollectQuestionQueryBo bo) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- startPage();
- List<QuestionVo> list = iCollectQuestionService.selectExamList(bo);
- return getDataTable(list);
- }
- /**
- * 获取收藏题目详细信息
- */
- @ApiOperation("获取收藏题目详细信息")
- @GetMapping("/getInfo")
- public AjaxResult<CollectQuestion> getInfo(Long questionId,Long examId,Long goodsId) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- return AjaxResult.success(iCollectQuestionService.queryQuestionById(loginUser.getUser().getUserId(),questionId,examId,goodsId));
- }
- /**
- * 新增收藏题目
- */
- @ApiOperation("新增收藏题目")
- @Log(title = "收藏题目", businessType = BusinessType.INSERT)
- @PostMapping()
- public AjaxResult<Void> add(@RequestBody CollectQuestionAddBo bo) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- return toAjax(iCollectQuestionService.insertByAddBo(bo) ? 1 : 0);
- }
- /**
- * 删除收藏题目
- */
- @ApiOperation("删除收藏题目")
- @Log(title = "收藏题目" , businessType = BusinessType.DELETE)
- @PostMapping("/delete/{collectQuestionIds}")
- public AjaxResult<Void> remove(@PathVariable Long[] collectQuestionIds) {
- return toAjax(iCollectQuestionService.deleteWithValidByIds(Arrays.asList(collectQuestionIds), true) ? 1 : 0);
- }
- }
|