he2802 1 năm trước cách đây
mục cha
commit
9b8629ec90
16 tập tin đã thay đổi với 329 bổ sung137 xóa
  1. 2 3
      zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/financial/TopDivideLogController.java
  2. 8 0
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/user/DangAnController.java
  3. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionChapterExamMapper.java
  4. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionChapterExamService.java
  5. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionChapterExamServiceImpl.java
  6. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsAttachedMapper.java
  7. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsAttachedService.java
  8. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsAttachedServiceImpl.java
  9. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IClassGradeUserService.java
  10. 121 4
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java
  11. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/UserPeriodExportV2Vo.java
  12. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/domain/UserExamRecord.java
  13. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserExamRecordServiceImpl.java
  14. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserExamRecordVo.java
  15. 16 1
      zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionChapterExamMapper.xml
  16. 154 129
      zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsAttachedMapper.xml

+ 2 - 3
zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/financial/TopDivideLogController.java

@@ -127,10 +127,9 @@ public class TopDivideLogController extends BaseController {
     @ApiOperation("查询月份订单列表")
     @PreAuthorize("@ss.hasPermi('system:log:list')")
     @GetMapping("/monthOrderList")
-    public TableDataInfo<TopDivideOrderVo> getMonthOrderList(TopDivideOrderQueryBo bo) {
-        startPage();
+    public AjaxResult<List<TopDivideOrderVo>> getMonthOrderList(TopDivideOrderQueryBo bo) {
         List<TopDivideOrderVo> list = iTopDivideOrderService.getMonthOrderList(bo);
-        return getDataTable(list);
+        return AjaxResult.success(list);
     }
 
     @ApiOperation("查询月份订单统计")

+ 8 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/user/DangAnController.java

@@ -142,4 +142,12 @@ public class DangAnController extends BaseController {
         return getDataTable(list);
     }
 
+    @ApiOperation("查询学员题库学习记录列表")
+    @PreAuthorize("@ss.hasPermi('grade:user:list')")
+    @GetMapping("/listUserStudyExamRecord")
+    public TableDataInfo<UserPeriodExportV2Vo> listUserStudyExamRecord(ClassGradeUserQueryBo bo) {
+        startPage();
+        List<UserPeriodExportV2Vo> list = iClassGradeUserService.listUserStudyQuestionRecordV2Week(bo);
+        return getDataTable(list);
+    }
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionChapterExamMapper.java

@@ -24,4 +24,6 @@ public interface QuestionChapterExamMapper extends BaseMapper<QuestionChapterExa
 
     @InterceptorIgnore(tenantLine = "true")
     void deleteByIdAndTenant(@Param("newChapterExamId") Long newChapterExamId,@Param("newTenantId") Long newTenantId);
+
+    List<ExamVo> getSimpleList(QuestionChapterExamQueryBo bo);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionChapterExamService.java

@@ -29,6 +29,8 @@ public interface IQuestionChapterExamService extends IService<QuestionChapterExa
 
 	List<ExamVo> getDoList(QuestionChapterExamQueryBo bo);
 
+	List<ExamVo> getSimpleList(QuestionChapterExamQueryBo bo);
+
 	/**
 	 * 查询列表
 	 */

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionChapterExamServiceImpl.java

@@ -52,6 +52,11 @@ public class QuestionChapterExamServiceImpl extends ServiceImpl<QuestionChapterE
         return questionChapterExamMapper.getDoList(bo);
     }
 
+    @Override
+    public List<ExamVo> getSimpleList(QuestionChapterExamQueryBo bo) {
+        return this.baseMapper.getSimpleList(bo);
+    }
+
     @Override
     public List<QuestionChapterExamVo> queryList(QuestionChapterExamQueryBo bo) {
         LambdaQueryWrapper<QuestionChapterExam> lqw = Wrappers.lambdaQuery();

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsAttachedMapper.java

@@ -26,4 +26,6 @@ public interface GoodsAttachedMapper extends BaseMapper<GoodsAttached> {
 
     @InterceptorIgnore(tenantLine = "true")
     void deleteByIdTenant(@Param("newGoodsId") Long newGoodsId,@Param("newTenantId") Long newTenantId);
+
+    List<GoodsAttachedVo> getTopList(GoodsAttachedQueryBo bo);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsAttachedService.java

@@ -32,6 +32,8 @@ public interface IGoodsAttachedService extends IService<GoodsAttached> {
 
 	List<GoodsAttachedVo> getList(GoodsAttachedQueryBo bo);
 
+	List<GoodsAttachedVo> getTopList(GoodsAttachedQueryBo bo);
+
 	/**
 	 * 根据新增业务对象插入商品附加产品
 	 * @param bo 商品附加产品新增业务对象

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsAttachedServiceImpl.java

@@ -76,6 +76,11 @@ public class GoodsAttachedServiceImpl extends ServiceImpl<GoodsAttachedMapper, G
         return list;
     }
 
+    @Override
+    public List<GoodsAttachedVo> getTopList(GoodsAttachedQueryBo bo) {
+        return this.baseMapper.getTopList(bo);
+    }
+
     /**
     * 实体类转化成视图对象
     *

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IClassGradeUserService.java

@@ -105,6 +105,8 @@ public interface IClassGradeUserService extends IService<ClassGradeUser> {
 
 	List<UserPeriodExportV2Vo> listUserStudyRecordV2Week(ClassGradeUserQueryBo bo);
 
+	List<UserPeriodExportV2Vo> listUserStudyQuestionRecordV2Week(ClassGradeUserQueryBo bo);
+
     List<ClassPeriodUserVo> listPeriod(ClassGradeUserQueryBo bo);
 
 	List<ClassPeriodVo> listPeriodAudit(ClassGradeUserQueryBo bo);

+ 121 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -26,6 +26,12 @@ import com.zhongzheng.common.utils.ToolsUtils;
 import com.zhongzheng.common.utils.file.FileUtils;
 import com.zhongzheng.common.utils.http.HttpUtils;
 import com.zhongzheng.modules.alioss.service.OssService;
+import com.zhongzheng.modules.bank.bo.QuestionChapterExamQueryBo;
+import com.zhongzheng.modules.bank.bo.QuestionModuleChapterQueryBo;
+import com.zhongzheng.modules.bank.service.IQuestionChapterExamService;
+import com.zhongzheng.modules.bank.service.IQuestionModuleChapterService;
+import com.zhongzheng.modules.bank.vo.ExamVo;
+import com.zhongzheng.modules.bank.vo.QuestionChapterVo;
 import com.zhongzheng.modules.base.service.IUserProfileService;
 import com.zhongzheng.modules.course.bo.CourseBusinessQueryBo;
 import com.zhongzheng.modules.course.bo.CourseProjectTypeQueryBo;
@@ -35,8 +41,11 @@ import com.zhongzheng.modules.course.vo.CourseBusinessVo;
 import com.zhongzheng.modules.course.vo.CourseChapterVo;
 import com.zhongzheng.modules.course.vo.CourseModuleVo;
 import com.zhongzheng.modules.course.vo.CourseProjectTypeVo;
+import com.zhongzheng.modules.goods.bo.GoodsAttachedQueryBo;
 import com.zhongzheng.modules.goods.domain.Goods;
+import com.zhongzheng.modules.goods.service.IGoodsAttachedService;
 import com.zhongzheng.modules.goods.service.IGoodsService;
+import com.zhongzheng.modules.goods.vo.GoodsAttachedVo;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.bo.*;
 import com.zhongzheng.modules.grade.domain.ClassGrade;
@@ -62,10 +71,7 @@ import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.domain.User;
 import com.zhongzheng.modules.user.domain.UserStudyRecordPhoto;
 import com.zhongzheng.modules.user.mapper.UserStudyRecordPhotoMapper;
-import com.zhongzheng.modules.user.service.IUserBankRecordService;
-import com.zhongzheng.modules.user.service.IUserService;
-import com.zhongzheng.modules.user.service.IUserStudyRecordPhotoService;
-import com.zhongzheng.modules.user.service.IUserStudyRecordService;
+import com.zhongzheng.modules.user.service.*;
 import com.zhongzheng.modules.user.vo.*;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -162,6 +168,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
     @Autowired
     private ISysConfigService configService;
 
+    @Autowired
+    private IUserExamRecordService iUserExamRecordService;
+
     @Value("${aliyun.oss.endpoint}")
     private String ALIYUN_OSS_ENDPOINT;
 
@@ -198,6 +207,15 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
     @Autowired
     private IMajorService iMajorService;
 
+    @Autowired
+    private IGoodsAttachedService iGoodsAttachedService;
+
+    @Autowired
+    private IQuestionModuleChapterService iQuestionModuleChapterService;
+
+    @Autowired
+    private IQuestionChapterExamService iQuestionChapterExamService;
+
 
     private String SEVEN_OFFICIALPUSH_INFOACCOUNT;
     private String SEVEN_OFFICIALPUSH_TOKEN;
@@ -1691,6 +1709,28 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         return userPeriodExportVo;
     }
 
+    private UserPeriodExportV2Vo mergeQuestionEamDataV2(Long index, String moduleName, String chapterName, String examName, UserExamRecordQueryBo recordQueryBo) {
+        //试卷学习记录
+        List<UserExamRecordVo> recordList = iUserExamRecordService.queryList(recordQueryBo);
+        //录入学时记录
+        UserPeriodExportV2Vo userPeriodExportVo = new UserPeriodExportV2Vo();
+        userPeriodExportVo.setId(index);
+        userPeriodExportVo.setExamName(examName);
+        List<UserPeriodItemExportVo> studyList = new ArrayList<>();
+        for (UserExamRecordVo vo : recordList) {
+            UserPeriodItemExportVo exportVo = new UserPeriodItemExportVo();
+            exportVo.setStudyStartTime(vo.getCreateTime());
+            exportVo.setStudyEndTime(vo.getCommitTime());
+            exportVo.setSectionType(4);
+            exportVo.setStatus(vo.getReportStatus());
+            exportVo.setScore(vo.getPerformance());
+            exportVo.setFromPlat(vo.getFromPlat());
+            studyList.add(exportVo);
+        }
+        userPeriodExportVo.setRecordList(studyList);
+        return userPeriodExportVo;
+    }
+
     private UserPeriodExportV2Vo mergeDataV2(Long index, String moduleName, String chapterName, String sectionName, ClassPeriodSectionVo classPeriodSectionVo, UserStudyRecordQueryBo recordQueryBo) {
         //节学习记录
         List<SectionStudyRecordVo> recordList = iUserStudyRecordService.selectSectionRecord(recordQueryBo);
@@ -2840,6 +2880,83 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         return studyList;
     }
 
+    @Override
+    public List<UserPeriodExportV2Vo> listUserStudyQuestionRecordV2Week(ClassGradeUserQueryBo bo) {
+        if(Validator.isEmpty(bo.getOrderGoodsId())){
+            throw new CustomException("orderGoodsId缺失");
+        }
+        GoodsAttachedQueryBo attachedQueryBo = new GoodsAttachedQueryBo();
+        attachedQueryBo.setGoodsId(bo.getGoodsId());
+        List<GoodsAttachedVo> topList = iGoodsAttachedService.getTopList(attachedQueryBo);
+        String moduleName = "";
+        String chapterName = "";
+        String examName = "";
+        List<UserPeriodExportV2Vo> studyList = new ArrayList<>();
+        long i = 0;
+        Long gradeId = bo.getGradeId();
+        Long userId = bo.getUserId();
+        Long goodsId = bo.getGoodsId();
+        Long courseId = bo.getCourseId();
+        Long orderGoodsId = bo.getOrderGoodsId();
+        for (GoodsAttachedVo classPeriodVo : topList) {
+            moduleName = "";
+            chapterName = "";
+            examName = "";
+            if (classPeriodVo.getType() == 1) {
+                moduleName = classPeriodVo.getName();
+                QuestionModuleChapterQueryBo moduleChapterQueryBo = new QuestionModuleChapterQueryBo();
+                moduleChapterQueryBo.setModuleExamId(classPeriodVo.getMajorId());
+                List<QuestionChapterVo> chapterList= iQuestionModuleChapterService.getList(moduleChapterQueryBo);
+                for (QuestionChapterVo chapterVo : chapterList) {
+                    chapterName = chapterVo.getName();
+                    QuestionChapterExamQueryBo chapterExamQueryBo = new QuestionChapterExamQueryBo();
+                    chapterExamQueryBo.setChapterExamId(chapterVo.getChapterExamId());
+                    List<ExamVo> examVoList = iQuestionChapterExamService.getSimpleList(chapterExamQueryBo);
+                    for (ExamVo examVo : examVoList) {
+                        examName = examVo.getExamName();
+                        i++;
+                        UserExamRecordQueryBo recordQueryBo = new UserExamRecordQueryBo();
+                        recordQueryBo.setExamId(examVo.getExamId());
+                        recordQueryBo.setModuleExamId(classPeriodVo.getMajorId());
+                        recordQueryBo.setChapterExamId(chapterVo.getChapterExamId());
+                        recordQueryBo.setUserId(userId);
+                        recordQueryBo.setOrderGoodsId(orderGoodsId);
+                        studyList.add(mergeQuestionEamDataV2(i, moduleName, chapterName, examName,  recordQueryBo));
+                    }
+                }
+            }
+            else if (classPeriodVo.getType() == 2) {
+                chapterName = classPeriodVo.getName();
+                QuestionChapterExamQueryBo chapterExamQueryBo = new QuestionChapterExamQueryBo();
+                chapterExamQueryBo.setChapterExamId(classPeriodVo.getMajorId());
+                List<ExamVo> examVoList = iQuestionChapterExamService.getSimpleList(chapterExamQueryBo);
+                for (ExamVo examVo : examVoList) {
+                    examName = examVo.getExamName();
+                    i++;
+                    UserExamRecordQueryBo recordQueryBo = new UserExamRecordQueryBo();
+                    recordQueryBo.setExamId(examVo.getExamId());
+                    recordQueryBo.setModuleExamId(0L);
+                    recordQueryBo.setChapterExamId(classPeriodVo.getMajorId());
+                    recordQueryBo.setUserId(userId);
+                    recordQueryBo.setOrderGoodsId(orderGoodsId);
+                    studyList.add(mergeQuestionEamDataV2(i, moduleName, chapterName, examName,  recordQueryBo));
+                }
+            }
+            else{
+                examName = classPeriodVo.getName();
+                i++;
+                UserExamRecordQueryBo recordQueryBo = new UserExamRecordQueryBo();
+                recordQueryBo.setExamId(classPeriodVo.getMajorId());
+                recordQueryBo.setModuleExamId(0L);
+                recordQueryBo.setChapterExamId(0L);
+                recordQueryBo.setUserId(userId);
+                recordQueryBo.setOrderGoodsId(orderGoodsId);
+                studyList.add(mergeQuestionEamDataV2(i, moduleName, chapterName, examName,  recordQueryBo));
+            }
+        }
+        return studyList;
+    }
+
     @Override
     public List<ClassPeriodUserVo> listPeriod(ClassGradeUserQueryBo bo) {
         if(Validator.isEmpty(bo.getOrderGoodsId())){

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/UserPeriodExportV2Vo.java

@@ -35,6 +35,9 @@ public class UserPeriodExportV2Vo {
 	@Excel(name = "节标题")
 	@ApiModelProperty("节标题")
 	private String sectionName;
+	@Excel(name = "试卷标题")
+	@ApiModelProperty("试卷标题")
+	private String examName;
 	@Excel(name = "学习列表")
 	@ApiModelProperty("学习列表")
 	private List<UserPeriodItemExportVo> recordList;

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/domain/UserExamRecord.java

@@ -82,4 +82,5 @@ private static final long serialVersionUID=1L;
     private Long simulateExamId;
 
     private Integer fromPlat;
+
 }

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserExamRecordServiceImpl.java

@@ -134,6 +134,7 @@ public class UserExamRecordServiceImpl extends ServiceImpl<UserExamRecordMapper,
         lqw.eq(bo.getUserId() != null, UserExamRecord::getUserId, bo.getUserId());
         lqw.eq(bo.getStatus() != null, UserExamRecord::getStatus, bo.getStatus());
         lqw.eq(bo.getGoodsId() != null, UserExamRecord::getGoodsId, bo.getGoodsId());
+        lqw.eq(bo.getOrderGoodsId() != null, UserExamRecord::getOrderGoodsId, bo.getOrderGoodsId());
         lqw.eq(bo.getReportStatus() != null, UserExamRecord::getReportStatus, bo.getReportStatus());
         lqw.eq(bo.getPerformance() != null, UserExamRecord::getPerformance, bo.getPerformance());
         return entity2Vo(this.list(lqw));

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserExamRecordVo.java

@@ -69,6 +69,9 @@ public class UserExamRecordVo {
 	/** 更新时间 */
 	@ApiModelProperty("更新时间")
 	private Long updateTime;
+
+	@ApiModelProperty("创建时间")
+	private Long createTime;
 	@Excel(name = "试卷总题数")
 	@ApiModelProperty("试卷总题数")
 	private Long totalQuestionNum;

+ 16 - 1
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionChapterExamMapper.xml

@@ -123,8 +123,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             qce.chapter_exam_id =#{chapterExamId}
           AND e.status = 1 AND  e.exam_id IN ( SELECT exam_id FROM user_exam_record WHERE user_id = #{userId} AND goods_id = #{goodsId} AND module_exam_id = #{moduleExamId} AND chapter_exam_id = #{chapterExamId} GROUP BY exam_id )
     </select>
-    
+
     <delete id="deleteByIdAndTenant" parameterType="map">
         delete from question_chapter_exam where chapter_exam_id = #{newChapterExamId} and tenant_id = #{newTenantId}
     </delete>
+
+    <select id="getSimpleList" parameterType="com.zhongzheng.modules.bank.bo.QuestionChapterExamQueryBo" resultMap="QuestionChapterExamResultVo">
+        SELECT
+        e.*,
+        qce.sort AS exam_sort,
+        3 as type
+        FROM
+        question_chapter_exam qce
+        LEFT JOIN  exam e ON qce.exam_id = e.exam_id
+
+        WHERE
+        qce.chapter_exam_id =#{chapterExamId}
+        AND e.status = 1
+        order by qce.sort asc
+    </select>
 </mapper>

+ 154 - 129
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsAttachedMapper.xml

@@ -42,166 +42,191 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="simulateStatus" column="simulate_status"/>
     </resultMap>
 
-    <select id="getList" parameterType="com.zhongzheng.modules.goods.bo.GoodsAttachedQueryBo" resultMap="GoodsAttachedResultVo">
+	<select id="getList" parameterType="com.zhongzheng.modules.goods.bo.GoodsAttachedQueryBo" resultMap="GoodsAttachedResultVo">
 		SELECT
-		    g.external_link,
-		    g.external_link_status,
-			ga.*,
-			CASE
+		g.external_link,
+		g.external_link_status,
+		ga.*,
+		CASE
+
+		WHEN ga.type = 1 THEN
+		0
+		WHEN ga.type = 2 THEN
+		0
+		WHEN ga.type = 3 THEN
+		e.do_type
+		END do_type,
+		CASE
+
+		WHEN ga.type = 1 THEN
+		-1
+		WHEN ga.type = 2 THEN
+		-1
+		WHEN ga.type = 3 THEN
+		e.simulate_status
+		END simulate_status,
+		CASE
 
+		WHEN ga.type = 1 THEN
+		qm.module_name
+		WHEN ga.type = 2 THEN
+		qc.`name`
+		WHEN ga.type = 3 THEN
+		e.exam_name
+		END NAME,
+		CASE
+
+		WHEN ga.type = 1 THEN
+		cs.subject_name
+		WHEN ga.type = 2 THEN
+		cs1.subject_name
+		WHEN ga.type = 3 THEN
+		cs2.subject_name
+		END subject_name,
+		CASE
+
+		WHEN ga.type = 1 THEN
+		0
+		WHEN ga.type = 2 THEN
+		0
+		WHEN ga.type = 3 THEN
+		e.question_num
+		END question_num,
+		CASE
+		WHEN ga.type = 1 THEN
+		qm.publish_status
+		WHEN ga.type = 2 THEN
+		qc.publish_status
+		WHEN ga.type = 3 THEN
+		e.publish_status
+		END publish_status,
+		CASE
+		WHEN ga.type = 1 THEN
+		qm.`code`
+		WHEN ga.type = 2 THEN
+		qc.`code`
+		WHEN ga.type = 3 THEN
+		e.`code`
+		END code,
+		CASE
+		WHEN ga.type = 1 THEN
+		''
+		WHEN ga.type = 2 THEN
+		''
+		WHEN ga.type = 3 THEN
+		e.paper_name
+		END paper_name
+		<if test="userId != null ">
+			,
+			CASE
 			WHEN ga.type = 1 THEN
-			0
+			-1
 			WHEN ga.type = 2 THEN
-			0
+			-1
 			WHEN ga.type = 3 THEN
-			e.do_type
-			END do_type,
+			ifnull( (select `status` from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and ga.goods_id =uer.goods_id  ORDER BY uer.record_id desc limit 1),-1)
+			END record_status
+			,
 			CASE
-
 			WHEN ga.type = 1 THEN
 			-1
 			WHEN ga.type = 2 THEN
 			-1
 			WHEN ga.type = 3 THEN
-			e.simulate_status
-			END simulate_status,
+			ifnull( (select record_id from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and ga.goods_id =uer.goods_id ORDER BY uer.record_id desc limit 1),-1)
+			END record_id
+			,
 			CASE
-
-				WHEN ga.type = 1 THEN
-					qm.module_name
-				WHEN ga.type = 2 THEN
-					qc.`name`
-				WHEN ga.type = 3 THEN
-					e.exam_name
-				END NAME,
-			CASE
-
-				WHEN ga.type = 1 THEN
-					cs.subject_name
-				WHEN ga.type = 2 THEN
-					cs1.subject_name
-				WHEN ga.type = 3 THEN
-					cs2.subject_name
-				END subject_name,
-			CASE
-
-				WHEN ga.type = 1 THEN
-					0
-				WHEN ga.type = 2 THEN
-					0
-				WHEN ga.type = 3 THEN
-					e.question_num
-				END question_num,
+			WHEN ga.type = 1 THEN
+			-1
+			WHEN ga.type = 2 THEN
+			-1
+			WHEN ga.type = 3 THEN
+			e.answer_num
+			END answer_num
+			,
 			CASE
-				WHEN ga.type = 1 THEN
-					qm.publish_status
-				WHEN ga.type = 2 THEN
-					qc.publish_status
-				WHEN ga.type = 3 THEN
-					e.publish_status
-				END publish_status,
+			WHEN ga.type = 1 THEN
+			-1
+			WHEN ga.type = 2 THEN
+			-1
+			WHEN ga.type = 3 THEN
+			(select count(*) from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and ga.goods_id =uer.goods_id )
+			END do_num
+			,
 			CASE
 			WHEN ga.type = 1 THEN
-			qm.`code`
+			-1
 			WHEN ga.type = 2 THEN
-			qc.`code`
+			-1
 			WHEN ga.type = 3 THEN
-			e.`code`
-			END code,
+			(select do_question_num from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and uer.chapter_exam_id = 0 and uer.module_exam_id = 0 ORDER BY uer.record_id desc limit 1)
+			END do_question_num
+			,
 			CASE
 			WHEN ga.type = 1 THEN
-			''
+			-1
 			WHEN ga.type = 2 THEN
-			''
+			-1
 			WHEN ga.type = 3 THEN
-			e.paper_name
-			END paper_name
-			<if test="userId != null ">
-				,
-				CASE
-				WHEN ga.type = 1 THEN
-				-1
-				WHEN ga.type = 2 THEN
-				-1
-				WHEN ga.type = 3 THEN
-				ifnull( (select `status` from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and ga.goods_id =uer.goods_id  ORDER BY uer.record_id desc limit 1),-1)
-				END record_status
-				,
-				CASE
-				WHEN ga.type = 1 THEN
-				-1
-				WHEN ga.type = 2 THEN
-				-1
-				WHEN ga.type = 3 THEN
-				ifnull( (select record_id from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and ga.goods_id =uer.goods_id ORDER BY uer.record_id desc limit 1),-1)
-				END record_id
-				,
-				CASE
-				WHEN ga.type = 1 THEN
-				-1
-				WHEN ga.type = 2 THEN
-				-1
-				WHEN ga.type = 3 THEN
-				e.answer_num
-				END answer_num
-				,
-				CASE
-				WHEN ga.type = 1 THEN
-				-1
-				WHEN ga.type = 2 THEN
-				-1
-				WHEN ga.type = 3 THEN
-				(select count(*) from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and ga.goods_id =uer.goods_id )
-				END do_num
-				,
-				CASE
-				WHEN ga.type = 1 THEN
-				-1
-				WHEN ga.type = 2 THEN
-				-1
-				WHEN ga.type = 3 THEN
-				(select do_question_num from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and uer.chapter_exam_id = 0 and uer.module_exam_id = 0 ORDER BY uer.record_id desc limit 1)
-				END do_question_num
-				,
-				CASE
+			(select right_question_num from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and uer.chapter_exam_id = 0 and uer.module_exam_id = 0 ORDER BY uer.record_id desc limit 1)
+			END right_question_num
+		</if>
+		FROM
+		goods_attached ga
+		LEFT JOIN goods g ON ga.goods_id = g.goods_id
+		LEFT JOIN question_module qm ON ga.major_id = qm.module_exam_id
+		AND ga.type = 1
+		LEFT JOIN question_business qb ON qb.major_id = qm.module_exam_id
+		AND qb.type = 4
+		LEFT JOIN course_subject cs ON qb.subject_id = cs.id
+		LEFT JOIN question_chapter qc ON ga.major_id = qc.chapter_exam_id
+		AND ga.type = 2
+		LEFT JOIN question_business qb1 ON qb1.major_id = qc.chapter_exam_id
+		AND qb1.type = 3
+		LEFT JOIN course_subject cs1 ON qb1.subject_id = cs1.id
+		LEFT JOIN (
+		SELECT
+		e.*,
+		count( eq.question_id ) question_num,
+		ep.paper_name
+		FROM
+		exam e
+		LEFT JOIN exam_question eq ON e.exam_id = eq.exam_id
+		LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id
+		GROUP BY
+		e.exam_id
+		) e ON ga.major_id = e.exam_id
+		AND ga.type = 3
+		AND e.STATUS = 1
+		LEFT JOIN question_business qb2 ON qb2.major_id = e.exam_id
+		AND qb2.type = 2
+		LEFT JOIN course_subject cs2 ON qb2.subject_id = cs2.id
+		WHERE
+		ga.goods_id = #{goodsId}
+		order by ga.sort,ga.id  asc
+	</select>
+
+    <select id="getTopList" parameterType="com.zhongzheng.modules.goods.bo.GoodsAttachedQueryBo" resultMap="GoodsAttachedResultVo">
+		SELECT
+			ga.*,
+			CASE
+
 				WHEN ga.type = 1 THEN
-				-1
+					qm.module_name
 				WHEN ga.type = 2 THEN
-				-1
+					qc.`name`
 				WHEN ga.type = 3 THEN
-				(select right_question_num from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and uer.chapter_exam_id = 0 and uer.module_exam_id = 0 ORDER BY uer.record_id desc limit 1)
-				END right_question_num
-			</if>
+					e.exam_name
+				END NAME
 		FROM
 			goods_attached ga
-				LEFT JOIN goods g ON ga.goods_id = g.goods_id
 				LEFT JOIN question_module qm ON ga.major_id = qm.module_exam_id
 				AND ga.type = 1
-				LEFT JOIN question_business qb ON qb.major_id = qm.module_exam_id
-				AND qb.type = 4
-				LEFT JOIN course_subject cs ON qb.subject_id = cs.id
 				LEFT JOIN question_chapter qc ON ga.major_id = qc.chapter_exam_id
 				AND ga.type = 2
-				LEFT JOIN question_business qb1 ON qb1.major_id = qc.chapter_exam_id
-				AND qb1.type = 3
-				LEFT JOIN course_subject cs1 ON qb1.subject_id = cs1.id
-				LEFT JOIN (
-				SELECT
-					e.*,
-					count( eq.question_id ) question_num,
-					ep.paper_name
-				FROM
-					exam e
-						LEFT JOIN exam_question eq ON e.exam_id = eq.exam_id
-						LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id
-				GROUP BY
-					e.exam_id
-			) e ON ga.major_id = e.exam_id
+				LEFT JOIN exam e ON ga.major_id = e.exam_id
 				AND ga.type = 3
-				AND e.STATUS = 1
-				LEFT JOIN question_business qb2 ON qb2.major_id = e.exam_id
-				AND qb2.type = 2
-				LEFT JOIN course_subject cs2 ON qb2.subject_id = cs2.id
 		WHERE
 			ga.goods_id = #{goodsId}
 		order by ga.sort,ga.id  asc