yangdamao 2 年 前
コミット
4f8aa83ce1

+ 13 - 4
zhongzheng-api/src/main/java/com/zhongzheng/controller/course/CourseController.java

@@ -16,10 +16,7 @@ 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.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -90,6 +87,18 @@ public class CourseController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 查询用户是否拥有(山东题库)
+     */
+    @ApiOperation("查询用户是否拥有(山东题库)")
+    @GetMapping("/special/question/count")
+    public AjaxResult<Long> getSpecialQuestionCount(SpecialQuestionBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        Long num = iCourseService.getSpecialQuestionCount(bo);
+        return AjaxResult.success(num);
+    }
+
     @ApiOperation("查询用户拥有的讲义商品")
     @GetMapping("/goodsHandoutsList")
     public TableDataInfo<GoodsUserVo> goodsHandoutsList(CourseQueryBo bo) {

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseMapper.java

@@ -70,4 +70,7 @@ public interface CourseMapper extends BaseMapper<Course> {
     Long getCourseByTenantTwo(@Param("courseName") String courseName,@Param("code") String code,@Param("tenantId") Long tenantId);
 
     List<SpecialQuestionVo> getSpecialQuestionList(SpecialQuestionBo bo);
+
+    Long getSpecialQuestionCount(SpecialQuestionBo bo);
+
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseService.java

@@ -104,4 +104,6 @@ public interface ICourseService extends IService<Course> {
 
     List<SpecialQuestionVo> getSpecialQuestionList(SpecialQuestionBo bo);
 
+    Long getSpecialQuestionCount(SpecialQuestionBo bo);
+
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseServiceImpl.java

@@ -792,6 +792,11 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
         return specialQuestionList;
     }
 
+    @Override
+    public Long getSpecialQuestionCount(SpecialQuestionBo bo) {
+        return baseMapper.getSpecialQuestionCount(bo);
+    }
+
     private Long liveTime(Long nowTime, Integer day) {
         for (Integer i = 0; i < day; i++) {
             Long dayAfter = DateUtils.getDayAfter(nowTime, 1);

+ 22 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMapper.xml

@@ -933,4 +933,26 @@
                 AND g.question_merchant_id = #{questionMerchantId}
             </if>
     </select>
+
+    <select id="getSpecialQuestionCount" parameterType="com.zhongzheng.modules.order.bo.SpecialQuestionBo" resultType="java.lang.Long">
+        SELECT
+            count(distinct g.goods_id)
+        FROM
+        `order` o
+        LEFT JOIN order_goods og ON og.order_sn = o.order_sn
+        LEFT JOIN goods g ON og.goods_id = g.goods_id
+        LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
+        LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
+        LEFT JOIN course_business cb ON g.business_id = cb.id
+        LEFT JOIN question_merchant qm ON g.question_merchant_id = qm.merchant_id
+        WHERE
+        o.`status` = 1
+        AND og.refund_status != 2
+        AND og.pay_status IN ( 2, 3, 4 )
+        AND g.goods_type = 9
+        AND o.user_id = #{userId}
+        <if test="questionMerchantId != null and questionMerchantId != ''">
+            AND g.question_merchant_id = #{questionMerchantId}
+        </if>
+    </select>
 </mapper>