Kaynağa Gözat

资讯和视频接口移植

mingfu 1 ay önce
ebeveyn
işleme
cb0d160182
23 değiştirilmiş dosya ile 2774 ekleme ve 0 silme
  1. 163 0
      ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontNewsController.java
  2. 258 0
      ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontVideoCourseController.java
  3. 269 0
      ie-system/src/main/java/com/ruoyi/dezhi/domain/BBusiDezhiVideo.java
  4. 83 0
      ie-system/src/main/java/com/ruoyi/dezhi/mapper/BBusiDezhiVideoMapper.java
  5. 82 0
      ie-system/src/main/java/com/ruoyi/dezhi/service/IBBusiDezhiVideoService.java
  6. 135 0
      ie-system/src/main/java/com/ruoyi/dezhi/service/impl/BBusiDezhiVideoServiceImpl.java
  7. 139 0
      ie-system/src/main/java/com/ruoyi/mingxue/domain/CustomerFavorites.java
  8. 199 0
      ie-system/src/main/java/com/ruoyi/mingxue/domain/CustomerVideoWatches.java
  9. 85 0
      ie-system/src/main/java/com/ruoyi/mingxue/domain/QuestionCollection.java
  10. 60 0
      ie-system/src/main/java/com/ruoyi/mingxue/dto/AppQuestionCollectionResDto.java
  11. 64 0
      ie-system/src/main/java/com/ruoyi/mingxue/mapper/CustomerFavoritesMapper.java
  12. 75 0
      ie-system/src/main/java/com/ruoyi/mingxue/mapper/CustomerVideoWatchesMapper.java
  13. 70 0
      ie-system/src/main/java/com/ruoyi/mingxue/mapper/QuestionCollectionMapper.java
  14. 64 0
      ie-system/src/main/java/com/ruoyi/mingxue/service/ICustomerFavoritesService.java
  15. 75 0
      ie-system/src/main/java/com/ruoyi/mingxue/service/ICustomerVideoWatchesService.java
  16. 70 0
      ie-system/src/main/java/com/ruoyi/mingxue/service/IQuestionCollectionService.java
  17. 108 0
      ie-system/src/main/java/com/ruoyi/mingxue/service/impl/CustomerFavoritesServiceImpl.java
  18. 149 0
      ie-system/src/main/java/com/ruoyi/mingxue/service/impl/CustomerVideoWatchesServiceImpl.java
  19. 120 0
      ie-system/src/main/java/com/ruoyi/mingxue/service/impl/QuestionCollectionServiceImpl.java
  20. 164 0
      ie-system/src/main/resources/mapper/dezhi/BBusiDezhiVideoMapper.xml
  21. 99 0
      ie-system/src/main/resources/mapper/mingxue/CustomerFavoritesMapper.xml
  22. 145 0
      ie-system/src/main/resources/mapper/mingxue/CustomerVideoWatchesMapper.xml
  23. 98 0
      ie-system/src/main/resources/mapper/mingxue/QuestionCollectionMapper.xml

+ 163 - 0
ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontNewsController.java

@@ -0,0 +1,163 @@
+package com.ruoyi.web.controller.front;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysDictData;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.system.service.ISysConfigService;
+import com.ruoyi.system.service.ISysDictDataService;
+import com.ruoyi.syzy.domain.BWwwNews;
+import com.ruoyi.syzy.domain.BWwwNewsRef;
+import com.ruoyi.syzy.service.IBWwwNewsRefService;
+import com.ruoyi.syzy.service.IBWwwNewsService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+@RestController
+@Api(tags = "高考资讯")
+@RequestMapping("front/news/")
+public class FrontNewsController extends BaseController {
+
+    @Autowired
+    private IBWwwNewsService newsService;
+    @Autowired
+    private IBWwwNewsRefService newsRefService;
+
+    @Autowired
+    private ISysDictDataService dictDataService;
+
+    @Autowired
+    private ISysConfigService sysConfigService;
+    @GetMapping("types")
+    @ApiOperation("00 高考资讯类型")
+    public TableDataInfo types() {
+        return getTypes();
+    }
+
+    private TableDataInfo getTypes(){
+        List<SysDictData> arr = dictDataService.selectDictDataByType("news_type");
+        List<JSONObject> list = new ArrayList<JSONObject>(arr.size());
+        arr.forEach(row -> {
+            JSONObject item = new JSONObject(true);
+            item.put("value", row.getDictValue());
+            item.put("label", row.getDictLabel());
+            list.add(item);
+        });
+        return getDataTable(list);
+    }
+
+    @GetMapping("typesNoToken")
+    @ApiOperation("00-1 高考资讯类型")
+    public TableDataInfo typesNoToken() {
+        return getTypes();
+    }
+
+
+    @GetMapping("getMainList")
+    @ApiOperation("00 通关指南")
+    public TableDataInfo getMainList(@ApiParam(value = "省份 ", example = "湖南") @RequestParam(required = false) String location) {
+        BWwwNewsRef cond = new BWwwNewsRef();
+        if(StringUtils.isBlank(location) && StringUtils.isBlank((location = SecurityUtils.getLoginUser().getUser().getLocation()))) {
+            cond.setLocation("湖南");
+        }
+        cond.setLocation(location);
+        return getDataTable(newsRefService.selectBWwwNewsRefList(cond));
+    }
+
+    @GetMapping("getMainListNoToken")
+    @ApiOperation("00 通关指南免登陆")
+    public TableDataInfo getMainListNoToken(@ApiParam(value = "省份 ", example = "湖南") @RequestParam(required = false) String location) {
+        BWwwNewsRef cond = new BWwwNewsRef();
+        cond.setLocation(StringUtils.isNotBlank(location) ? location : "湖南");
+        return getDataTable(newsRefService.selectBWwwNewsRefList(cond));
+    }
+
+    @GetMapping("getMainCourseDateNoToken")
+    @ApiOperation("00 考试日程免登陆")
+    public TableDataInfo getMainCourseDateNoToken() {
+        return getMainCourseDate();
+    }
+
+    @GetMapping("getMainCourseDate")
+    @ApiOperation("00 考试日程")
+    public TableDataInfo getMainCourseDate() {
+        String arrString = sysConfigService.selectConfigByKey("main.course.date");
+        if (StringUtils.isBlank(arrString)){
+            arrString= "[ { \"title\":  \"高考报名\", \"time\":  \"2023年10月底\", \"fireTime\":  \"2023-10-01\", \"sort\":  1, \"description\":  \"\" }, { \"title\":  \"院校发布招生简章\", \"time\":  \"2024年1月初\", \"fireTime\":  \"2024-02-01\", \"sort\":  2, \"description\":  \"\" }, { \"title\":  \"报考及填报志愿\", \"time\":  \"2月27~3月5日\", \"fireTime\":  \"2024-02-27\", \"sort\":  3, \"description\":  \"登录湖南省普通高校招生考试考生综合信息平台或潇湘高考APP,可填报1-2所院校\" }, { \"title\":  \"第一志愿考试\", \"time\":  \"3月16~17日\", \"fireTime\":  \"2024-03-16\", \"sort\":  4, \"description\":  \"\" }, { \"title\":  \"第一志愿录取\", \"time\":  \"3月中下旬\", \"fireTime\":  \"2024-03-16\", \"sort\":  5, \"description\":  \"\" }, { \"title\":  \"第二志愿考试\", \"time\":  \"4月13~14日\", \"fireTime\":  \"2024-04-13\", \"sort\":  6, \"description\":  \"\" }, { \"title\":  \"第二志愿录取\", \"time\":  \"4月中下旬\", \"fireTime\":  \"2024-04-15\", \"sort\":  7, \"description\":  \"\" } ]";
+        }
+        return getDataTable(JSONObject.parseArray(arrString));
+    }
+
+    @GetMapping("list")
+    @ApiOperation("01 资讯列表")
+    public TableDataInfo list(@ApiParam(value = "分类 ", example = "1")  String type,Boolean top,String ids,
+                              @ApiParam(value = "标签", example = "hot")  String tag,String title,
+                              @ApiParam(value = "省份 ", example = "湖南") @RequestParam(required = false) String location,
+                              @ApiParam(value = "页数", example = "1") @RequestParam Integer pageNum,
+                              @ApiParam(value = "页大小", example = "15") @RequestParam Integer pageSize) {
+        if(StringUtils.isBlank(location)) {
+            location = SecurityUtils.getLoginUser().getUser().getLocation();
+        }
+        return llist(ids,top,type,tag,title,location, pageNum,pageSize);
+    }
+
+    private TableDataInfo llist(String ids,Boolean top,String type, String tag,String title,String location, Integer pageNum,Integer pageSize){
+        startPage();
+        BWwwNews exam = new BWwwNews();
+        exam.setIsTop(null==top?null:(top?1:0));
+        exam.setType(type);
+        exam.setTitle(title);
+        exam.setTag(StringUtils.trimToNull(tag));
+        exam.setLocation(StringUtils.isNotBlank(location) ? location : "湖南");
+        if(StringUtils.isNotBlank(ids)){
+            String[] strArray = ids.split(",");
+            List<String> strList = new ArrayList<>(strArray.length);
+            Collections.addAll(strList, strArray);
+            exam.setIds(strList);
+        }
+        List<BWwwNews> arr = newsService.selectBWwwNewsList(exam);
+        return getDataTable(arr);
+    }
+
+    @GetMapping("listNoToken")
+    @ApiOperation("01-2 资讯列表")
+    public TableDataInfo listNoToken(@ApiParam(value = "分类 ", example = "1")  String type,
+                                     @ApiParam(value = "标签", example = "hot")  String tag,String title,
+                                     @ApiParam(value = "省份 ", example = "湖南") @RequestParam(required = false) String location,
+                                     @ApiParam(value = "页数", example = "1") Integer pageNum,
+                                     @ApiParam(value = "页大小", example = "15") Integer pageSize) {
+        return llist(null,null,type,tag,title,location, pageNum,pageSize);
+    }
+
+    @GetMapping("info")
+    @ApiOperation("02 资讯详情")
+    public AjaxResult videoInfo(@ApiParam("课程id") Long id) {
+        saveClicked(id);
+        BWwwNews info = newsService.selectBWwwNewsById(id);
+        return AjaxResult.success(info);
+    }
+
+    //    @GetMapping("saveClicked")
+//    @ApiOperation("03 保存点击数")
+    public AjaxResult saveClicked( Long id) {
+        BWwwNews info = newsService.selectBWwwNewsById(id);
+        Long clicked= null==info.getClicked()?1L:(info.getClicked()+1);
+        info.setClicked(clicked);
+        newsService.updateBWwwNews(info);
+        return AjaxResult.success(clicked);
+    }
+
+}

+ 258 - 0
ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontVideoCourseController.java

@@ -0,0 +1,258 @@
+package com.ruoyi.web.controller.front;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.UserRegStatus;
+import com.ruoyi.common.exception.CustomException;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.dezhi.service.IBBusiDezhiVideoService;
+import com.ruoyi.mingxue.domain.CustomerVideoWatches;
+import com.ruoyi.mingxue.service.ICustomerVideoWatchesService;
+import com.ruoyi.mxjb.domain.MxjbContants;
+import com.ruoyi.system.service.ISysConfigService;
+import com.ruoyi.syzy.domain.BBusiSyghVideo;
+import com.ruoyi.syzy.domain.BWwwNewsVideo;
+import com.ruoyi.syzy.service.IBBusiSyghVideoService;
+import com.ruoyi.syzy.service.IBWwwNewsVideoService;
+import com.ruoyi.util.PageUtil;
+import com.ruoyi.web.service.CommService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.apache.commons.compress.utils.Lists;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+@Api(tags = "视频课程")
+@RestController
+@RequestMapping("front/videoCourse/")
+public class FrontVideoCourseController extends BaseController {
+    @Autowired
+    private ISysConfigService configService;
+    @Autowired
+    private IBWwwNewsVideoService newsVideoService;
+    @Autowired
+    private IBBusiDezhiVideoService videoService;
+    @Autowired
+    private ICustomerVideoWatchesService customerVideoWatchesService;
+    @Autowired
+    private IBBusiSyghVideoService busiSyghVideoService;
+    @Autowired
+    private CommService commService;
+    @ApiOperation("01 视频大类")
+    @GetMapping("subjects")
+    public TableDataInfo subjects(@ApiParam("ie") @RequestParam(required = false) Integer type) {
+        if (null != type && type.equals(1)) {
+            JSONArray arr = new JSONArray();
+            busiSyghVideoService.subjectNames().stream().forEach(t -> {
+                JSONObject d = new JSONObject();
+                d.put("code", t.getSubjectId());
+                d.put("label", t.getSubjectName());
+                arr.add(d);
+            });
+            return getDataTable(arr);
+        }
+        String json = configService.selectConfigByKey("video_subjects");
+        JSONArray arr = JSON.parseArray(json);
+        return getDataTable(arr);
+    }
+
+    @ApiOperation("01 大类知识点")
+    @GetMapping("knowledges")
+    public TableDataInfo knowledges(@ApiParam("大类") @RequestParam Integer subject) {
+        JSONArray arr = new JSONArray();
+        busiSyghVideoService.knowledgeNames(subject).stream().forEach(t -> {
+            JSONObject d = new JSONObject();
+            d.put("code", t.getKnowledgeId());
+            d.put("label", t.getKnowledgeName());
+            arr.add(d);
+        });
+        return getDataTable(arr);
+    }
+
+    @ApiOperation("06 视频列表")
+    @GetMapping("video/list")
+    public TableDataInfo videoList(@ApiParam("大类 ") @RequestParam Integer subject, @ApiParam("知识点") @RequestParam(required = false) Integer knowledge,
+        @ApiParam("科目") @RequestParam(required = false) String course,
+        @ApiParam("年级") @RequestParam(required = false) String grade, @ApiParam("版本") @RequestParam(required = false) String version,
+        @ApiParam("视频包Id") @RequestParam(required = false) String pack, @ApiParam("标题") @RequestParam(required = false) String sectionName,
+        @ApiParam(value = "页数", example = "1") @RequestParam Integer pageNum,
+        @ApiParam(value = "页大小", example = "15") @RequestParam Integer pageSize) {
+        commService.requireVip();
+
+        startPage();
+        if(StringUtils.isBlank(pack)) {
+            BBusiSyghVideo syghVideoCond = new BBusiSyghVideo();
+            syghVideoCond.setSubjectId(subject);
+            syghVideoCond.setKnowledgeId(knowledge);
+            List<BBusiSyghVideo> videoList = busiSyghVideoService.selectBBusiSyghVideoList(syghVideoCond);
+            List<JSONObject> arr = Lists.newArrayList();
+            for (BBusiSyghVideo v : videoList) {
+                JSONObject item = new JSONObject(true);
+                item.put("aliId", v.getAliid());
+                item.put("name", v.getName());
+                item.put("img", v.getPictUrl());
+                item.put("aliIdType", MxjbContants.Ali_Id_sygh);
+                arr.add(item);
+            }
+            return getDataTable(PageUtil.getDtoListWithPageable(videoList, arr));
+        }
+        Map<String, Object> params = new HashMap<>(6);
+        if (StringUtils.isNotBlank(pack)) {
+            params.put("packId", pack);
+        } else {
+            params.put("course", course);
+            params.put("grade", grade);
+            params.put("version", version);
+        }
+        params.put("sectionName", sectionName);
+        List<JSONObject> arr = videoService.selectVideoList(params);
+
+        //是否收藏 TODO MF
+        return getDataTable(arr);
+    }
+
+
+    /**
+     * 没登陆时,取4条固定的(从配置)
+     * 有登陆时,根据初中还是高中,随便取4条
+     * @return
+     * @throws Exception
+     */
+    @ApiOperation("08.1 首页视频列表(未登陆时)")
+    @GetMapping("listForHomepageNoLogin")
+    public TableDataInfo listForHomepageNoLogin() throws Exception {
+        String configValue = configService.selectConfigByKey("video_for_homepage");
+        if (StringUtils.isBlank(configValue)) {
+            return new TableDataInfo();
+        }
+        JSONArray jsonArray = JSONArray.parseArray(configValue);
+        return getDataTable(jsonArray);
+    }
+
+    @ApiOperation("08.2 首页视频列表(已登陆时)")
+    @GetMapping("listForHomepageLogined")
+    public TableDataInfo listForHomepageLogined(@ApiParam(value = "页数", example = "1") @RequestParam Integer pageNum,
+            @ApiParam(value = "页大小", example = "15") @RequestParam Integer pageSize) throws Exception {
+        if (!UserRegStatus.Student.equals(SecurityUtils.getLoginUser().getUser().getRegStatus())) {
+            throw new CustomException("未授权", 401);
+        }
+        List<JSONObject> result= new ArrayList<>();
+
+        Map<String, Object> params = new HashMap<>();
+        //{"total":9,"rows":[{"code":1001,"label":"语文"},{"code":1002,"label":"数学"},{"code":1003,"label":"英语"},{"code":1004,"label":"物理"},{"code":1005,"label":"化学"},{"code":1006,"label":"生物"},{"code":1007,"label":"历史"},{"code":1008,"label":"地理"},{"code":1009,"label":"政治"}],"code":200,"msg":"查询成功"}
+        //仅需显示语文、数学、物理、化学四条即可
+        List<Integer> courses=Arrays.asList(1001,1002,1004,1005);
+        for(int i= 0;i<courses.size();i++){
+            params.put("course",courses.get(i));
+            List<JSONObject> arr = videoService.selectVideoList2(params);
+            if(!CollectionUtils.isEmpty(arr)){
+                result.add(arr.get(new Random().nextInt(courses.size())));
+            }
+        }
+
+        return getDataTable(result);
+    }
+
+    @ApiOperation("保存视频观看记录")
+    @PostMapping("saveWatchRecord")
+    public AjaxResult saveWatchRecord(@ApiParam("type 1 dezhi 2 sygh 3 mxapp 4 question 5 resource") @RequestParam(required = false) Integer type,
+                                      @ApiParam("sectionAliId") @RequestParam("sectionId") String sectionAliId, Long duration, Double percent) {
+        if(null == type) {
+            //TODO 暂不处理,后面6天解决
+//            return AjaxResult.error("aliIdType不能为空");
+        }
+        String customerCode = SecurityUtils.getLoginUser().getUser().getCode();
+        CustomerVideoWatches watches = customerVideoWatchesService.selectTodayBySection(customerCode, type, sectionAliId);
+        if (watches != null) {
+            if (watches.getPercent().compareTo( new BigDecimal(String.valueOf(percent)))==-1) {
+                watches.setDuration(duration);
+                watches.setPercent(new BigDecimal(percent));
+                watches.setTime(new Date());
+                watches.setType(type);
+                customerVideoWatchesService.updateCustomerVideoWatches(watches);
+            }
+        } else {
+            watches = new CustomerVideoWatches();
+            watches.setType(type);
+            watches.setCustomerCode(customerCode);
+            watches.setSectionId(sectionAliId);
+            watches.setDuration(duration);
+            watches.setPercent(new BigDecimal(percent));
+
+            if (type.equals(MxjbContants.Ali_Id_voluntary_course)) { // 11
+                BWwwNewsVideo video = newsVideoService.selectBWwwNewsVideoByAliId(sectionAliId);
+                if (null != video) {
+                    watches.setTitle(video.getTitle());
+                }
+            } else if (type.equals(MxjbContants.Ali_Id_sygh)) { // 2 sygh
+                BBusiSyghVideo cond = new BBusiSyghVideo();
+                cond.setAliid(sectionAliId);
+                List<BBusiSyghVideo> list = busiSyghVideoService.selectBBusiSyghVideoList(cond);
+                if (!CollectionUtils.isEmpty(list)) {
+                    watches.setTitle(list.get(0).getName());
+                }
+            }
+            customerVideoWatchesService.insertCustomerVideoWatches(watches);
+        }
+        return AjaxResult.success();
+    }
+
+    @ApiOperation("9 收藏视频")
+    @PostMapping("video/collectVideoCourse")
+    public AjaxResult collectVideoCourse(@ApiParam("视频ID") @RequestParam(required = true) Long id,@ApiParam("是否收藏 true收藏,false取消收藏") @RequestParam Boolean isCollect) {
+        /*if(isCollect) {
+            BBusiDezhiVideo video = videoService.selectBBusiDezhiVideoById(id);
+            String aliId = video.getSectionAliid();
+            LoginUser loginUser =SecurityUtils.getLoginUser();
+            Long roleId = loginUser.getUser().getCurrentRoleId();
+            if(RoleType.isHeadteacher(roleId)||RoleType.isTeacher(roleId)){
+                //老师时才可收藏视频到个人资源库
+                PersonResources personResources = new PersonResources();
+                personResources.setAliIdType(MxjbContants.Ali_Id_resource_person);
+                personResources.setSchoolId(loginUser.getSchoolId());
+                personResources.setCreateId(loginUser.getUser().getUserId());
+                personResources.setResourcesUrl(aliId);
+                personResources.setVideoId(aliId);
+                personResources.setResourcesName(video.getSectionName());
+                personResources.setSourceId(String.valueOf(video.getId()));//微课视频的ID
+                personResources.setType(1L);//资源类型 1 视频 2 图片 3 word 4 pdf
+                personResources.setCategory("视频课程");
+                //获取科目
+                BBusiDezhiVideoPackage videoPackage = videoPackageService.selectBBusiDezhiVideoPackageByPackId(video.getPackId());
+                if(null!=videoPackage){
+                    //1001对应subjectId中的1
+                    Long subjectId = Long.parseLong(videoPackage.getCourse())-1000;
+                    personResources.setSubjectId(subjectId);
+                }
+                Date now = new Date();
+                personResources.setCreateTime(now);
+                personResources.setUpdateTime(now);
+                personResourcesService.insertPersonResources(personResources);
+            }else {
+                return AjaxResult.error("仅有老师或班主任才能收藏视频");
+            }
+        }else {
+            //取消收藏
+            PersonResources personResources = new PersonResources();
+            personResources.setCreateId(SecurityUtils.getLoginUser().getUser().getUserId());
+            personResources.setSourceId(String.valueOf(id));
+            List<PersonResources> personResourcesList = personResourcesService.selectPersonResourcesList(personResources);
+            List<Long> personResourcesIds = personResourcesList.stream().map(PersonResources::getResourcesId).collect(Collectors.toList());
+            if(!CollectionUtils.isEmpty(personResourcesIds)){
+                personResourcesService.deletePersonResourcesByIds(personResourcesIds.toArray(new Long[personResourcesIds.size()]));
+            }
+        }*/
+        return AjaxResult.success();
+    }
+
+}

+ 269 - 0
ie-system/src/main/java/com/ruoyi/dezhi/domain/BBusiDezhiVideo.java

@@ -0,0 +1,269 @@
+package com.ruoyi.dezhi.domain;
+
+import com.ruoyi.mxjb.domain.MxjbContants;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 视频接口对象 b_busi_dezhi_video
+ * 
+ * @author mingxue
+ * @date 2021-07-22
+ */
+public class BBusiDezhiVideo extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    private Integer aliIdType = MxjbContants.Ali_Id_dezhi;
+
+    /** ID */
+    private Long id;
+
+    /** 包ID */
+    @Excel(name = "包ID")
+    private String packId;
+
+    /** 小节 */
+    @Excel(name = "小节")
+    private String sectionId;
+
+    /** 章节ID */
+    @Excel(name = "章节ID")
+    private String chapterId;
+
+    /** 播放次数 */
+    @Excel(name = "播放次数")
+    private Long plays;
+
+    /** 播放完成次数 */
+    @Excel(name = "播放完成次数")
+    private Long played;
+
+    /** 点击量 */
+    @Excel(name = "点击量")
+    private Long clicked;
+
+    /** 标题 */
+    @Excel(name = "标题")
+    private String sectionName;
+
+    /** 说明 */
+    @Excel(name = "说明")
+    private String sectionIntro;
+
+    /** 章节时间 */
+    @Excel(name = "章节时间")
+    private String sectionTime;
+
+    /** 章节排序 */
+    @Excel(name = "章节排序")
+    private String sectionSort;
+
+    /** 章节老师 */
+    @Excel(name = "章节老师")
+    private String sectionTearcher;
+
+    /** 章节url */
+    @Excel(name = "章节url")
+    private String sectionImaurl;
+
+    /** 视频地址 */
+    @Excel(name = "视频地址")
+    private String sectionUrl;
+
+    /** 视频点播ID */
+    @Excel(name = "点播ID")
+    private String sectionAliid;
+
+    /** 来源 */
+    @Excel(name = "来源")
+    private String from;
+
+    private Integer course;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setPackId(String packId) 
+    {
+        this.packId = packId;
+    }
+
+    public String getPackId() 
+    {
+        return packId;
+    }
+    public void setSectionId(String sectionId) 
+    {
+        this.sectionId = sectionId;
+    }
+
+    public String getSectionId() 
+    {
+        return sectionId;
+    }
+    public void setChapterId(String chapterId) 
+    {
+        this.chapterId = chapterId;
+    }
+
+    public String getChapterId() 
+    {
+        return chapterId;
+    }
+    public void setPlays(Long plays) 
+    {
+        this.plays = plays;
+    }
+
+    public Long getPlays() 
+    {
+        return plays;
+    }
+    public void setPlayed(Long played) 
+    {
+        this.played = played;
+    }
+
+    public Long getPlayed() 
+    {
+        return played;
+    }
+    public void setClicked(Long clicked) 
+    {
+        this.clicked = clicked;
+    }
+
+    public Long getClicked() 
+    {
+        return clicked;
+    }
+    public void setSectionName(String sectionName) 
+    {
+        this.sectionName = sectionName;
+    }
+
+    public String getSectionName() 
+    {
+        return sectionName;
+    }
+    public void setSectionIntro(String sectionIntro) 
+    {
+        this.sectionIntro = sectionIntro;
+    }
+
+    public String getSectionIntro() 
+    {
+        return sectionIntro;
+    }
+    public void setSectionTime(String sectionTime) 
+    {
+        this.sectionTime = sectionTime;
+    }
+
+    public String getSectionTime() 
+    {
+        return sectionTime;
+    }
+    public void setSectionSort(String sectionSort) 
+    {
+        this.sectionSort = sectionSort;
+    }
+
+    public String getSectionSort() 
+    {
+        return sectionSort;
+    }
+    public void setSectionTearcher(String sectionTearcher) 
+    {
+        this.sectionTearcher = sectionTearcher;
+    }
+
+    public String getSectionTearcher() 
+    {
+        return sectionTearcher;
+    }
+    public void setSectionImaurl(String sectionImaurl) 
+    {
+        this.sectionImaurl = sectionImaurl;
+    }
+
+    public String getSectionImaurl() 
+    {
+        return sectionImaurl;
+    }
+    public void setSectionUrl(String sectionUrl) 
+    {
+        this.sectionUrl = sectionUrl;
+    }
+
+    public String getSectionUrl() 
+    {
+        return sectionUrl;
+    }
+    public void setSectionAliid(String sectionAliid) 
+    {
+        this.sectionAliid = sectionAliid;
+    }
+
+    public String getSectionAliid() 
+    {
+        return sectionAliid;
+    }
+    public void setFrom(String from) 
+    {
+        this.from = from;
+    }
+
+    public String getFrom() 
+    {
+        return from;
+    }
+
+    public Integer getAliIdType() {
+        return aliIdType;
+    }
+
+    public void setAliIdType(Integer aliIdType) {
+        this.aliIdType = aliIdType;
+    }
+
+    public Integer getCourse() {
+        return course;
+    }
+
+    public void setCourse(Integer course) {
+        this.course = course;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("packId", getPackId())
+            .append("sectionId", getSectionId())
+            .append("chapterId", getChapterId())
+            .append("plays", getPlays())
+            .append("played", getPlayed())
+            .append("clicked", getClicked())
+            .append("sectionName", getSectionName())
+            .append("sectionIntro", getSectionIntro())
+            .append("sectionTime", getSectionTime())
+            .append("sectionSort", getSectionSort())
+            .append("sectionTearcher", getSectionTearcher())
+            .append("sectionImaurl", getSectionImaurl())
+            .append("sectionUrl", getSectionUrl())
+            .append("sectionAliid", getSectionAliid())
+            .append("from", getFrom())
+            .append("course", getCourse())
+            .toString();
+    }
+}

+ 83 - 0
ie-system/src/main/java/com/ruoyi/dezhi/mapper/BBusiDezhiVideoMapper.java

@@ -0,0 +1,83 @@
+package com.ruoyi.dezhi.mapper;
+
+import java.util.List;
+import java.util.Map;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.dezhi.domain.BBusiDezhiVideo;
+
+/**
+ * 视频接口Mapper接口
+ * 
+ * @author mingxue
+ * @date 2021-07-22
+ */
+public interface BBusiDezhiVideoMapper 
+{
+    /**
+     * 查询视频接口
+     * 
+     * @param id 视频接口ID
+     * @return 视频接口
+     */
+    public BBusiDezhiVideo selectBBusiDezhiVideoById(Long id);
+
+    /**
+     * 查询视频接口列表
+     * 
+     * @param bBusiDezhiVideo 视频接口
+     * @return 视频接口集合
+     */
+    public List<BBusiDezhiVideo> selectBBusiDezhiVideoList(BBusiDezhiVideo bBusiDezhiVideo);
+
+    /**
+     * 视频管理,根据参数查询视频
+     * @param params
+     * @return
+     */
+    public List<JSONObject>  selectVideoList(Map<String, Object> params);
+
+    /**
+     * 有特定的随机数,使用时注意
+     * @param params
+     * @return
+     */
+    public List<JSONObject>  selectVideoList2(Map<String, Object> params);
+    /**
+     * 查询视频包所有视频详情
+     * @param packId
+     * @return
+     */
+    public List<JSONObject>  searchInfoByPackId(String packId);
+    /**
+     * 新增视频接口
+     * 
+     * @param bBusiDezhiVideo 视频接口
+     * @return 结果
+     */
+    public int insertBBusiDezhiVideo(BBusiDezhiVideo bBusiDezhiVideo);
+
+    /**
+     * 修改视频接口
+     * 
+     * @param bBusiDezhiVideo 视频接口
+     * @return 结果
+     */
+    public int updateBBusiDezhiVideo(BBusiDezhiVideo bBusiDezhiVideo);
+
+    /**
+     * 删除视频接口
+     * 
+     * @param id 视频接口ID
+     * @return 结果
+     */
+    public int deleteBBusiDezhiVideoById(Long id);
+
+    /**
+     * 批量删除视频接口
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteBBusiDezhiVideoByIds(Long[] ids);
+}

+ 82 - 0
ie-system/src/main/java/com/ruoyi/dezhi/service/IBBusiDezhiVideoService.java

@@ -0,0 +1,82 @@
+package com.ruoyi.dezhi.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.dezhi.domain.BBusiDezhiVideo;
+
+/**
+ * 视频接口Service接口
+ * 
+ * @author mingxue
+ * @date 2021-07-22
+ */
+public interface IBBusiDezhiVideoService 
+{
+    /**
+     * 查询视频接口
+     * 
+     * @param id 视频接口ID
+     * @return 视频接口
+     */
+    public BBusiDezhiVideo selectBBusiDezhiVideoById(Long id);
+
+    /**
+     * 查询视频接口列表
+     * 
+     * @param bBusiDezhiVideo 视频接口
+     * @return 视频接口集合
+     */
+    public List<BBusiDezhiVideo> selectBBusiDezhiVideoList(BBusiDezhiVideo bBusiDezhiVideo);
+
+    /**
+     * 视频查询
+     * @param params
+     * @return
+     */
+    public List<JSONObject> selectVideoList(Map<String, Object> params);
+    public List<JSONObject> selectVideoList2(Map<String, Object> params);
+
+    /**
+     * 查询视频包所有视频详情
+     * @param packId
+     * @return
+     */
+    public List<JSONObject> searchInfoByPackId(String packId);
+    /**
+     * 新增视频接口
+     * 
+     * @param bBusiDezhiVideo 视频接口
+     * @return 结果
+     */
+    public int insertBBusiDezhiVideo(BBusiDezhiVideo bBusiDezhiVideo);
+
+    /**
+     * 修改视频接口
+     * 
+     * @param bBusiDezhiVideo 视频接口
+     * @return 结果
+     */
+    public int updateBBusiDezhiVideo(BBusiDezhiVideo bBusiDezhiVideo);
+
+    /**
+     * 批量删除视频接口
+     * 
+     * @param ids 需要删除的视频接口ID
+     * @return 结果
+     */
+    public int deleteBBusiDezhiVideoByIds(Long[] ids);
+
+    /**
+     * 删除视频接口信息
+     * 
+     * @param id 视频接口ID
+     * @return 结果
+     */
+    public int deleteBBusiDezhiVideoById(Long id);
+
+    public BBusiDezhiVideo selectBySection(String sectionId);
+
+
+}

+ 135 - 0
ie-system/src/main/java/com/ruoyi/dezhi/service/impl/BBusiDezhiVideoServiceImpl.java

@@ -0,0 +1,135 @@
+package com.ruoyi.dezhi.service.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import com.ruoyi.mxjb.domain.MxjbContants;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.dezhi.domain.BBusiDezhiVideo;
+import com.ruoyi.dezhi.mapper.BBusiDezhiVideoMapper;
+import com.ruoyi.dezhi.service.IBBusiDezhiVideoService;
+
+/**
+ * 视频接口Service业务层处理
+ * 
+ * @author mingxue
+ * @date 2021-07-22
+ */
+@Service
+public class BBusiDezhiVideoServiceImpl implements IBBusiDezhiVideoService 
+{
+    @Autowired
+    private BBusiDezhiVideoMapper bBusiDezhiVideoMapper;
+
+    /**
+     * 查询视频接口
+     * 
+     * @param id 视频接口ID
+     * @return 视频接口
+     */
+    @Override
+    public BBusiDezhiVideo selectBBusiDezhiVideoById(Long id)
+    {
+        return bBusiDezhiVideoMapper.selectBBusiDezhiVideoById(id);
+    }
+
+    /**
+     * 查询视频接口列表
+     * 
+     * @param bBusiDezhiVideo 视频接口
+     * @return 视频接口
+     */
+    @Override
+    public List<BBusiDezhiVideo> selectBBusiDezhiVideoList(BBusiDezhiVideo bBusiDezhiVideo)
+    {
+        return bBusiDezhiVideoMapper.selectBBusiDezhiVideoList(bBusiDezhiVideo);
+    }
+
+   
+    @Override
+    public List<JSONObject> selectVideoList(Map<String, Object> params) {
+        List<JSONObject> arr = bBusiDezhiVideoMapper.selectVideoList(params);
+        arr.stream().forEach(t -> t.put("aliIdType", MxjbContants.Ali_Id_dezhi));
+        return arr;
+    }
+
+    //单独用来取app首页中名师精讲数据 20210826 莫
+    @Override
+    public List<JSONObject> selectVideoList2(Map<String, Object> params) {
+        List<JSONObject> arr = bBusiDezhiVideoMapper.selectVideoList2(params);
+        arr.stream().forEach(t -> t.put("aliIdType", MxjbContants.Ali_Id_dezhi));
+        return arr;
+    }
+
+    @Override
+    public List<JSONObject> searchInfoByPackId(String packId) {
+        List<JSONObject> arr = bBusiDezhiVideoMapper.searchInfoByPackId(packId);
+        arr.stream().forEach(t -> t.put("aliIdType", MxjbContants.Ali_Id_dezhi));
+        return arr;
+    }
+
+    /**
+     * 新增视频接口
+     * 
+     * @param bBusiDezhiVideo 视频接口
+     * @return 结果
+     */
+    @Override
+    public int insertBBusiDezhiVideo(BBusiDezhiVideo bBusiDezhiVideo)
+    {
+        return bBusiDezhiVideoMapper.insertBBusiDezhiVideo(bBusiDezhiVideo);
+    }
+
+    /**
+     * 修改视频接口
+     * 
+     * @param bBusiDezhiVideo 视频接口
+     * @return 结果
+     */
+    @Override
+    public int updateBBusiDezhiVideo(BBusiDezhiVideo bBusiDezhiVideo)
+    {
+        return bBusiDezhiVideoMapper.updateBBusiDezhiVideo(bBusiDezhiVideo);
+    }
+
+    /**
+     * 批量删除视频接口
+     * 
+     * @param ids 需要删除的视频接口ID
+     * @return 结果
+     */
+    @Override
+    public int deleteBBusiDezhiVideoByIds(Long[] ids)
+    {
+        return bBusiDezhiVideoMapper.deleteBBusiDezhiVideoByIds(ids);
+    }
+
+    /**
+     * 删除视频接口信息
+     * 
+     * @param id 视频接口ID
+     * @return 结果
+     */
+    @Override
+    public int deleteBBusiDezhiVideoById(Long id)
+    {
+        return bBusiDezhiVideoMapper.deleteBBusiDezhiVideoById(id);
+    }
+
+    @Override
+    public BBusiDezhiVideo selectBySection(String sectionId) {
+        BBusiDezhiVideo query = new BBusiDezhiVideo();
+        query.setSectionAliid(sectionId);
+        List<BBusiDezhiVideo> list = this.selectBBusiDezhiVideoList(query);
+        if(CollectionUtils.isEmpty(list)) {
+            query.setSectionAliid(null);
+            query.setSectionId(sectionId);
+            list = this.selectBBusiDezhiVideoList(query);
+        }
+        return CollectionUtils.isEmpty(list) ? null : list.get(0);
+    }
+}

+ 139 - 0
ie-system/src/main/java/com/ruoyi/mingxue/domain/CustomerFavorites.java

@@ -0,0 +1,139 @@
+package com.ruoyi.mingxue.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.util.Date;
+
+/**
+ * 客户收藏对象 b_customer_favorites
+ * 
+ * @author mingxue
+ * @date 2021-07-25
+ */
+public class CustomerFavorites extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** 客户 */
+    @Excel(name = "客户")
+    private String customercode;
+
+    /** 类型 */
+    @Excel(name = "类型")
+    private String type;
+
+    /** 科目 */
+    @Excel(name = "科目")
+    private String course;
+
+    /** 关联ID */
+    @Excel(name = "关联ID")
+    private String refid;
+
+    /** 题型 */
+    @Excel(name = "题型")
+    private String reftype;
+
+    /** 收藏时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "收藏时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date time;
+
+    /** 状态(0:无效,1:有效) */
+    @Excel(name = "状态(0:无效,1:有效)")
+    private Integer status;
+    
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setCustomercode(String customercode) 
+    {
+        this.customercode = customercode;
+    }
+
+    public String getCustomercode() 
+    {
+        return customercode;
+    }
+    public void setType(String type) 
+    {
+        this.type = type;
+    }
+
+    public String getType() 
+    {
+        return type;
+    }
+    public void setCourse(String course) 
+    {
+        this.course = course;
+    }
+
+    public String getCourse() 
+    {
+        return course;
+    }
+    public void setRefid(String refid) 
+    {
+        this.refid = refid;
+    }
+
+    public String getRefid() 
+    {
+        return refid;
+    }
+    public void setReftype(String reftype) 
+    {
+        this.reftype = reftype;
+    }
+
+    public String getReftype() 
+    {
+        return reftype;
+    }
+    public void setTime(Date time) 
+    {
+        this.time = time;
+    }
+
+    public Date getTime() 
+    {
+        return time;
+    }
+    public void setStatus(Integer status) 
+    {
+        this.status = status;
+    }
+
+    public Integer getStatus() 
+    {
+        return status;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("customercode", getCustomercode())
+            .append("type", getType())
+            .append("course", getCourse())
+            .append("refid", getRefid())
+            .append("reftype", getReftype())
+            .append("time", getTime())
+            .append("status", getStatus())
+            .toString();
+    }
+}

+ 199 - 0
ie-system/src/main/java/com/ruoyi/mingxue/domain/CustomerVideoWatches.java

@@ -0,0 +1,199 @@
+package com.ruoyi.mingxue.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 客户观看视频记录对象 b_customer_video_watches
+ *
+ * @author mingxue
+ * @date 2021-07-28
+ */
+public class CustomerVideoWatches extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** 客户 */
+    @Excel(name = "客户")
+    private String customerCode;
+
+    /** aliId */
+    @Excel(name = "类型")
+    private Integer type;
+
+    /** 小节 */
+    @Excel(name = "小节")
+    private String sectionId;
+
+    /** 观看时长 */
+    @Excel(name = "观看时长")
+    private Long duration;
+
+    /** 观看进度 */
+    @Excel(name = "观看进度")
+    private BigDecimal percent;
+
+    /** 科目 */
+    @Excel(name = "科目")
+    private String course;
+
+    /** 标题 */
+    @Excel(name = "标题")
+    private String title;
+
+    /** 封面 */
+    @Excel(name = "封面")
+    private String pict;
+
+    /** 说明 */
+    @Excel(name = "说明")
+    private String comment;
+
+    /** 观看时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "观看时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date time;
+
+    private String day;
+    private Integer count;
+
+    public void setId(Long id)
+    {
+        this.id = id;
+    }
+
+    public Long getId()
+    {
+        return id;
+    }
+    public void setCustomerCode(String customerCode)
+    {
+        this.customerCode = customerCode;
+    }
+
+    public String getCustomerCode()
+    {
+        return customerCode;
+    }
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+    public void setSectionId(String sectionId)
+    {
+        this.sectionId = sectionId;
+    }
+
+    public String getSectionId()
+    {
+        return sectionId;
+    }
+    public void setDuration(Long duration)
+    {
+        this.duration = duration;
+    }
+
+    public Long getDuration()
+    {
+        return duration;
+    }
+    public void setPercent(BigDecimal percent)
+    {
+        this.percent = percent;
+    }
+
+    public BigDecimal getPercent()
+    {
+        return percent;
+    }
+    public void setCourse(String course)
+    {
+        this.course = course;
+    }
+
+    public String getCourse()
+    {
+        return course;
+    }
+    public void setTitle(String title)
+    {
+        this.title = title;
+    }
+
+    public String getTitle()
+    {
+        return title;
+    }
+    public void setPict(String pict)
+    {
+        this.pict = pict;
+    }
+
+    public String getPict()
+    {
+        return pict;
+    }
+    public void setComment(String comment)
+    {
+        this.comment = comment;
+    }
+
+    public String getComment()
+    {
+        return comment;
+    }
+    public void setTime(Date time)
+    {
+        this.time = time;
+    }
+
+    public Date getTime()
+    {
+        return time;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("customerCode", getCustomerCode())
+            .append("sectionId", getSectionId())
+            .append("duration", getDuration())
+            .append("percent", getPercent())
+            .append("course", getCourse())
+            .append("title", getTitle())
+            .append("pict", getPict())
+            .append("comment", getComment())
+            .append("time", getTime())
+            .toString();
+    }
+
+    public String getDay() {
+        return day;
+    }
+
+    public void setDay(String day) {
+        this.day = day;
+    }
+
+    public Integer getCount() {
+        return count;
+    }
+
+    public void setCount(Integer count) {
+        this.count = count;
+    }
+
+}

+ 85 - 0
ie-system/src/main/java/com/ruoyi/mingxue/domain/QuestionCollection.java

@@ -0,0 +1,85 @@
+package com.ruoyi.mingxue.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.util.Date;
+
+/**
+ * 题库收藏对象 mxjb_question_collection
+ * 
+ * @author mingxue
+ * @date 2021-06-24
+ */
+public class QuestionCollection
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 试题ID */
+    private Long questionId;
+
+    /** 用户Id */
+    private Long userId;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+    
+    private Long subjectId;
+    private String subjectName;
+
+
+    public void setQuestionId(Long questionId)
+    {
+        this.questionId = questionId;
+    }
+
+    public Long getQuestionId() 
+    {
+        return questionId;
+    }
+    public void setUserId(Long userId) 
+    {
+        this.userId = userId;
+    }
+
+    public Long getUserId() 
+    {
+        return userId;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+    
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("questionId", getQuestionId())
+            .append("userId", getUserId())
+            .append("createTime", getCreateTime())
+            .toString();
+    }
+
+    public String getSubjectName() {
+        return subjectName;
+    }
+
+    public void setSubjectName(String subjectName) {
+        this.subjectName = subjectName;
+    }
+
+    public Long getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(Long subjectId) {
+        this.subjectId = subjectId;
+    }
+    
+}

+ 60 - 0
ie-system/src/main/java/com/ruoyi/mingxue/dto/AppQuestionCollectionResDto.java

@@ -0,0 +1,60 @@
+package com.ruoyi.mingxue.dto;
+
+import io.swagger.annotations.ApiModel;
+
+/**
+ * @author 蔡礼田
+ * @date 2021-06-24 18:50
+ */
+@ApiModel("题库收藏查询返回结果")
+public class AppQuestionCollectionResDto {
+    private Long questionId;
+
+    private String title;
+
+    private String type;
+
+    private String difficulty;
+
+    private String picUrl;
+
+    public String getPicUrl() {
+        return picUrl;
+    }
+
+    public void setPicUrl(String picUrl) {
+        this.picUrl = picUrl;
+    }
+
+    public Long getQuestionId() {
+        return questionId;
+    }
+
+    public void setQuestionId(Long questionId) {
+        this.questionId = questionId;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getDifficulty() {
+        return difficulty;
+    }
+
+    public void setDifficulty(String difficulty) {
+        this.difficulty = difficulty;
+    }
+}

+ 64 - 0
ie-system/src/main/java/com/ruoyi/mingxue/mapper/CustomerFavoritesMapper.java

@@ -0,0 +1,64 @@
+package com.ruoyi.mingxue.mapper;
+
+import com.ruoyi.mingxue.domain.CustomerFavorites;
+
+import java.util.List;
+
+/**
+ * 客户收藏Mapper接口
+ * 
+ * @author mingxue
+ * @date 2021-07-25
+ */
+public interface CustomerFavoritesMapper 
+{
+    /**
+     * 查询客户收藏
+     * 
+     * @param id 客户收藏ID
+     * @return 客户收藏
+     */
+    public CustomerFavorites selectCustomerFavoritesById(Long id);
+
+    /**
+     * 查询客户收藏列表
+     * 
+     * @param customerFavorites 客户收藏
+     * @return 客户收藏集合
+     */
+    public List<CustomerFavorites> selectCustomerFavoritesList(CustomerFavorites customerFavorites);
+
+    /**
+     * 新增客户收藏
+     * 
+     * @param customerFavorites 客户收藏
+     * @return 结果
+     */
+    public int insertCustomerFavorites(CustomerFavorites customerFavorites);
+
+    /**
+     * 修改客户收藏
+     * 
+     * @param customerFavorites 客户收藏
+     * @return 结果
+     */
+    public int updateCustomerFavorites(CustomerFavorites customerFavorites);
+
+    /**
+     * 删除客户收藏
+     * 
+     * @param id 客户收藏ID
+     * @return 结果
+     */
+    public int deleteCustomerFavoritesById(Long id);
+
+    /**
+     * 批量删除客户收藏
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteCustomerFavoritesByIds(Long[] ids);
+
+    public List<CustomerFavorites> selectSubjects(CustomerFavorites query);
+}

+ 75 - 0
ie-system/src/main/java/com/ruoyi/mingxue/mapper/CustomerVideoWatchesMapper.java

@@ -0,0 +1,75 @@
+package com.ruoyi.mingxue.mapper;
+
+import com.ruoyi.mingxue.domain.CustomerVideoWatches;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 客户观看视频记录Mapper接口
+ *
+ * @author mingxue
+ * @date 2021-07-28
+ */
+public interface CustomerVideoWatchesMapper
+{
+    /**
+     * 查询客户观看视频记录
+     *
+     * @param id 客户观看视频记录ID
+     * @return 客户观看视频记录
+     */
+    public CustomerVideoWatches selectCustomerVideoWatchesById(Long id);
+
+    /**
+     * 查询客户观看视频记录列表
+     *
+     * @param customerVideoWatches 客户观看视频记录
+     * @return 客户观看视频记录集合
+     */
+    public List<CustomerVideoWatches> selectCustomerVideoWatchesList(CustomerVideoWatches customerVideoWatches);
+
+    /**
+     * 新增客户观看视频记录
+     *
+     * @param customerVideoWatches 客户观看视频记录
+     * @return 结果
+     */
+    public int insertCustomerVideoWatches(CustomerVideoWatches customerVideoWatches);
+
+    /**
+     * 修改客户观看视频记录
+     *
+     * @param customerVideoWatches 客户观看视频记录
+     * @return 结果
+     */
+    public int updateCustomerVideoWatches(CustomerVideoWatches customerVideoWatches);
+
+    /**
+     * 删除客户观看视频记录
+     *
+     * @param id 客户观看视频记录ID
+     * @return 结果
+     */
+    public int deleteCustomerVideoWatchesById(Long id);
+
+    /**
+     * 批量删除客户观看视频记录
+     *
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteCustomerVideoWatchesByIds(Long[] ids);
+
+    public int countVideoWatchCount(String customerCode);
+
+    public int countVideoWatchDuration(String customerCode);
+
+    public List<CustomerVideoWatches> countDurationByDate(Map<String, Object> map);
+
+    public List<CustomerVideoWatches> selectByDate(Map<String, Object> map);
+
+    public List<CustomerVideoWatches> countDurationByDateAndSubject(Map<String, Object> map);
+
+    public List<CustomerVideoWatches> selectTodayBySection(Map<String, Object> params);
+}

+ 70 - 0
ie-system/src/main/java/com/ruoyi/mingxue/mapper/QuestionCollectionMapper.java

@@ -0,0 +1,70 @@
+package com.ruoyi.mingxue.mapper;
+
+import com.ruoyi.mingxue.dto.AppQuestionCollectionResDto;
+import com.ruoyi.mingxue.domain.QuestionCollection;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 题库收藏Mapper接口
+ * 
+ * @author mingxue
+ * @date 2021-06-24
+ */
+public interface QuestionCollectionMapper 
+{
+    /**
+     * 查询题库收藏
+     * 
+     * @param questionId 题库收藏ID
+     * @return 题库收藏
+     */
+    public QuestionCollection selectQuestionCollectionById(Long questionId);
+
+    /**
+     * 查询题库收藏列表
+     * 
+     * @param questionCollection 题库收藏
+     * @return 题库收藏集合
+     */
+    public List<QuestionCollection> selectQuestionCollectionList(QuestionCollection questionCollection);
+
+    /**
+     * 新增题库收藏
+     * 
+     * @param questionCollection 题库收藏
+     * @return 结果
+     */
+    public int insertQuestionCollection(QuestionCollection questionCollection);
+
+    /**
+     * 修改题库收藏
+     * 
+     * @param questionCollection 题库收藏
+     * @return 结果
+     */
+    public int updateQuestionCollection(QuestionCollection questionCollection);
+
+    /**
+     * 删除题库收藏
+     * 
+     * @param questionId 题库收藏ID
+     * @return 结果
+     */
+    public int deleteQuestionCollectionById(@Param("questionId") Long questionId, @Param("userId")Long userId);
+
+    /**
+     * 批量删除题库收藏
+     * 
+     * @param questionIds 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteQuestionCollectionByIds(Long[] questionIds);
+
+    List<AppQuestionCollectionResDto> getQuestionCollectionList(Long userId);
+
+    public List<QuestionCollection> selectSubjects(QuestionCollection questionCollection);
+
+    public List<QuestionCollection> selectQtypes(QuestionCollection questionCollection);
+}

+ 64 - 0
ie-system/src/main/java/com/ruoyi/mingxue/service/ICustomerFavoritesService.java

@@ -0,0 +1,64 @@
+package com.ruoyi.mingxue.service;
+
+import com.ruoyi.mingxue.domain.CustomerFavorites;
+
+import java.util.List;
+
+/**
+ * 客户收藏Service接口
+ * 
+ * @author mingxue
+ * @date 2021-07-25
+ */
+public interface ICustomerFavoritesService 
+{
+    /**
+     * 查询客户收藏
+     * 
+     * @param id 客户收藏ID
+     * @return 客户收藏
+     */
+    public CustomerFavorites selectCustomerFavoritesById(Long id);
+
+    /**
+     * 查询客户收藏列表
+     * 
+     * @param customerFavorites 客户收藏
+     * @return 客户收藏集合
+     */
+    public List<CustomerFavorites> selectCustomerFavoritesList(CustomerFavorites customerFavorites);
+
+    /**
+     * 新增客户收藏
+     * 
+     * @param customerFavorites 客户收藏
+     * @return 结果
+     */
+    public int insertCustomerFavorites(CustomerFavorites customerFavorites);
+
+    /**
+     * 修改客户收藏
+     * 
+     * @param customerFavorites 客户收藏
+     * @return 结果
+     */
+    public int updateCustomerFavorites(CustomerFavorites customerFavorites);
+
+    /**
+     * 批量删除客户收藏
+     * 
+     * @param ids 需要删除的客户收藏ID
+     * @return 结果
+     */
+    public int deleteCustomerFavoritesByIds(Long[] ids);
+
+    /**
+     * 删除客户收藏信息
+     * 
+     * @param id 客户收藏ID
+     * @return 结果
+     */
+    public int deleteCustomerFavoritesById(Long id);
+
+    public List<String> selectSubjects(String customerCode, String type);
+}

+ 75 - 0
ie-system/src/main/java/com/ruoyi/mingxue/service/ICustomerVideoWatchesService.java

@@ -0,0 +1,75 @@
+package com.ruoyi.mingxue.service;
+
+import com.ruoyi.mingxue.domain.CustomerVideoWatches;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 客户观看视频记录Service接口
+ *
+ * @author mingxue
+ * @date 2021-07-28
+ */
+public interface ICustomerVideoWatchesService
+{
+    /**
+     * 查询客户观看视频记录
+     *
+     * @param id 客户观看视频记录ID
+     * @return 客户观看视频记录
+     */
+    public CustomerVideoWatches selectCustomerVideoWatchesById(Long id);
+
+    /**
+     * 查询客户观看视频记录列表
+     *
+     * @param customerVideoWatches 客户观看视频记录
+     * @return 客户观看视频记录集合
+     */
+    public List<CustomerVideoWatches> selectCustomerVideoWatchesList(CustomerVideoWatches customerVideoWatches);
+
+    /**
+     * 新增客户观看视频记录
+     *
+     * @param customerVideoWatches 客户观看视频记录
+     * @return 结果
+     */
+    public int insertCustomerVideoWatches(CustomerVideoWatches customerVideoWatches);
+
+    /**
+     * 修改客户观看视频记录
+     *
+     * @param customerVideoWatches 客户观看视频记录
+     * @return 结果
+     */
+    public int updateCustomerVideoWatches(CustomerVideoWatches customerVideoWatches);
+
+    /**
+     * 批量删除客户观看视频记录
+     *
+     * @param ids 需要删除的客户观看视频记录ID
+     * @return 结果
+     */
+    public int deleteCustomerVideoWatchesByIds(Long[] ids);
+
+    /**
+     * 删除客户观看视频记录信息
+     *
+     * @param id 客户观看视频记录ID
+     * @return 结果
+     */
+    public int deleteCustomerVideoWatchesById(Long id);
+
+    public int countVideoWatchCount(String customerCode);
+
+    public int countVideoWatchDuration(String customerCode);
+
+    public List<CustomerVideoWatches> countDurationByDate(String customerCode, Date start, Date end);
+
+    public List<CustomerVideoWatches> selectByDate(String customerCode, Date start, Date end);
+
+    public List<CustomerVideoWatches> countDurationByDateAndSubject(String customerCode, Date start, Date end);
+
+    public CustomerVideoWatches selectTodayBySection(String customerCode, Integer type, String sectionId);
+}

+ 70 - 0
ie-system/src/main/java/com/ruoyi/mingxue/service/IQuestionCollectionService.java

@@ -0,0 +1,70 @@
+package com.ruoyi.mingxue.service;
+
+import com.ruoyi.mingxue.dto.AppQuestionCollectionResDto;
+import com.ruoyi.mingxue.domain.QuestionCollection;
+
+import java.util.List;
+
+/**
+ * 题库收藏Service接口
+ * 
+ * @author mingxue
+ * @date 2021-06-24
+ */
+public interface IQuestionCollectionService 
+{
+    /**
+     * 查询题库收藏
+     * 
+     * @param questionId 题库收藏ID
+     * @return 题库收藏
+     */
+    public QuestionCollection selectQuestionCollectionById(Long questionId);
+
+    /**
+     * 查询题库收藏列表
+     * 
+     * @param questionCollection 题库收藏
+     * @return 题库收藏集合
+     */
+    public List<QuestionCollection> selectQuestionCollectionList(QuestionCollection questionCollection);
+
+    /**
+     * 新增题库收藏
+     * 
+     * @param questionCollection 题库收藏
+     * @return 结果
+     */
+    public int insertQuestionCollection(QuestionCollection questionCollection);
+
+    /**
+     * 修改题库收藏
+     * 
+     * @param questionCollection 题库收藏
+     * @return 结果
+     */
+    public int updateQuestionCollection(QuestionCollection questionCollection);
+
+    /**
+     * 批量删除题库收藏
+     * 
+     * @param questionIds 需要删除的题库收藏ID
+     * @return 结果
+     */
+    public int deleteQuestionCollectionByIds(Long[] questionIds);
+
+    /**
+     * 删除题库收藏信息
+     * 
+     * @param questionId 题库收藏ID
+     * @return 结果
+     */
+    public int deleteQuestionCollectionById(Long questionId, Long userId);
+
+    List<AppQuestionCollectionResDto> getQuestionCollectionList(Long userId);
+
+    public List<String> selectSubjects(Long userId);
+
+    public List<String> selectQtypes(Long userId, Long subjectId);
+    
+}

+ 108 - 0
ie-system/src/main/java/com/ruoyi/mingxue/service/impl/CustomerFavoritesServiceImpl.java

@@ -0,0 +1,108 @@
+package com.ruoyi.mingxue.service.impl;
+
+import com.ruoyi.mingxue.domain.CustomerFavorites;
+import com.ruoyi.mingxue.mapper.CustomerFavoritesMapper;
+import com.ruoyi.mingxue.service.ICustomerFavoritesService;
+import org.apache.commons.compress.utils.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 客户收藏Service业务层处理
+ * 
+ * @author mingxue
+ * @date 2021-07-25
+ */
+@Service
+public class CustomerFavoritesServiceImpl implements ICustomerFavoritesService 
+{
+    @Autowired
+    private CustomerFavoritesMapper customerFavoritesMapper;
+
+    /**
+     * 查询客户收藏
+     * 
+     * @param id 客户收藏ID
+     * @return 客户收藏
+     */
+    @Override
+    public CustomerFavorites selectCustomerFavoritesById(Long id)
+    {
+        return customerFavoritesMapper.selectCustomerFavoritesById(id);
+    }
+
+    /**
+     * 查询客户收藏列表
+     * 
+     * @param customerFavorites 客户收藏
+     * @return 客户收藏
+     */
+    @Override
+    public List<CustomerFavorites> selectCustomerFavoritesList(CustomerFavorites customerFavorites)
+    {
+        return customerFavoritesMapper.selectCustomerFavoritesList(customerFavorites);
+    }
+
+    /**
+     * 新增客户收藏
+     * 
+     * @param customerFavorites 客户收藏
+     * @return 结果
+     */
+    @Override
+    public int insertCustomerFavorites(CustomerFavorites customerFavorites)
+    {
+        return customerFavoritesMapper.insertCustomerFavorites(customerFavorites);
+    }
+
+    /**
+     * 修改客户收藏
+     * 
+     * @param customerFavorites 客户收藏
+     * @return 结果
+     */
+    @Override
+    public int updateCustomerFavorites(CustomerFavorites customerFavorites)
+    {
+        return customerFavoritesMapper.updateCustomerFavorites(customerFavorites);
+    }
+
+    /**
+     * 批量删除客户收藏
+     * 
+     * @param ids 需要删除的客户收藏ID
+     * @return 结果
+     */
+    @Override
+    public int deleteCustomerFavoritesByIds(Long[] ids)
+    {
+        return customerFavoritesMapper.deleteCustomerFavoritesByIds(ids);
+    }
+
+    /**
+     * 删除客户收藏信息
+     * 
+     * @param id 客户收藏ID
+     * @return 结果
+     */
+    @Override
+    public int deleteCustomerFavoritesById(Long id)
+    {
+        return customerFavoritesMapper.deleteCustomerFavoritesById(id);
+    }
+
+    @Override
+    public List<String> selectSubjects(String customerCode, String type) {
+        CustomerFavorites query = new CustomerFavorites();
+        query.setCustomercode(customerCode);
+        query.setType(type);
+        List<CustomerFavorites> customerFavorites = customerFavoritesMapper.selectSubjects(query);
+        List<String> list = Lists.newArrayList();
+        customerFavorites.forEach(e -> {
+            list.add(e.getCourse());
+        });
+        return list;
+    }
+}

+ 149 - 0
ie-system/src/main/java/com/ruoyi/mingxue/service/impl/CustomerVideoWatchesServiceImpl.java

@@ -0,0 +1,149 @@
+package com.ruoyi.mingxue.service.impl;
+
+import com.ruoyi.mingxue.domain.CustomerVideoWatches;
+import com.ruoyi.mingxue.mapper.CustomerVideoWatchesMapper;
+import com.ruoyi.mingxue.service.ICustomerVideoWatchesService;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 客户观看视频记录Service业务层处理
+ *
+ * @author mingxue
+ * @date 2021-07-28
+ */
+@Service
+public class CustomerVideoWatchesServiceImpl implements ICustomerVideoWatchesService
+{
+    @Autowired
+    private CustomerVideoWatchesMapper customerVideoWatchesMapper;
+
+    /**
+     * 查询客户观看视频记录
+     *
+     * @param id 客户观看视频记录ID
+     * @return 客户观看视频记录
+     */
+    @Override
+    public CustomerVideoWatches selectCustomerVideoWatchesById(Long id)
+    {
+        return customerVideoWatchesMapper.selectCustomerVideoWatchesById(id);
+    }
+
+    /**
+     * 查询客户观看视频记录列表
+     *
+     * @param customerVideoWatches 客户观看视频记录
+     * @return 客户观看视频记录
+     */
+    @Override
+    public List<CustomerVideoWatches> selectCustomerVideoWatchesList(CustomerVideoWatches customerVideoWatches)
+    {
+        return customerVideoWatchesMapper.selectCustomerVideoWatchesList(customerVideoWatches);
+    }
+
+    /**
+     * 新增客户观看视频记录
+     *
+     * @param customerVideoWatches 客户观看视频记录
+     * @return 结果
+     */
+    @Override
+    public int insertCustomerVideoWatches(CustomerVideoWatches customerVideoWatches)
+    {
+        return customerVideoWatchesMapper.insertCustomerVideoWatches(customerVideoWatches);
+    }
+
+    /**
+     * 修改客户观看视频记录
+     *
+     * @param customerVideoWatches 客户观看视频记录
+     * @return 结果
+     */
+    @Override
+    public int updateCustomerVideoWatches(CustomerVideoWatches customerVideoWatches)
+    {
+        return customerVideoWatchesMapper.updateCustomerVideoWatches(customerVideoWatches);
+    }
+
+    /**
+     * 批量删除客户观看视频记录
+     *
+     * @param ids 需要删除的客户观看视频记录ID
+     * @return 结果
+     */
+    @Override
+    public int deleteCustomerVideoWatchesByIds(Long[] ids)
+    {
+        return customerVideoWatchesMapper.deleteCustomerVideoWatchesByIds(ids);
+    }
+
+    /**
+     * 删除客户观看视频记录信息
+     *
+     * @param id 客户观看视频记录ID
+     * @return 结果
+     */
+    @Override
+    public int deleteCustomerVideoWatchesById(Long id)
+    {
+        return customerVideoWatchesMapper.deleteCustomerVideoWatchesById(id);
+    }
+
+    @Override
+    public int countVideoWatchCount(String customerCode) {
+        return customerVideoWatchesMapper.countVideoWatchCount(customerCode);
+    }
+
+    @Override
+    public int countVideoWatchDuration(String customerCode) {
+        return customerVideoWatchesMapper.countVideoWatchDuration(customerCode);
+    }
+
+    @Override
+    public List<CustomerVideoWatches> countDurationByDate(String customerCode, Date start, Date end) {
+        Map<String, Object> map = new HashMap<String, Object>();
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        map.put("customerCode", customerCode);
+        map.put("start", dateFormat.format(start));
+        map.put("end", dateFormat.format(end));
+        return customerVideoWatchesMapper.countDurationByDate(map);
+    }
+
+    @Override
+    public List<CustomerVideoWatches> selectByDate(String customerCode, Date start, Date end) {
+        Map<String, Object> map = new HashMap<String, Object>();
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        map.put("customerCode", customerCode);
+        map.put("start", dateFormat.format(start));
+        map.put("end", dateFormat.format(end));
+        return customerVideoWatchesMapper.selectByDate(map);
+    }
+
+    @Override
+    public List<CustomerVideoWatches> countDurationByDateAndSubject(String customerCode, Date start, Date end) {
+        Map<String, Object> map = new HashMap<String, Object>();
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        map.put("customerCode", customerCode);
+        map.put("start", dateFormat.format(start));
+        map.put("end", dateFormat.format(end));
+        return customerVideoWatchesMapper.countDurationByDateAndSubject(map);
+    }
+
+    @Override
+    public CustomerVideoWatches selectTodayBySection(String customerCode, Integer type, String sectionId) {
+        Map<String, Object> params = new HashMap<>();
+        params.put("customerCode", customerCode);
+        params.put("type", type);
+        params.put("sectionId", sectionId);
+        List<CustomerVideoWatches> list = customerVideoWatchesMapper.selectTodayBySection(params);
+        return CollectionUtils.isEmpty(list) ? null : list.get(0);
+    }
+}

+ 120 - 0
ie-system/src/main/java/com/ruoyi/mingxue/service/impl/QuestionCollectionServiceImpl.java

@@ -0,0 +1,120 @@
+package com.ruoyi.mingxue.service.impl;
+
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.mingxue.dto.AppQuestionCollectionResDto;
+import com.ruoyi.mingxue.domain.QuestionCollection;
+import com.ruoyi.mingxue.mapper.QuestionCollectionMapper;
+import com.ruoyi.mingxue.service.IQuestionCollectionService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 题库收藏Service业务层处理
+ * 
+ * @author mingxue
+ * @date 2021-06-24
+ */
+@Service
+public class QuestionCollectionServiceImpl implements IQuestionCollectionService 
+{
+    @Autowired
+    private QuestionCollectionMapper questionCollectionMapper;
+
+    /**
+     * 查询题库收藏
+     * 
+     * @param questionId 题库收藏ID
+     * @return 题库收藏
+     */
+    @Override
+    public QuestionCollection selectQuestionCollectionById(Long questionId)
+    {
+        return questionCollectionMapper.selectQuestionCollectionById(questionId);
+    }
+
+    /**
+     * 查询题库收藏列表
+     * 
+     * @param questionCollection 题库收藏
+     * @return 题库收藏
+     */
+    @Override
+    public List<QuestionCollection> selectQuestionCollectionList(QuestionCollection questionCollection)
+    {
+        return questionCollectionMapper.selectQuestionCollectionList(questionCollection);
+    }
+
+    /**
+     * 新增题库收藏
+     * 
+     * @param questionCollection 题库收藏
+     * @return 结果
+     */
+    @Override
+    public int insertQuestionCollection(QuestionCollection questionCollection)
+    {
+        questionCollection.setCreateTime(DateUtils.getNowDate());
+        return questionCollectionMapper.insertQuestionCollection(questionCollection);
+    }
+
+    /**
+     * 修改题库收藏
+     * 
+     * @param questionCollection 题库收藏
+     * @return 结果
+     */
+    @Override
+    public int updateQuestionCollection(QuestionCollection questionCollection)
+    {
+        return questionCollectionMapper.updateQuestionCollection(questionCollection);
+    }
+
+    /**
+     * 批量删除题库收藏
+     * 
+     * @param questionIds 需要删除的题库收藏ID
+     * @return 结果
+     */
+    @Override
+    public int deleteQuestionCollectionByIds(Long[] questionIds)
+    {
+        return questionCollectionMapper.deleteQuestionCollectionByIds(questionIds);
+    }
+
+    /**
+     * 删除题库收藏信息
+     * 
+     * @param questionId 题库收藏ID
+     * @return 结果
+     */
+    @Override
+    public int deleteQuestionCollectionById(Long questionId, Long userId)
+    {
+        return questionCollectionMapper.deleteQuestionCollectionById(questionId, userId);
+    }
+
+    @Override
+    public List<AppQuestionCollectionResDto> getQuestionCollectionList(Long userId) {
+        return questionCollectionMapper.getQuestionCollectionList(userId);
+    }
+
+    @Override
+    public List<String> selectSubjects(Long userId) {
+        QuestionCollection questionCollection = new QuestionCollection();
+        questionCollection.setUserId(userId);
+        List<QuestionCollection> list = questionCollectionMapper.selectSubjects(questionCollection);
+        return list.stream().map(QuestionCollection::getSubjectName).collect(Collectors.toList());
+    }
+
+    @Override
+    public List<String> selectQtypes(Long userId, Long subjectId) {
+        QuestionCollection questionCollection = new QuestionCollection();
+        questionCollection.setUserId(userId);
+        questionCollection.setSubjectId(subjectId);
+        List<QuestionCollection> list = questionCollectionMapper.selectQtypes(questionCollection);
+        return list.stream().map(QuestionCollection::getSubjectName).collect(Collectors.toList());
+    }
+}

+ 164 - 0
ie-system/src/main/resources/mapper/dezhi/BBusiDezhiVideoMapper.xml

@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.dezhi.mapper.BBusiDezhiVideoMapper">
+  <resultMap type="BBusiDezhiVideo" id="BBusiDezhiVideoResult">
+    <result property="id" column="id" />
+    <result property="packId" column="pack_id" />
+    <result property="sectionId" column="section_id" />
+    <result property="chapterId" column="chapter_id" />
+    <result property="plays" column="plays" />
+    <result property="played" column="played" />
+    <result property="clicked" column="clicked" />
+    <result property="sectionName" column="section_name" />
+    <result property="sectionIntro" column="section_intro" />
+    <result property="sectionTime" column="section_time" />
+    <result property="sectionSort" column="section_sort" />
+    <result property="sectionTearcher" column="section_tearcher" />
+    <result property="sectionImaurl" column="section_imaurl" />
+    <result property="sectionUrl" column="section_url" />
+    <result property="sectionAliid" column="section_aliId" />
+    <result property="from" column="from" />
+  </resultMap>
+
+  <sql id="selectBBusiDezhiVideoVo">
+    select id, pack_id, section_id, chapter_id, plays, played, clicked, section_name, section_intro, section_time, section_sort, section_tearcher,
+    section_imaurl, section_url,
+    section_aliId, `from` from b_busi_dezhi_video
+  </sql>
+
+  <select id="selectBBusiDezhiVideoList" parameterType="BBusiDezhiVideo" resultMap="BBusiDezhiVideoResult">
+    <include refid="selectBBusiDezhiVideoVo" />
+    where 1=1
+      <if test="packId != null  and packId != ''"> and pack_id = #{packId}</if>
+      <if test="sectionId != null  and sectionId != ''"> and section_id = #{sectionId}</if>
+      <if test="chapterId != null  and chapterId != ''"> and chapter_id = #{chapterId}</if>
+      <if test="plays != null "> and plays = #{plays}</if>
+      <if test="played != null "> and played = #{played}</if>
+      <if test="clicked != null "> and clicked = #{clicked}</if>
+      <if test="sectionName != null  and sectionName != ''"> and section_name like concat('%', #{sectionName}, '%')</if>
+      <if test="sectionIntro != null  and sectionIntro != ''"> and section_intro = #{sectionIntro}</if>
+      <if test="sectionTime != null  and sectionTime != ''"> and section_time = #{sectionTime}</if>
+      <if test="sectionSort != null  and sectionSort != ''"> and section_sort = #{sectionSort}</if>
+      <if test="sectionTearcher != null  and sectionTearcher != ''"> and section_tearcher = #{sectionTearcher}</if>
+      <if test="sectionImaurl != null  and sectionImaurl != ''"> and section_imaurl = #{sectionImaurl}</if>
+      <if test="sectionUrl != null  and sectionUrl != ''"> and section_url = #{sectionUrl}</if>
+      <if test="sectionAliid != null  and sectionAliid != ''"> and section_aliId = #{sectionAliid}</if>
+      <if test="from != null  and from != ''"> and `from` = #{from}</if>
+      <if test="course != null">
+        and pack_id in (
+          SELECT DISTINCT pack_id FROM b_busi_dezhi_video_package WHERE course = #{course}
+        )
+      </if>
+  </select>
+
+  <select id="selectBBusiDezhiVideoById" parameterType="Long" resultMap="BBusiDezhiVideoResult">
+    <include refid="selectBBusiDezhiVideoVo" />
+    where id = #{id}
+  </select>
+
+  <select id="selectVideoList" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
+    select a.*,b.grade, b.pack_imgurl as img from b_busi_dezhi_video a
+      left join b_busi_dezhi_video_package b on a.pack_id=b.pack_id
+      LEFT JOIN b_busi_dezhi_video_package_chapter t2 ON a.chapter_id = t2.chapter_id
+    <where>
+      <if test="packId != null  and packId != ''"> and a.pack_id = #{packId}</if>
+      <if test="course != null  and course != ''"> and b.course = #{course}</if>
+      <if test="grade != null  and grade != ''"> and b.grade = #{grade}</if>
+      <if test="gradeLimit != null"> and b.grade &lt;= #{gradeLimit}</if>
+      <if test="version != null  and version != ''"> and b.version = #{version}</if>
+      <if test="sectionName != null  and sectionName != ''"> and a.section_name like concat('%', #{sectionName}, '%')</if>
+    </where>
+    ORDER BY t2.id, CAST(a.section_sort AS UNSIGNED)
+  </select>
+
+  <select id="selectVideoList2" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
+    select a.*,b.pack_imgurl as img
+    from b_busi_dezhi_video a
+    join b_busi_dezhi_video_package b on a.pack_id=b.pack_id
+    WHERE a.section_aliId IS NOT NULL and b.pack_imgurl IS NOT NULL and not (b.pack_imgurl) AND b.pack_imgurl != ''
+    <if test="course != null  and course != ''"> and b.course = #{course}</if>
+    ORDER BY RAND()
+    LIMIT 10
+  </select>
+
+  <select id="searchInfoByPackId" parameterType="String" resultType="com.alibaba.fastjson.JSONObject">
+    select t2.chapter_name,t1.* from b_busi_dezhi_video t1
+    inner join
+    b_busi_dezhi_video_package_chapter t2 on t1.chapter_id = t2.chapter_id
+    where t1.pack_id = #{packId}
+    ORDER BY t2.id, CAST(t1.section_sort AS UNSIGNED)
+  </select>
+
+  <insert id="insertBBusiDezhiVideo" parameterType="BBusiDezhiVideo" useGeneratedKeys="true" keyProperty="id">
+    insert into b_busi_dezhi_video
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="packId != null">pack_id,</if>
+      <if test="sectionId != null and sectionId != ''">section_id,</if>
+      <if test="chapterId != null">chapter_id,</if>
+      <if test="plays != null">plays,</if>
+      <if test="played != null">played,</if>
+      <if test="clicked != null">clicked,</if>
+      <if test="sectionName != null">section_name,</if>
+      <if test="sectionIntro != null">section_intro,</if>
+      <if test="sectionTime != null">section_time,</if>
+      <if test="sectionSort != null">section_sort,</if>
+      <if test="sectionTearcher != null">section_tearcher,</if>
+      <if test="sectionImaurl != null">section_imaurl,</if>
+      <if test="sectionUrl != null">section_url,</if>
+      <if test="sectionAliid != null">section_aliId,</if>
+      <if test="from != null">`from`,</if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="packId != null">#{packId},</if>
+      <if test="sectionId != null and sectionId != ''">#{sectionId},</if>
+      <if test="chapterId != null">#{chapterId},</if>
+      <if test="plays != null">#{plays},</if>
+      <if test="played != null">#{played},</if>
+      <if test="clicked != null">#{clicked},</if>
+      <if test="sectionName != null">#{sectionName},</if>
+      <if test="sectionIntro != null">#{sectionIntro},</if>
+      <if test="sectionTime != null">#{sectionTime},</if>
+      <if test="sectionSort != null">#{sectionSort},</if>
+      <if test="sectionTearcher != null">#{sectionTearcher},</if>
+      <if test="sectionImaurl != null">#{sectionImaurl},</if>
+      <if test="sectionUrl != null">#{sectionUrl},</if>
+      <if test="sectionAliid != null">#{sectionAliid},</if>
+      <if test="from != null">#{from},</if>
+    </trim>
+  </insert>
+
+  <update id="updateBBusiDezhiVideo" parameterType="BBusiDezhiVideo">
+    update b_busi_dezhi_video
+    <trim prefix="SET" suffixOverrides=",">
+      <if test="packId != null">pack_id = #{packId},</if>
+      <if test="sectionId != null and sectionId != ''">section_id = #{sectionId},</if>
+      <if test="chapterId != null">chapter_id = #{chapterId},</if>
+      <if test="plays != null">plays = #{plays},</if>
+      <if test="played != null">played = #{played},</if>
+      <if test="clicked != null">clicked = #{clicked},</if>
+      <if test="sectionName != null">section_name = #{sectionName},</if>
+      <if test="sectionIntro != null">section_intro = #{sectionIntro},</if>
+      <if test="sectionTime != null">section_time = #{sectionTime},</if>
+      <if test="sectionSort != null">section_sort = #{sectionSort},</if>
+      <if test="sectionTearcher != null">section_tearcher = #{sectionTearcher},</if>
+      <if test="sectionImaurl != null">section_imaurl = #{sectionImaurl},</if>
+      <if test="sectionUrl != null">section_url = #{sectionUrl},</if>
+      <if test="sectionAliid != null">section_aliId = #{sectionAliid},</if>
+      <if test="from != null">`from` = #{from},</if>
+    </trim>
+    where id = #{id}
+  </update>
+
+  <delete id="deleteBBusiDezhiVideoById" parameterType="Long">
+    delete from b_busi_dezhi_video where id = #{id}
+  </delete>
+
+  <delete id="deleteBBusiDezhiVideoByIds" parameterType="String">
+    delete from b_busi_dezhi_video where id in
+    <foreach item="id" collection="array" open="(" separator="," close=")">
+      #{id}
+    </foreach>
+  </delete>
+</mapper>

+ 99 - 0
ie-system/src/main/resources/mapper/mingxue/CustomerFavoritesMapper.xml

@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.mingxue.mapper.CustomerFavoritesMapper">
+    
+    <resultMap type="CustomerFavorites" id="CustomerFavoritesResult">
+        <result property="id"    column="id"    />
+        <result property="customercode"    column="customerCode"    />
+        <result property="type"    column="type"    />
+        <result property="course"    column="course"    />
+        <result property="refid"    column="refId"    />
+        <result property="reftype"    column="refType"    />
+        <result property="time"    column="time"    />
+        <result property="status"    column="status"    />
+    </resultMap>
+
+    <sql id="selectCustomerFavoritesVo">
+        select id, customerCode, type, course, refId, refType, time, status from b_customer_favorites
+    </sql>
+
+    <select id="selectCustomerFavoritesList" parameterType="CustomerFavorites" resultMap="CustomerFavoritesResult">
+        <include refid="selectCustomerFavoritesVo"/>
+        <where>  
+            <if test="customercode != null  and customercode != ''"> and customerCode = #{customercode}</if>
+            <if test="type != null  and type != ''"> and type = #{type}</if>
+            <if test="course != null  and course != ''"> and course = #{course}</if>
+            <if test="refid != null  and refid != ''"> and refId = #{refid}</if>
+            <if test="reftype != null  and reftype != ''"> and refType = #{reftype}</if>
+            <if test="time != null "> and time = #{time}</if>
+            <if test="status != null "> and status = #{status}</if>
+        </where>
+    </select>
+    
+    <select id="selectCustomerFavoritesById" parameterType="Long" resultMap="CustomerFavoritesResult">
+        <include refid="selectCustomerFavoritesVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertCustomerFavorites" parameterType="CustomerFavorites" useGeneratedKeys="true" keyProperty="id">
+        insert into b_customer_favorites
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="customercode != null">customerCode,</if>
+            <if test="type != null">type,</if>
+            <if test="course != null">course,</if>
+            <if test="refid != null">refId,</if>
+            <if test="reftype != null">refType,</if>
+            <if test="time != null">time,</if>
+            <if test="status != null">status,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="customercode != null">#{customercode},</if>
+            <if test="type != null">#{type},</if>
+            <if test="course != null">#{course},</if>
+            <if test="refid != null">#{refid},</if>
+            <if test="reftype != null">#{reftype},</if>
+            <if test="time != null">#{time},</if>
+            <if test="status != null">#{status},</if>
+         </trim>
+    </insert>
+
+    <update id="updateCustomerFavorites" parameterType="CustomerFavorites">
+        update b_customer_favorites
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="customercode != null">customerCode = #{customercode},</if>
+            <if test="type != null">type = #{type},</if>
+            <if test="course != null">course = #{course},</if>
+            <if test="refid != null">refId = #{refid},</if>
+            <if test="reftype != null">refType = #{reftype},</if>
+            <if test="time != null">time = #{time},</if>
+            <if test="status != null">status = #{status},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteCustomerFavoritesById" parameterType="Long">
+        delete from b_customer_favorites where id = #{id}
+    </delete>
+
+    <delete id="deleteCustomerFavoritesByIds" parameterType="String">
+        delete from b_customer_favorites where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+    
+    <select id="selectSubjects" parameterType="CustomerFavorites" resultMap="CustomerFavoritesResult">
+        select distinct course from b_customer_favorites 
+        where course is not null and course != ''
+            <if test="customercode != null  and customercode != ''"> and customerCode = #{customercode}</if>
+            <if test="type != null  and type != ''"> and type = #{type}</if>
+            <if test="course != null  and course != ''"> and course = #{course}</if>
+            <if test="refid != null  and refid != ''"> and refId = #{refid}</if>
+            <if test="reftype != null  and reftype != ''"> and refType = #{reftype}</if>
+            <if test="time != null "> and time = #{time}</if>
+            <if test="status != null "> and status = #{status}</if>
+    </select>
+    
+</mapper>

+ 145 - 0
ie-system/src/main/resources/mapper/mingxue/CustomerVideoWatchesMapper.xml

@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.mingxue.mapper.CustomerVideoWatchesMapper">
+    
+    <resultMap type="CustomerVideoWatches" id="CustomerVideoWatchesResult">
+        <result property="id"    column="id"    />
+        <result property="customerCode"    column="customerCode"    />
+        <result property="type"    column="type"    />
+        <result property="sectionId"    column="section_id"    />
+        <result property="duration"    column="duration"    />
+        <result property="percent"    column="percent"    />
+        <result property="course"    column="course"    />
+        <result property="title"    column="title"    />
+        <result property="pict"    column="pict"    />
+        <result property="comment"    column="comment"    />
+        <result property="time"    column="time"    />
+        <result property="type"    column="type"    />
+    </resultMap>
+
+    <sql id="selectCustomerVideoWatchesVo">
+        select id, customerCode, section_id, duration, percent, course, title, pict, comment, time ,type from b_customer_video_watches
+    </sql>
+
+    <select id="selectCustomerVideoWatchesList" parameterType="CustomerVideoWatches" resultMap="CustomerVideoWatchesResult">
+        <include refid="selectCustomerVideoWatchesVo"/>
+        <where>  
+            <if test="customerCode != null  and customerCode != ''"> and customerCode = #{customerCode}</if>
+            <if test="sectionId != null  and sectionId != ''"> and section_id = #{sectionId}</if>
+            <if test="type != null"> and type = #{type}</if>
+            <if test="duration != null "> and duration = #{duration}</if>
+            <if test="percent != null "> and percent = #{percent}</if>
+            <if test="course != null  and course != ''"> and course = #{course}</if>
+            <if test="title != null  and title != ''"> and title = #{title}</if>
+            <if test="pict != null  and pict != ''"> and pict = #{pict}</if>
+            <if test="comment != null  and comment != ''"> and comment = #{comment}</if>
+            <if test="time != null "> and time = #{time}</if>
+        </where>
+    </select>
+    
+    <select id="selectCustomerVideoWatchesById" parameterType="Long" resultMap="CustomerVideoWatchesResult">
+        <include refid="selectCustomerVideoWatchesVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertCustomerVideoWatches" parameterType="CustomerVideoWatches" useGeneratedKeys="true" keyProperty="id">
+        insert into b_customer_video_watches
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="customerCode != null and customerCode != ''">customerCode,</if>
+            <if test="sectionId != null and sectionId != ''">section_id,</if>
+            <if test="duration != null">duration,</if>
+            <if test="percent != null">percent,</if>
+            <if test="course != null">course,</if>
+            <if test="title != null">title,</if>
+            <if test="pict != null">pict,</if>
+            <if test="comment != null">comment,</if>
+            <if test="time != null">time,</if>
+            <if test="type != null">type,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="customerCode != null and customerCode != ''">#{customerCode},</if>
+            <if test="sectionId != null and sectionId != ''">#{sectionId},</if>
+            <if test="duration != null">#{duration},</if>
+            <if test="percent != null">#{percent},</if>
+            <if test="course != null">#{course},</if>
+            <if test="title != null">#{title},</if>
+            <if test="pict != null">#{pict},</if>
+            <if test="comment != null">#{comment},</if>
+            <if test="time != null">#{time},</if>
+            <if test="type != null">#{type},</if>
+         </trim>
+    </insert>
+
+    <update id="updateCustomerVideoWatches" parameterType="CustomerVideoWatches">
+        update b_customer_video_watches
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="customerCode != null and customerCode != ''">customerCode = #{customerCode},</if>
+            <if test="sectionId != null and sectionId != ''">section_id = #{sectionId},</if>
+            <if test="duration != null">duration = #{duration},</if>
+            <if test="percent != null">percent = #{percent},</if>
+            <if test="course != null">course = #{course},</if>
+            <if test="title != null">title = #{title},</if>
+            <if test="pict != null">pict = #{pict},</if>
+            <if test="comment != null">comment = #{comment},</if>
+            <if test="time != null">time = #{time},</if>
+            <if test="type != null">type = #{type},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteCustomerVideoWatchesById" parameterType="Long">
+        delete from b_customer_video_watches where id = #{id}
+    </delete>
+
+    <delete id="deleteCustomerVideoWatchesByIds" parameterType="String">
+        delete from b_customer_video_watches where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+    
+    <select id="countVideoWatchCount" parameterType="String" resultType="Integer">
+		select count(section_id) from b_customer_video_watches 
+		where percent>=90 and customerCode=#{customerCode}
+    </select>
+    
+    <select id="countVideoWatchDuration" parameterType="String" resultType="Integer">
+		select ifnull(sum(duration),0) from b_customer_video_watches 
+		where percent>=90 and customerCode=#{customerCode}
+    </select>
+    
+    <select id="countDurationByDate" parameterType="java.util.HashMap" resultMap="CustomerVideoWatchesResult">
+		select DATE_FORMAT(time, '%Y-%m-%d') day, sum(duration) count from b_customer_video_watches 
+		where customerCode=#{customerCode}
+		and DATE_FORMAT(time, '%Y-%m-%d') >= #{start}
+		and  #{end} >= DATE_FORMAT(time, '%Y-%m-%d') 
+		group by DATE_FORMAT(time, '%Y-%m-%d')
+    </select>
+    
+    <select id="countDurationByDateAndSubject" parameterType="java.util.HashMap" resultMap="CustomerVideoWatchesResult">
+		select course, sum(duration) count from b_customer_video_watches 
+		where percent>=90 and customerCode=#{customerCode}
+		and DATE_FORMAT(time, '%Y-%m-%d') >= #{start}
+		and  #{end} >= DATE_FORMAT(time, '%Y-%m-%d') 
+		group by course
+    </select>
+    
+    <select id="selectByDate" parameterType="java.util.HashMap" resultMap="CustomerVideoWatchesResult">
+		select * from b_customer_video_watches 
+		where percent>=90 and customerCode=#{customerCode}
+		and DATE_FORMAT(time, '%Y-%m-%d') >= #{start}
+		and  #{end} >= DATE_FORMAT(time, '%Y-%m-%d') 
+		order by time desc
+    </select>
+    
+    <select id="selectTodayBySection" parameterType="java.util.HashMap" resultMap="CustomerVideoWatchesResult">
+    	select * from b_customer_video_watches
+        where customerCode=#{customerCode} 
+        and to_days(time) = to_days(now())
+        and section_id = #{sectionId}
+        and type = #{type}
+    </select>
+    
+</mapper>

+ 98 - 0
ie-system/src/main/resources/mapper/mingxue/QuestionCollectionMapper.xml

@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.mingxue.mapper.QuestionCollectionMapper">
+    
+    <resultMap type="QuestionCollection" id="QuestionCollectionResult">
+        <result property="questionId"    column="question_id"    />
+        <result property="userId"    column="user_id"    />
+        <result property="createTime"    column="create_time"    />
+    </resultMap>
+
+    <resultMap type="com.ruoyi.mingxue.dto.AppQuestionCollectionResDto" id="AppQuestionCollectionResResult">
+        <result property="questionId"    column="question_id"    />
+        <result property="title"    column="title"    />
+        <result property="type"    column="type"    />
+        <result property="difficulty"    column="difficulty"    />
+        <result property="picUrl"    column="pic_url"    />
+        <result property="subjectName"    column="subjectName"    />
+    </resultMap>
+
+
+    <select id="getQuestionCollectionList" parameterType="Long" resultMap="AppQuestionCollectionResResult">
+        SELECT id question_id, title, qtpye type, diff difficulty ,
+        (SELECT pic_url from test_question_pic WHERE question_id = questions.id) pic_url
+        from questions WHERE id IN
+        (SELECT question_id from mxjb_question_collection WHERE user_id = #{userId})
+    </select>
+
+    <sql id="selectQuestionCollectionVo">
+        select question_id, user_id, create_time from mxjb_question_collection
+    </sql>
+
+    <select id="selectQuestionCollectionList" parameterType="QuestionCollection" resultMap="QuestionCollectionResult">
+        <include refid="selectQuestionCollectionVo"/>
+        <where>
+            <if test="questionId != null "> and question_id = #{questionId}</if>
+            <if test="userId != null "> and user_id = #{userId}</if>
+            <if test="createTime != null "> and create_time = #{createTime}</if>
+        </where>
+    </select>
+    
+    <select id="selectSubjects" parameterType="QuestionCollection" resultMap="QuestionCollectionResult">
+		select distinct s.subjectName,s.subjectId from mxjb_question_collection c
+		left join questions q on c.question_id = q.id
+		left join subject s on q.subjectId = s.subjectId 
+		where s.subjectName is not null and c.user_id = #{userId}
+		order by s.subjectId asc
+    </select>
+    
+    <select id="selectQtypes" parameterType="QuestionCollection" resultMap="QuestionCollectionResult">
+		select distinct q.qtpye as subjectName from mxjb_question_collection c
+		left join questions q on c.question_id = q.id
+		left join subject s on q.subjectId = s.subjectId 
+		where c.user_id = #{userId} and q.qtpye is not null
+		and q.subjectId = #{subjectId}
+    </select>
+    
+    
+    <select id="selectQuestionCollectionById" parameterType="Long" resultMap="QuestionCollectionResult">
+        <include refid="selectQuestionCollectionVo"/>
+        where question_id = #{questionId}
+    </select>
+        
+    <insert id="insertQuestionCollection" parameterType="QuestionCollection">
+        insert into mxjb_question_collection
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="questionId != null">question_id,</if>
+            <if test="userId != null">user_id,</if>
+            <if test="createTime != null">create_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="questionId != null">#{questionId},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="createTime != null">#{createTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateQuestionCollection" parameterType="QuestionCollection">
+        update mxjb_question_collection
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+        </trim>
+        where question_id = #{questionId}
+    </update>
+
+    <delete id="deleteQuestionCollectionById">
+        delete from mxjb_question_collection where question_id = #{questionId} and user_id = #{userId}
+    </delete>
+
+    <delete id="deleteQuestionCollectionByIds" parameterType="String">
+        delete from mxjb_question_collection where question_id in 
+        <foreach item="questionId" collection="array" open="(" separator="," close=")">
+            #{questionId}
+        </foreach>
+    </delete>
+</mapper>