Kaynağa Gözat

收藏数量

he2802 4 yıl önce
ebeveyn
işleme
b7221681ab

+ 59 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/bank/QuestionDetailController.java

@@ -0,0 +1,59 @@
+package com.zhongzheng.controller.bank;
+
+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.modules.bank.bo.QuestionDetailAddBo;
+import com.zhongzheng.modules.bank.bo.QuestionDetailEditBo;
+import com.zhongzheng.modules.bank.bo.QuestionDetailQueryBo;
+import com.zhongzheng.modules.bank.service.IQuestionDetailService;
+import com.zhongzheng.modules.bank.vo.QuestionDetailVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 题目详情Controller
+ *
+ * @author hjl
+ * @date 2021-05-20
+ */
+@Api(value = "题目详情控制器", tags = {"题目详情管理"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/question/detail")
+public class QuestionDetailController extends BaseController {
+
+    private final IQuestionDetailService iQuestionDetailService;
+
+    /**
+     * 查询题目详情列表
+     */
+    @ApiOperation("查询题目详情列表")
+    @GetMapping("/list")
+    public TableDataInfo<QuestionDetailVo> list(QuestionDetailQueryBo bo) {
+        startPage();
+        List<QuestionDetailVo> list = iQuestionDetailService.queryList(bo);
+        return getDataTable(list);
+    }
+
+
+
+    /**
+     * 获取题目详情详细信息
+     */
+    @ApiOperation("获取题目详情详细信息")
+    @GetMapping("/{questionDetailId}")
+    public AjaxResult<QuestionDetailVo> getInfo(@PathVariable("questionDetailId" ) Long questionDetailId) {
+        return AjaxResult.success(iQuestionDetailService.queryById(questionDetailId));
+    }
+
+}

+ 15 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserController.java

@@ -22,7 +22,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 客户端用户Controller
@@ -55,4 +57,17 @@ public class UserController extends BaseController {
         return toAjax(iUserService.updateByEditBo(bo) ? 1 : 0);
     }
 
+    /**
+     * 收藏数等数据
+     */
+    @ApiOperation("收藏数等数据")
+    @GetMapping("/infoAttached")
+    public AjaxResult infoAttached() {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        int collectTotal = iUserService.getCollectTotal(loginUser.getUser().getUserId());
+        Map<String,Object> map = new HashMap<>();
+        map.put("collectTotal",collectTotal);
+        return AjaxResult.success(map);
+    }
+
 }

+ 18 - 1
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -9,7 +9,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.collect.domain.CollectBank;
+import com.zhongzheng.modules.collect.domain.CollectCourse;
+import com.zhongzheng.modules.collect.domain.CollectNote;
+import com.zhongzheng.modules.collect.mapper.CollectBankMapper;
 import com.zhongzheng.modules.collect.mapper.CollectCourseMapper;
+import com.zhongzheng.modules.collect.mapper.CollectNoteMapper;
 import com.zhongzheng.modules.user.bo.UserAddBo;
 import com.zhongzheng.modules.user.bo.UserEditBo;
 import com.zhongzheng.modules.user.bo.UserQueryBo;
@@ -37,6 +42,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     @Autowired
     private CollectCourseMapper collectCourseMapper;
 
+    @Autowired
+    private CollectBankMapper collectBankMapper;
+
+    @Autowired
+    private CollectNoteMapper collectNoteMapper;
+
 
 
 
@@ -142,6 +153,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
 
     @Override
     public Integer getCollectTotal(Long userId) {
-        return null;
+        Integer collectCourse = collectCourseMapper.selectCount(new LambdaQueryWrapper<CollectCourse>()
+                .eq(CollectCourse::getUserId,userId));
+        Integer collectBank = collectBankMapper.selectCount(new LambdaQueryWrapper<CollectBank>()
+                .eq(CollectBank::getUserId,userId));
+        Integer collectNote = collectNoteMapper.selectCount(new LambdaQueryWrapper<CollectNote>()
+                .eq(CollectNote::getUserId,userId));
+        return collectCourse+collectBank+collectNote;
     }
 }