ソースを参照

Merge branch 'master' of http://git.dayaedu.com/yonge/cooleshow

Eric 2 年 前
コミット
7428e346ac
18 ファイル変更804 行追加201 行削除
  1. 16 7
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/VideoLessonGroupDao.java
  2. 2 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/VideoLessonGroupDetailDao.java
  3. 13 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/VideoLessonGroupLogDao.java
  4. 11 12
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/VideoLessonAuthRecord.java
  5. 12 24
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/VideoLessonGroup.java
  6. 287 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/VideoLessonGroupLog.java
  7. 11 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/VideoLessonGroupLogService.java
  8. 3 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetAuthRecordServiceImpl.java
  9. 3 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetServiceImpl.java
  10. 33 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/VideoLessonGroupLogServiceImpl.java
  11. 123 57
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/VideoLessonGroupServiceImpl.java
  12. 23 21
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/VideoLessonAuthGroup.java
  13. 0 1
      cooleshow-user/user-biz/src/main/resources/config/mybatis/EmployeeMapper.xml
  14. 1 1
      cooleshow-user/user-biz/src/main/resources/config/mybatis/HomeMapper.xml
  15. 4 0
      cooleshow-user/user-biz/src/main/resources/config/mybatis/VideoLessonGroupDetailMapper.xml
  16. 157 0
      cooleshow-user/user-biz/src/main/resources/config/mybatis/VideoLessonGroupLogMapper.xml
  17. 77 52
      cooleshow-user/user-biz/src/main/resources/config/mybatis/VideoLessonGroupMapper.xml
  18. 28 25
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/VideoLessonGroupController.java

+ 16 - 7
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/VideoLessonGroupDao.java

@@ -1,15 +1,26 @@
 package com.yonge.cooleshow.biz.dal.dao;
 
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yonge.cooleshow.biz.dal.dto.search.VideoGroupSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.VideoLessonGroupSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.VideoLessonSearch;
 import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroup;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.yonge.cooleshow.biz.dal.vo.*;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
+import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupLog;
+import com.yonge.cooleshow.biz.dal.vo.CountVideoGroupVo;
+import com.yonge.cooleshow.biz.dal.vo.LessonGroupVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonAuthGroup;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonExamineVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupUpVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonPurchaseVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonShelvesVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonStudentDetailVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonTeacherVo;
 
 /**
  * VideoLessonGroupDao数据库访问类
@@ -48,8 +59,6 @@ public interface VideoLessonGroupDao extends BaseMapper<VideoLessonGroup> {
 
     VideoLessonAuthGroup authGroupDetil(@Param("videoGroupId") Long videoGroupId);
 
-    VideoLessonAuthGroup lastAuthGroupDetil(@Param("videoGroupId")Long videoGroupId,@Param("groupId") Long groupId);
-
     //根据组id查详情
     VideoLessonGroup selectGroupById(Long groupId);
 

+ 2 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/VideoLessonGroupDetailDao.java

@@ -34,4 +34,6 @@ public interface VideoLessonGroupDetailDao extends BaseMapper<VideoLessonGroupDe
     void deleteByGroupId(Long groupId);
 
     List<VideoLessonGroupDetailVo> selectPageAuth(IPage page, @Param("param") VideoLessonSearch query);
+    
+    List<VideoLessonGroupDetail> queryByVideoLessonGroupId(Long videoLessonGroupId);
 }

+ 13 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/VideoLessonGroupLogDao.java

@@ -0,0 +1,13 @@
+package com.yonge.cooleshow.biz.dal.dao;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupLog;
+import com.yonge.toolset.mybatis.dal.BaseDAO;
+
+public interface VideoLessonGroupLogDao extends BaseDAO<Long, VideoLessonGroupLog> {
+
+	Long queryMaxVersion(Long videoLessonGroupId);
+	
+	VideoLessonGroupLog queryByVideoLessonGroupId(@Param("videoLessonGroupId") Long videoLessonGroupId, @Param("version") Long version);
+}

+ 11 - 12
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/VideoLessonAuthRecord.java

@@ -24,10 +24,6 @@ public class VideoLessonAuthRecord extends BaseEntity {
     @ApiModelProperty(value = "当前视频课组id")
     private Long videoGroupId;
 
-    @TableField("group_id_")
-    @ApiModelProperty(value = "视频课组id")
-    private Long groupId;
-
     @TableField("audit_status_")
     @ApiModelProperty(value = "审核状态(DOING:待审核,PASS:通过,UNPASS:拒绝)")
     private String auditStatus;
@@ -55,6 +51,9 @@ public class VideoLessonAuthRecord extends BaseEntity {
     @TableField("update_time_")
     @ApiModelProperty(value = "修改时间")
     private Date updateTime;
+    
+    @TableField("version_")
+    private Long version;
 
     public Long getId() {
         return id;
@@ -120,14 +119,6 @@ public class VideoLessonAuthRecord extends BaseEntity {
         this.updateTime = updateTime;
     }
 
-    public Long getGroupId() {
-        return groupId;
-    }
-
-    public void setGroupId(Long groupId) {
-        this.groupId = groupId;
-    }
-
     public AuthTypeEnum getAuthType() {
         return authType;
     }
@@ -135,4 +126,12 @@ public class VideoLessonAuthRecord extends BaseEntity {
     public void setAuthType(AuthTypeEnum authType) {
         this.authType = authType;
     }
+
+	public Long getVersion() {
+		return version;
+	}
+
+	public void setVersion(Long version) {
+		this.version = version;
+	}
 }

+ 12 - 24
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/VideoLessonGroup.java

@@ -1,21 +1,23 @@
 package com.yonge.cooleshow.biz.dal.entity;
 
-import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
-import com.yonge.cooleshow.biz.dal.valid.AddGroup;
-import com.yonge.cooleshow.biz.dal.valid.UpdateGroup;
-import com.yonge.cooleshow.common.entity.BaseEntity;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.yonge.cooleshow.common.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.math.BigDecimal;
+import java.util.Date;
+
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
-import java.math.BigDecimal;
-import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
+import com.yonge.cooleshow.biz.dal.valid.AddGroup;
+import com.yonge.cooleshow.biz.dal.valid.UpdateGroup;
+import com.yonge.cooleshow.common.entity.BaseEntity;
+import com.yonge.cooleshow.common.enums.YesOrNoEnum;
 
 /**
  * 视频课基本信息表
@@ -121,16 +123,10 @@ public class VideoLessonGroup extends BaseEntity {
     @ApiModelProperty(value = "审批人id")
     private Integer auditId;
 
-
     @TableField("audit_version_")
     @ApiModelProperty(value = "是否审核时可见 (0:否  1:是)")
     private YesOrNoEnum auditVersion = YesOrNoEnum.NO;
 
-    @TableField("history_flag_")
-    @ApiModelProperty(value = "是否历史数据 (0:否  1:是)")
-    private YesOrNoEnum historyFlag;
-
-
     public Long getId() {
         return id;
     }
@@ -314,12 +310,4 @@ public class VideoLessonGroup extends BaseEntity {
     public void setShelvesId(Long shelvesId) {
         this.shelvesId = shelvesId;
     }
-
-    public YesOrNoEnum getHistoryFlag() {
-        return historyFlag;
-    }
-
-    public void setHistoryFlag(YesOrNoEnum historyFlag) {
-        this.historyFlag = historyFlag;
-    }
 }

+ 287 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/VideoLessonGroupLog.java

@@ -0,0 +1,287 @@
+package com.yonge.cooleshow.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 对应数据库表(video_lesson_group_log):
+ */
+public class VideoLessonGroupLog {
+
+	@ApiModelProperty(value = "主键",required = false)
+	private Long id;
+	
+	private Long videoLessonGroupId;
+	
+	@ApiModelProperty(value = "课程名称",required = false)
+	private String lessonName;
+	
+	@ApiModelProperty(value = "课程声部",required = false)
+	private String lessonSubject;
+	
+	@ApiModelProperty(value = "课程介绍",required = false)
+	private String lessonDesc;
+	
+	@ApiModelProperty(value = "课程价格",required = false)
+	private java.math.BigDecimal lessonPrice;
+	
+	@ApiModelProperty(value = "课程封面图片URL",required = false)
+	private String lessonCoverUrl;
+	
+	@ApiModelProperty(value = "老师ID",required = false)
+	private Long teacherId;
+	
+	@ApiModelProperty(value = "课程节数",required = false)
+	private Integer lessonCount;
+	
+	@ApiModelProperty(value = "排序号",required = false)
+	private Integer sortNumber;
+	
+	@ApiModelProperty(value = "课程标签",required = false)
+	private String lessonTag;
+	
+	@ApiModelProperty(value = "是否置顶",required = false)
+	private boolean topFlag;
+	
+	@ApiModelProperty(value = "是否热门课程",required = false)
+	private boolean hotFlag;
+	
+	@ApiModelProperty(value = "是否上架 (0:否  1:是)",required = false)
+	private Integer shelvesFlag;
+	
+	@ApiModelProperty(value = "上下架时间",required = false)
+	private java.util.Date shelvesTime;
+	
+	@ApiModelProperty(value = "上下架原因",required = false)
+	private String shelvesReason;
+	
+	@ApiModelProperty(value = "上下架人",required = false)
+	private Long shelvesId;
+	
+	@ApiModelProperty(value = "修改人id",required = false)
+	private Long modifierId;
+	
+	@ApiModelProperty(value = "备注",required = false)
+	private String remarks;
+	
+	@ApiModelProperty(value = "是否审核时可见 (0:否  1:是)",required = false)
+	private Integer auditVersion;
+	
+	@ApiModelProperty(value = "创建时间",required = false)
+	private java.util.Date createTime;
+	
+	@ApiModelProperty(value = "更新时间",required = false)
+	private java.util.Date updateTime;
+	
+	private Long version;
+	
+	public VideoLessonGroupLog setId(Long id){
+		this.id = id;
+		return this;
+	}
+	
+	public Long getVideoLessonGroupId() {
+		return videoLessonGroupId;
+	}
+
+	public void setVideoLessonGroupId(Long videoLessonGroupId) {
+		this.videoLessonGroupId = videoLessonGroupId;
+	}
+
+	public Long getId(){
+		return this.id;
+	}
+			
+	public VideoLessonGroupLog setLessonName(String lessonName){
+		this.lessonName = lessonName;
+		return this;
+	}
+	
+	public String getLessonName(){
+		return this.lessonName;
+	}
+			
+	public VideoLessonGroupLog setLessonSubject(String lessonSubject){
+		this.lessonSubject = lessonSubject;
+		return this;
+	}
+	
+	public String getLessonSubject(){
+		return this.lessonSubject;
+	}
+			
+	public VideoLessonGroupLog setLessonDesc(String lessonDesc){
+		this.lessonDesc = lessonDesc;
+		return this;
+	}
+	
+	public String getLessonDesc(){
+		return this.lessonDesc;
+	}
+			
+	public VideoLessonGroupLog setLessonPrice(java.math.BigDecimal lessonPrice){
+		this.lessonPrice = lessonPrice;
+		return this;
+	}
+	
+	public java.math.BigDecimal getLessonPrice(){
+		return this.lessonPrice;
+	}
+			
+	public VideoLessonGroupLog setLessonCoverUrl(String lessonCoverUrl){
+		this.lessonCoverUrl = lessonCoverUrl;
+		return this;
+	}
+	
+	public String getLessonCoverUrl(){
+		return this.lessonCoverUrl;
+	}
+			
+	public VideoLessonGroupLog setTeacherId(Long teacherId){
+		this.teacherId = teacherId;
+		return this;
+	}
+	
+	public Long getTeacherId(){
+		return this.teacherId;
+	}
+			
+	public VideoLessonGroupLog setLessonCount(Integer lessonCount){
+		this.lessonCount = lessonCount;
+		return this;
+	}
+	
+	public Integer getLessonCount(){
+		return this.lessonCount;
+	}
+			
+	public VideoLessonGroupLog setSortNumber(Integer sortNumber){
+		this.sortNumber = sortNumber;
+		return this;
+	}
+	
+	public Integer getSortNumber(){
+		return this.sortNumber;
+	}
+			
+	public VideoLessonGroupLog setLessonTag(String lessonTag){
+		this.lessonTag = lessonTag;
+		return this;
+	}
+	
+	public String getLessonTag(){
+		return this.lessonTag;
+	}
+			
+	public VideoLessonGroupLog setTopFlag(boolean topFlag){
+		this.topFlag = topFlag;
+		return this;
+	}
+	
+	public boolean isTopFlag(){
+		return this.topFlag;
+	}
+			
+	public VideoLessonGroupLog setHotFlag(boolean hotFlag){
+		this.hotFlag = hotFlag;
+		return this;
+	}
+	
+	public boolean isHotFlag(){
+		return this.hotFlag;
+	}
+			
+	public VideoLessonGroupLog setShelvesFlag(Integer shelvesFlag){
+		this.shelvesFlag = shelvesFlag;
+		return this;
+	}
+	
+	public Integer getShelvesFlag(){
+		return this.shelvesFlag;
+	}
+			
+	public VideoLessonGroupLog setShelvesTime(java.util.Date shelvesTime){
+		this.shelvesTime = shelvesTime;
+		return this;
+	}
+	
+	public java.util.Date getShelvesTime(){
+		return this.shelvesTime;
+	}
+			
+	public VideoLessonGroupLog setShelvesReason(String shelvesReason){
+		this.shelvesReason = shelvesReason;
+		return this;
+	}
+	
+	public String getShelvesReason(){
+		return this.shelvesReason;
+	}
+			
+	public VideoLessonGroupLog setShelvesId(Long shelvesId){
+		this.shelvesId = shelvesId;
+		return this;
+	}
+	
+	public Long getShelvesId(){
+		return this.shelvesId;
+	}
+			
+	public Long getModifierId() {
+		return modifierId;
+	}
+
+	public void setModifierId(Long modifierId) {
+		this.modifierId = modifierId;
+	}
+
+	public VideoLessonGroupLog setRemarks(String remarks){
+		this.remarks = remarks;
+		return this;
+	}
+	
+	public String getRemarks(){
+		return this.remarks;
+	}
+			
+	public VideoLessonGroupLog setAuditVersion(Integer auditVersion){
+		this.auditVersion = auditVersion;
+		return this;
+	}
+	
+	public Integer getAuditVersion(){
+		return this.auditVersion;
+	}
+			
+	public VideoLessonGroupLog setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+		return this;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	public VideoLessonGroupLog setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+		return this;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	public Long getVersion() {
+		return version;
+	}
+
+	public void setVersion(Long version) {
+		this.version = version;
+	}
+
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 11 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/VideoLessonGroupLogService.java

@@ -0,0 +1,11 @@
+package com.yonge.cooleshow.biz.dal.service;
+
+import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupLog;
+import com.yonge.toolset.mybatis.service.BaseService;
+
+public interface VideoLessonGroupLogService extends BaseService<Long, VideoLessonGroupLog> {
+
+	Long queryMaxVersion(Long videoLessonGroupId);
+	
+	VideoLessonGroupLog queryByVideoLessonGroupId(Long videoLessonGroupId, Long version);
+}

+ 3 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetAuthRecordServiceImpl.java

@@ -38,6 +38,9 @@ public class MusicSheetAuthRecordServiceImpl extends ServiceImpl<MusicSheetAuthR
         // 替换审核id
         replaceAuthRecord(param, musicSheetAuthRecord);
         musicSheetAuthRecord.setMusicSheetId(param.getMusicSheetId());
+        if (param.getAuthStatus().equals(AuthStatusEnum.PASS)) {
+            musicSheetAuthRecord.setMusicSheetId(musicSheetAuthRecord.getOriginalMusicSheetId());
+        }
         musicSheetAuthRecord.setAuditState(param.getAuthStatus());
         musicSheetAuthRecord.setReason(param.getRemark());
         musicSheetAuthRecord.setVerifyUserId(userId);
@@ -59,7 +62,6 @@ public class MusicSheetAuthRecordServiceImpl extends ServiceImpl<MusicSheetAuthR
                 this.saveOrUpdate(record);
             }
 
-            musicSheetAuthRecord.setMusicSheetId(musicSheetAuthRecord.getOriginalMusicSheetId());
         }
     }
 

+ 3 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetServiceImpl.java

@@ -425,6 +425,9 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
                                                                                                                       musicSheet.getId()))
                                                                                                               .collect(Collectors.toList());
             musicSheetAccompanimentList.addAll(originalMusicSheetAccompanimentList);
+            if (CollectionUtils.isEmpty(musicSheetAccompanimentList)) {
+                return;
+            }
             musicSheetAccompanimentService.saveOrUpdateBatch(musicSheetAccompanimentList);
         }
     }

+ 33 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/VideoLessonGroupLogServiceImpl.java

@@ -0,0 +1,33 @@
+package com.yonge.cooleshow.biz.dal.service.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.yonge.cooleshow.biz.dal.dao.VideoLessonGroupLogDao;
+import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupLog;
+import com.yonge.cooleshow.biz.dal.service.VideoLessonGroupLogService;
+import com.yonge.toolset.mybatis.dal.BaseDAO;
+import com.yonge.toolset.mybatis.service.impl.BaseServiceImpl;
+
+@Service
+public class VideoLessonGroupLogServiceImpl extends BaseServiceImpl<Long, VideoLessonGroupLog>  implements VideoLessonGroupLogService {
+	
+	@Autowired
+	private VideoLessonGroupLogDao videoLessonGroupLogDao;
+
+	@Override
+	public BaseDAO<Long, VideoLessonGroupLog> getDAO() {
+		return videoLessonGroupLogDao;
+	}
+
+	@Override
+	public Long queryMaxVersion(Long videoLessonGroupId) {
+		return videoLessonGroupLogDao.queryMaxVersion(videoLessonGroupId);
+	}
+
+	@Override
+	public VideoLessonGroupLog queryByVideoLessonGroupId(Long videoLessonGroupId, Long version) {
+		return videoLessonGroupLogDao.queryByVideoLessonGroupId(videoLessonGroupId, version);
+	}
+	
+}

+ 123 - 57
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/VideoLessonGroupServiceImpl.java

@@ -1,5 +1,20 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -10,32 +25,42 @@ import com.yonge.cooleshow.biz.dal.dao.TeacherDao;
 import com.yonge.cooleshow.biz.dal.dao.VideoLessonAuthRecordDao;
 import com.yonge.cooleshow.biz.dal.dao.VideoLessonGroupDao;
 import com.yonge.cooleshow.biz.dal.dao.VideoLessonGroupDetailDao;
-import com.yonge.cooleshow.biz.dal.dto.LiveSaleOutDto;
 import com.yonge.cooleshow.biz.dal.dto.search.VideoGroupSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.VideoLessonGroupSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.VideoLessonSearch;
-import com.yonge.cooleshow.biz.dal.entity.*;
-import com.yonge.cooleshow.biz.dal.enums.*;
+import com.yonge.cooleshow.biz.dal.entity.Subject;
+import com.yonge.cooleshow.biz.dal.entity.Teacher;
+import com.yonge.cooleshow.biz.dal.entity.VideoLessonAuthRecord;
+import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroup;
+import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupDetail;
+import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupLog;
+import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
+import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
+import com.yonge.cooleshow.biz.dal.enums.MessageTypeEnum;
+import com.yonge.cooleshow.biz.dal.enums.TeacherTagEnum;
 import com.yonge.cooleshow.biz.dal.service.SysConfigService;
 import com.yonge.cooleshow.biz.dal.service.SysMessageService;
 import com.yonge.cooleshow.biz.dal.service.TeacherService;
+import com.yonge.cooleshow.biz.dal.service.VideoLessonGroupLogService;
 import com.yonge.cooleshow.biz.dal.service.VideoLessonGroupService;
-import com.yonge.cooleshow.biz.dal.vo.*;
+import com.yonge.cooleshow.biz.dal.vo.CountVideoGroupVo;
+import com.yonge.cooleshow.biz.dal.vo.LessonGroupVo;
+import com.yonge.cooleshow.biz.dal.vo.ShareProfitVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonAuthGroup;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonExamineVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupUpVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonPurchaseVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonShelvesVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonStudentDetailVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonStudentVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonTeacherVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonVo;
 import com.yonge.cooleshow.common.constant.SysConfigConstant;
 import com.yonge.cooleshow.common.enums.YesOrNoEnum;
 import com.yonge.toolset.base.exception.BizException;
 import com.yonge.toolset.base.string.MessageFormatter;
 import com.yonge.toolset.thirdparty.message.MessageSenderPluginContext;
-import io.netty.util.internal.StringUtil;
-import org.apache.commons.collections.CollectionUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.*;
-import java.util.stream.Collectors;
 
 /**
  * VideoLessonGroupService服务实现类
@@ -67,6 +92,9 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
 
     @Autowired
     private SysConfigService sysConfigService;
+    
+    @Autowired
+    private VideoLessonGroupLogService videoLessonGroupLogService;
 
     public VideoLessonGroupDao getDao() {
         return videoLessonGroupDao;
@@ -79,12 +107,14 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
      */
     @Override
     public IPage<VideoLessonGroupVo> selectPage(IPage<VideoLessonGroupVo> page, VideoLessonGroupSearch query) {
-        if(!StringUtil.isNullOrEmpty(query.getAuditStatus())){
-            if(query.getAuditStatus().equals("OUT_SALE")){
+        if(org.apache.commons.lang3.StringUtils.isNotBlank(query.getAuditStatus())){
+            if(query.getAuditStatus().equals(AuthStatusEnum.OUT_SALE.getCode())){
                 query.setAuditStatus(null);
                 query.setShelvesFlag(0);
-            }else{
+            }else if(query.getAuditStatus().equals(AuthStatusEnum.PASS.getCode())){
                 query.setShelvesFlag(1);
+            }else{
+            	query.setShelvesFlag(0);
             }
         }
         return page.setRecords(baseMapper.selectPage(page, query));
@@ -136,6 +166,7 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
         record.setAuditId(examineVo.getAuditId());
         record.setAuditName(examineVo.getAuditName());
         record.setRemarks(examineVo.getRemarks());
+        record.setVersion(videoLessonGroupLogService.queryMaxVersion(examineVo.getId()));
         recordDao.insert(record);
 
         //清状态
@@ -229,6 +260,8 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
         if (!longList.contains(subjectId)) {
             throw new BizException("该声部无法选择");
         }
+        
+        Date date = new Date();
 
         //添加组
         lessonGroup.setTeacherId(sysUser.getId());
@@ -249,12 +282,28 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
         videoLessonGroupDao.updateGroup(groupUpVo);
 
         //记录video_lesson_auth_record
-        VideoLessonAuthRecord record = new VideoLessonAuthRecord();
+        /*VideoLessonAuthRecord record = new VideoLessonAuthRecord();
         record.setVideoGroupId(lessonGroup.getId());
         record.setGroupId(lessonGroup.getId());
         record.setAuditStatus(AuthStatusEnum.DOING.getCode());
         record.setAuthType(AuthTypeEnum.ADD);
-        recordDao.insert(record);
+        recordDao.insert(record);*/
+        
+        VideoLessonGroupLog  videoLessonGroupLog = new VideoLessonGroupLog();
+        
+        try {
+			org.springframework.beans.BeanUtils.copyProperties(lessonGroup, videoLessonGroupLog);
+		} catch (Exception e) {
+			throw new BizException("属性复制失败");
+		}
+        videoLessonGroupLog.setId(null);
+        videoLessonGroupLog.setVideoLessonGroupId(lessonGroup.getId());
+        videoLessonGroupLog.setCreateTime(date);
+        videoLessonGroupLog.setUpdateTime(date);
+        videoLessonGroupLog.setModifierId(sysUser.getId());
+        videoLessonGroupLog.setVersion(videoLessonGroupLogService.queryMaxVersion(lessonGroup.getId()) + 1);
+        
+        videoLessonGroupLogService.insert(videoLessonGroupLog);
     }
 
     /**
@@ -299,6 +348,12 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
         VideoLessonGroupVo videoLessonGroupVo = detail(groupId);
         if (videoLessonGroupVo == null) return lessonStudentVo;
 
+        Teacher teacher = teacherService.getById(videoLessonGroupVo.getTeacherId());
+        if (teacher != null) {
+            lessonStudentVo.setTeacherFlag(teacher.getTeacherFlag());
+            lessonStudentVo.setDegreeFlag(teacher.getDegreeFlag());
+        }
+
         lessonStudentVo.setLessonGroup(videoLessonGroupVo);
         VideoLessonSearch search = new VideoLessonSearch();
         search.setVideoLessonGroupId(groupId);
@@ -322,15 +377,17 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
      * @Date: 2022/4/7
      */
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public void update(VideoLessonVo lessonVo, SysUser sysUser) {
         VideoLessonGroup lessonGroup = lessonVo.getLessonGroup();
         List<VideoLessonGroupDetail> lessonList = lessonVo.getLessonList();
         //判断是否有正在审核中
-        List<VideoLessonAuthRecord> videoLessonAuthRecords = recordDao.selectList(Wrappers.<VideoLessonAuthRecord>lambdaQuery()
-                .eq(VideoLessonAuthRecord::getGroupId, lessonGroup.getId())
-                .eq(VideoLessonAuthRecord::getAuditStatus, AuthStatusEnum.DOING.getCode()));
+        QueryWrapper<VideoLessonAuthRecord> wrapper = new QueryWrapper<VideoLessonAuthRecord>();
+        wrapper.eq("video_group_id_", lessonGroup.getId()).eq("audit_status_", AuthStatusEnum.DOING.getCode());
+        
+        List<VideoLessonAuthRecord> videoLessonAuthRecords = recordDao.selectList(wrapper);
         if(CollectionUtils.isNotEmpty(videoLessonAuthRecords)){
-            return;
+        	throw new BizException("正在审核中,无法修改");
         }
 
         //校验声部
@@ -340,37 +397,54 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
         if (!longList.contains(subjectId)) {
             throw new BizException("该声部无法选择");
         }
+        
+        Date date = new Date();
 
-        //创建新的评审记录
+        /*//创建新的评审记录
         VideoLessonAuthRecord authRecord = new VideoLessonAuthRecord();
         authRecord.setGroupId(lessonGroup.getId());
-
-        //创建新的课程组记录
-        lessonGroup.setTeacherId(sysUser.getId());
+        authRecord.setAuditStatus(AuthStatusEnum.DOING.getCode());
+        authRecord.setAuthType(AuthTypeEnum.MODIFY);
+        authRecord.setVideoGroupId(lessonGroup.getId());
+        //提交审核
+        recordDao.insert(authRecord);*/
+        
+        VideoLessonGroupLog  videoLessonGroupLog = new VideoLessonGroupLog();
+        
+        try {
+			org.springframework.beans.BeanUtils.copyProperties(lessonGroup, videoLessonGroupLog);
+		} catch (Exception e) {
+			throw new BizException("属性复制失败");
+		}
+        
+        videoLessonGroupLog.setId(null);
+        videoLessonGroupLog.setVideoLessonGroupId(lessonGroup.getId());
+        videoLessonGroupLog.setCreateTime(date);
+        videoLessonGroupLog.setUpdateTime(date);
+        videoLessonGroupLog.setModifierId(sysUser.getId());
+        videoLessonGroupLog.setVersion(videoLessonGroupLogService.queryMaxVersion(lessonGroup.getId()) + 1);
+        
+        videoLessonGroupLogService.insert(videoLessonGroupLog);
+
+        //修改课程组记录
         lessonGroup.setAuditVersion(YesOrNoEnum.NO);
-        lessonGroup.setHistoryFlag(YesOrNoEnum.YES);
         lessonGroup.setAuditStatus(AuthStatusEnum.DOING);
-        lessonGroup.setId(null);
-        videoLessonGroupDao.insert(lessonGroup);
-        authRecord.setVideoGroupId(lessonGroup.getId());
-
-        for (VideoLessonGroupDetail detail : lessonList) {
-            detail.setId(null);
-            detail.setVideoLessonGroupId(lessonGroup.getId());
-            detail.setTeacherId(sysUser.getId());
-        }
-        videoLessonGroupDetailDao.insertVideoLesson(lessonList);
+        lessonGroup.setUpdateTime(date);
+        videoLessonGroupDao.updateById(lessonGroup);
+        
+		if (lessonList != null && lessonList.size() > 0) {
+			for (VideoLessonGroupDetail detail : lessonList) {
+				detail.setVideoLessonGroupId(lessonGroup.getId());
+				detail.setTeacherId(sysUser.getId());
+			}
+			// 添加课程
+			videoLessonGroupDetailDao.insertVideoLesson(lessonList);
+		}
 
         //刷新统计
         VideoLessonGroupUpVo groupUpVo = new VideoLessonGroupUpVo();
         groupUpVo.setId(lessonGroup.getId());
         videoLessonGroupDao.updateGroup(groupUpVo);
-
-        //提交审核
-        authRecord.setAuditStatus(AuthStatusEnum.DOING.getCode());
-        authRecord.setAuthType(AuthTypeEnum.MODIFY);
-
-        recordDao.insert(authRecord);
     }
 
     /**
@@ -382,7 +456,7 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
     public IPage<LessonGroupVo> selectLessonGroup(IPage<LessonGroupVo> page, VideoLessonGroupSearch query) {
         query.setAuditStatus(AuthStatusEnum.PASS.getCode());
 
-        if(!StringUtil.isNullOrEmpty(query.getAuditStatus())){
+        if(org.apache.commons.lang3.StringUtils.isNoneBlank(query.getAuditStatus())){
             if(query.getAuditStatus().equals("OUT_SALE")){
                 query.setAuditStatus(null);
                 query.setShelvesFlag(0);
@@ -412,21 +486,13 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
     public VideoLessonAuthGroup authGroupDetil(Long videoGroupId) {
         VideoLessonAuthGroup videoLessonAuthGroup = baseMapper.authGroupDetil(videoGroupId);
 
-        List<VideoLessonGroupDetail> details = videoLessonGroupDetailDao.selectList(Wrappers.<VideoLessonGroupDetail>lambdaQuery()
-                .eq(VideoLessonGroupDetail::getVideoLessonGroupId, videoGroupId));
+        List<VideoLessonGroupDetail> details = videoLessonGroupDetailDao.queryByVideoLessonGroupId(videoGroupId);
         videoLessonAuthGroup.setVideoList(details);
 
         //查询上一次的提交
-        VideoLessonAuthGroup lastDetil = baseMapper.lastAuthGroupDetil(
-                videoGroupId, videoLessonAuthGroup.getGroupId());
-
-        if(null != lastDetil){
-            List<VideoLessonGroupDetail> lastDetails = videoLessonGroupDetailDao.selectList(Wrappers.<VideoLessonGroupDetail>lambdaQuery()
-                    .eq(VideoLessonGroupDetail::getVideoLessonGroupId, lastDetil.getVideoGroupId()));
-            lastDetil.setVideoList(lastDetails);
-
-            videoLessonAuthGroup.setLastDetil(lastDetil);
-        }
+        VideoLessonGroupLog lastDetil = videoLessonGroupLogService.queryByVideoLessonGroupId(videoGroupId, videoLessonAuthGroup.getVersion());
+        videoLessonAuthGroup.setLastVideoLessonGroupLog(lastDetil);
+        
         return videoLessonAuthGroup;
     }
 

+ 23 - 21
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/VideoLessonAuthGroup.java

@@ -1,12 +1,14 @@
 package com.yonge.cooleshow.biz.dal.vo;
 
-import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroup;
-import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupDetail;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.util.List;
 
+import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroup;
+import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupDetail;
+import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupLog;
+
 /**
  * @Author: cy
  * @Date: 2022/4/20
@@ -19,9 +21,6 @@ public class VideoLessonAuthGroup extends VideoLessonGroup {
     @ApiModelProperty(value = "当前视频组id")
     private Long videoGroupId;
 
-    @ApiModelProperty(value = "历史记录所属视频组id")
-    private Long groupId;
-
     private String realName;
 
     @ApiModelProperty(value = "老师手机号")
@@ -36,8 +35,10 @@ public class VideoLessonAuthGroup extends VideoLessonGroup {
     @ApiModelProperty("视频集合")
     private List<VideoLessonGroupDetail> videoList;
 
-    @ApiModelProperty("上一次的审核对象")
-    private VideoLessonAuthGroup lastDetil;
+    @ApiModelProperty("上一次的修改记录")
+    private VideoLessonGroupLog lastVideoLessonGroupLog;
+    
+    private Long version;
 
     public String getRemarks() {
         return remarks;
@@ -87,14 +88,6 @@ public class VideoLessonAuthGroup extends VideoLessonGroup {
         this.videoGroupId = videoGroupId;
     }
 
-    public Long getGroupId() {
-        return groupId;
-    }
-
-    public void setGroupId(Long groupId) {
-        this.groupId = groupId;
-    }
-
     public List<VideoLessonGroupDetail> getVideoList() {
         return videoList;
     }
@@ -103,11 +96,20 @@ public class VideoLessonAuthGroup extends VideoLessonGroup {
         this.videoList = videoList;
     }
 
-    public VideoLessonAuthGroup getLastDetil() {
-        return lastDetil;
-    }
+	public VideoLessonGroupLog getLastVideoLessonGroupLog() {
+		return lastVideoLessonGroupLog;
+	}
+
+	public void setLastVideoLessonGroupLog(VideoLessonGroupLog lastVideoLessonGroupLog) {
+		this.lastVideoLessonGroupLog = lastVideoLessonGroupLog;
+	}
+
+	public Long getVersion() {
+		return version;
+	}
+
+	public void setVersion(Long version) {
+		this.version = version;
+	}
 
-    public void setLastDetil(VideoLessonAuthGroup lastDetil) {
-        this.lastDetil = lastDetil;
-    }
 }

+ 0 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/EmployeeMapper.xml

@@ -83,7 +83,6 @@
         FROM employee t
         left join sys_user u on t.user_id_ = u.id_
         <where>
-            u.del_flag_ = 0
             <if test="null != param.search and '' != param.search">
                 AND (
                 t.user_id_ LIKE CONCAT('%', #{param.search}, '%') or

+ 1 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/HomeMapper.xml

@@ -13,7 +13,7 @@
         	(select count(1) from music_sheet a
 				left join sys_user u on a.user_id_ = u.id_
 			 	where u.del_flag_ =0 and a.del_flag_ = 0 and a.audit_status_ = 'DOING') as musicNum,
-        	(select count(1) from video_lesson_auth_record where audit_status_ = 'DOING') as videoCourseNum,
+        	(select count(1) from video_lesson_group where audit_status_ = 'DOING') as videoCourseNum,
 			(select count(1) from teacher_style_video a
 				left join sys_user u on a.user_id_ = u.id_
 			 	where u.del_flag_ =0 and a.del_flag_ = 0 and a.auth_status_ = 'DOING') as styleNum

+ 4 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/VideoLessonGroupDetailMapper.xml

@@ -126,5 +126,9 @@
 		FROM video_lesson_group_detail
 		WHERE video_lesson_group_id_ = #{groupId}
 	</delete>
+	
+	<select id="queryByVideoLessonGroupId" resultMap="BaseResultMap">
+		select * from video_lesson_group_detail WHERE video_lesson_group_id_ = #{videoLessonGroupId}
+	</select>
 
 </mapper>

+ 157 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/VideoLessonGroupLogMapper.xml

@@ -0,0 +1,157 @@
+<?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.yonge.cooleshow.biz.dal.dao.VideoLessonGroupLogDao">
+
+	<resultMap type="com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupLog"
+		id="BaseResultMap">
+		<result column="id_" property="id" />
+		<result column="video_lesson_group_id_" property="videoLessonGroupId" />
+		<result column="lesson_name_" property="lessonName" />
+		<result column="lesson_subject_" property="lessonSubject" />
+		<result column="lesson_desc_" property="lessonDesc" />
+		<result column="lesson_price_" property="lessonPrice" />
+		<result column="lesson_cover_url_" property="lessonCoverUrl" />
+		<result column="teacher_id_" property="teacherId" />
+		<result column="lesson_count_" property="lessonCount" />
+		<result column="sort_number_" property="sortNumber" />
+		<result column="lesson_tag_" property="lessonTag" />
+		<result column="top_flag_" property="topFlag" />
+		<result column="hot_flag_" property="hotFlag" />
+		<result column="shelves_flag_" property="shelvesFlag" />
+		<result column="shelves_time_" property="shelvesTime" />
+		<result column="shelves_reason_" property="shelvesReason" />
+		<result column="shelves_id_" property="shelvesId" />
+		<result column="modifier_id_" property="modifierId" />
+		<result column="remarks" property="remarks" />
+		<result column="audit_version_" property="auditVersion" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+		<result column="version_" property="version" />
+	</resultMap>
+
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="BaseResultMap">
+		SELECT * FROM
+		video_lesson_group_log WHERE id_ = #{id}
+	</select>
+
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="BaseResultMap">
+		SELECT * FROM
+		video_lesson_group_log ORDER BY id_
+	</select>
+
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert"
+		parameterType="com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupLog"
+		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO
+		video_lesson_group_log
+		(id_,video_lesson_group_id_,lesson_name_,lesson_subject_,lesson_desc_,lesson_price_,lesson_cover_url_,teacher_id_,lesson_count_,sort_number_,lesson_tag_,top_flag_,hot_flag_,shelves_flag_,shelves_time_,shelves_reason_,shelves_id_,modifier_id_,remarks,audit_version_,create_time_,update_time_,version_)
+		VALUES(#{id},#{videoLessonGroupId},#{lessonName},#{lessonSubject},#{lessonDesc},#{lessonPrice},#{lessonCoverUrl},#{teacherId},#{lessonCount},#{sortNumber},#{lessonTag},#{topFlag},#{hotFlag},#{shelvesFlag},#{shelvesTime},#{shelvesReason},#{shelvesId},#{modifierId},#{remarks},#{auditVersion},#{createTime},#{updateTime},#{version})
+	</insert>
+
+	<!-- 根据主键查询一条记录 -->
+	<update id="update"
+		parameterType="com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupLog">
+		UPDATE video_lesson_group_log
+		<set>
+			<if test="lessonCount != null">
+				lesson_count_ = #{lessonCount},
+			</if>
+			<if test="lessonSubject != null">
+				lesson_subject_ = #{lessonSubject},
+			</if>
+			<if test="lessonDesc != null">
+				lesson_desc_ = #{lessonDesc},
+			</if>
+			<if test="modifierId != null">
+				modifier_id_ = #{modifierId},
+			</if>
+			<if test="topFlag != null">
+				top_flag_ = #{topFlag},
+			</if>
+			<if test="shelvesFlag != null">
+				shelves_flag_ = #{shelvesFlag},
+			</if>
+			<if test="id != null">
+				id_ = #{id},
+			</if>
+			<if test="shelvesId != null">
+				shelves_id_ = #{shelvesId},
+			</if>
+			<if test="lessonCoverUrl != null">
+				lesson_cover_url_ = #{lessonCoverUrl},
+			</if>
+			<if test="shelvesTime != null">
+				shelves_time_ = #{shelvesTime},
+			</if>
+			<if test="shelvesReason != null">
+				shelves_reason_ = #{shelvesReason},
+			</if>
+			<if test="sortNumber != null">
+				sort_number_ = #{sortNumber},
+			</if>
+			<if test="hotFlag != null">
+				hot_flag_ = #{hotFlag},
+			</if>
+			<if test="createTime != null">
+				create_time_ = #{createTime},
+			</if>
+			<if test="auditVersion != null">
+				audit_version_ = #{auditVersion},
+			</if>
+			<if test="teacherId != null">
+				teacher_id_ = #{teacherId},
+			</if>
+			<if test="lessonPrice != null">
+				lesson_price_ = #{lessonPrice},
+			</if>
+			<if test="updateTime != null">
+				update_time_ = #{updateTime},
+			</if>
+			<if test="lessonName != null">
+				lesson_name_ = #{lessonName},
+			</if>
+			<if test="remarks != null">
+				remarks = #{remarks},
+			</if>
+			<if test="lessonTag != null">
+				lesson_tag_ = #{lessonTag},
+			</if>
+			<if test="videoLessonGroupId != null">
+				video_lesson_group_id_ = #{videoLessonGroupId},
+			</if>
+			<if test="version != null">
+				version_ = #{version},
+			</if>
+		</set>
+		WHERE id_ = #{id}
+	</update>
+
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete">
+		DELETE FROM video_lesson_group_log WHERE id_
+		= #{id}
+	</delete>
+
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="BaseResultMap" parameterType="map">
+		SELECT * FROM video_lesson_group_log ORDER BY id_
+		<include refid="global.limit" />
+	</select>
+
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM video_lesson_group_log
+	</select>
+	
+	<select id="queryMaxVersion" resultType="long">
+		SELECT ifnull(max(version_),0) FROM video_lesson_group_log where video_lesson_group_id_ = #{videoLessonGroupId}
+	</select>
+	
+	<select id="queryByVideoLessonGroupId" resultMap="BaseResultMap">
+		SELECT * FROM video_lesson_group_log where video_lesson_group_id_ = #{videoLessonGroupId} and version_ = #{version}
+	</select>
+</mapper>

+ 77 - 52
cooleshow-user/user-biz/src/main/resources/config/mybatis/VideoLessonGroupMapper.xml

@@ -24,7 +24,6 @@
 		<result column="audit_name_" jdbcType="VARCHAR" property="auditName" />
 		<result column="create_time_" jdbcType="TIMESTAMP" property="createTime" />
 		<result column="update_time_" jdbcType="TIMESTAMP" property="updateTime" />
-		<result column="history_flag_" property="historyFlag" />
 	</resultMap>
 
 	<sql id="baseColumns">
@@ -50,7 +49,6 @@
 		g.update_time_ AS updateTime,
 		g.audit_id_ AS auditId,
 		g.audit_name_ AS auditName,
-		g.history_flag_ AS historyFlag,
 	</sql>
 	<sql id="recordColumns">
 		g.id_ AS id,
@@ -70,9 +68,10 @@
 		g.shelves_reason_ as shelvesReason,
 		g.create_time_ AS createTime,
 		g.update_time_ AS updateTime,
-		g.audit_id_ AS auditId,
-		g.audit_name_ AS auditName,
-		g.history_flag_ AS historyFlag,
+		r.audit_id_ AS auditId,
+		r.audit_name_ AS auditName,
+		r.audit_status_ AS auditStatus,
+		g.audit_version_ as auditVersion,
 	</sql>
 
 	<update id="updateGroup" parameterType="com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupUpVo">
@@ -128,7 +127,6 @@
 		LEFT JOIN sys_user s ON g.teacher_id_ = s.id_
 		LEFT JOIN `subject` b ON g.lesson_subject_=b.id_
 		<where>
-		    and g.history_flag_ = 0
 			<if test="param.shelvesFlag !=null">
 				AND g.shelves_flag_ = #{param.shelvesFlag}
 			</if>
@@ -172,7 +170,6 @@
 		LEFT JOIN sys_user s ON g.teacher_id_ = s.id_
 		LEFT JOIN subject j ON g.lesson_subject_ = j.id_
 		<where>
-			AND g.history_flag_ = 0
 			<if test="param.userId !=null">
 				AND p.student_id_ = #{param.userId}
 			</if>
@@ -219,7 +216,6 @@
 		FROM video_lesson_group g
 		LEFT JOIN subject j ON g.lesson_subject_ = j.id_
 		<where>
-			AND g.history_flag_ = 0
 			<if test="param.userId !=null">
 				AND g.teacher_id_ = #{param.userId}
 			</if>
@@ -293,7 +289,7 @@
 		LEFT JOIN sys_user u ON g.teacher_id_=u.id_
 		LEFT JOIN `subject` s ON g.lesson_subject_ = s.id_
 		<where>
-			AND g.history_flag_ = 0 and u.del_flag_ = 0
+			AND  u.del_flag_ = 0
 			<if test="null != param.search and '' != param.search">
 				AND (
 				u.username_ LIKE CONCAT('%', #{param.search}, '%') OR
@@ -324,26 +320,35 @@
 	</select>
 	<select id="queryGroupList" resultType="com.yonge.cooleshow.biz.dal.vo.VideoLessonAuthGroup">
 		SELECT
-			<include refid="recordColumns"/>
-			r.video_group_id_ as videoGroupId,
-			r.group_id_ as groupId,
-			r.audit_status_ AS auditStatus,
-			r.remarks as remarks,
+			g.id_ AS id,
+			g.lesson_name_ AS lessonName,
+			g.lesson_subject_ AS lessonSubject,
+			g.lesson_desc_ AS lessonDesc,
+			g.lesson_price_ AS lessonPrice,
+			g.lesson_cover_url_ AS lessonCoverUrl,
+			g.teacher_id_ AS teacherId,
+			g.lesson_count_ AS lessonCount,
+			g.sort_number_ AS sortNumber,
+			g.lesson_tag_ AS lessonTag,
+			g.top_flag_ AS topFlag,
+			g.hot_flag_ AS hotFlag,
+			g.shelves_flag_ AS shelvesFlag,
+			g.shelves_time_ as shelvesTime,
+			g.shelves_reason_ as shelvesReason,
+			g.create_time_ AS createTime,
+			g.update_time_ AS updateTime,
+			g.audit_id_ AS auditId,
+			g.audit_name_ AS auditName,
+			g.audit_status_ AS auditStatus,
+			g.audit_version_ as auditVersion,
 			s.name_ AS subjectName,
 			t.username_ AS teacherName,
 			t.real_name_ AS realName,
 			t.phone_ AS teacherPhone
-		FROM (
-			select group_id_,max(id_) as id_ from video_lesson_auth_record group by group_id_
-		) a
-		LEFT JOIN video_lesson_auth_record r ON a.id_ = r.id_
-		LEFT JOIN video_lesson_group g ON g.id_=r.video_group_id_
+		FROM video_lesson_group g
 		LEFT JOIN `subject` s ON g.lesson_subject_=s.id_
 		LEFT JOIN sys_user t ON g.teacher_id_=t.id_
 		<where>
-			<if test="null != param.groupId">
-				AND r.group_id_ = #{param.groupId}
-			</if>
 			<if test="null != param.search and '' != param.search">
 				AND (
 					g.id_ LIKE CONCAT('%', #{param.search}, '%') OR
@@ -354,7 +359,7 @@
 				)
 			</if>
 			<if test="param.auditStatus !=null and param.auditStatus !=''">
-				AND r.audit_status_ = #{param.auditStatus}
+				AND g.audit_status_ = #{param.auditStatus}
 			</if>
 			<if test="param.shelvesFlag !=null">
 				AND g.shelves_flag_ = #{param.shelvesFlag}
@@ -363,7 +368,7 @@
 				AND g.lesson_subject_ = #{param.subjectId}
 			</if>
 			<if test="param.auditName !=null and param.auditName !=''">
-				AND r.audit_name_ LIKE CONCAT('%', #{param.auditName}, '%')
+				AND g.audit_name_ LIKE CONCAT('%', #{param.auditName}, '%')
 			</if>
 			<if test="param.startTime !=null">
 				<![CDATA[AND g.create_time_ >= #{param.startTime} ]]>
@@ -377,23 +382,43 @@
 
 	<select id="queryGroupHistoryList" resultType="com.yonge.cooleshow.biz.dal.vo.VideoLessonAuthGroup">
 		SELECT
-			<include refid="recordColumns"/>
+			g.id_ AS id,
+			g.lesson_name_ AS lessonName,
+			g.lesson_subject_ AS lessonSubject,
+			g.lesson_desc_ AS lessonDesc,
+			g.lesson_price_ AS lessonPrice,
+			g.lesson_cover_url_ AS lessonCoverUrl,
+			g.teacher_id_ AS teacherId,
+			g.lesson_count_ AS lessonCount,
+			g.sort_number_ AS sortNumber,
+			g.lesson_tag_ AS lessonTag,
+			g.top_flag_ AS topFlag,
+			g.hot_flag_ AS hotFlag,
+			g.shelves_flag_ AS shelvesFlag,
+			g.shelves_time_ as shelvesTime,
+			g.shelves_reason_ as shelvesReason,
+			g.create_time_ AS createTime,
+			g.update_time_ AS updateTime,
+			r.audit_id_ AS auditId,
+			r.audit_name_ AS auditName,
+			r.audit_status_ AS auditStatus,
+			g.audit_version_ as auditVersion,
 			r.video_group_id_ as videoGroupId,
-			r.group_id_ as groupId,
 			r.audit_status_ AS auditStatus,
 			r.remarks as remarks,
+			r.version_ as version,
 			s.name_ AS subjectName,
 			t.username_ AS teacherName,
 			t.real_name_ AS realName,
 			t.phone_ AS teacherPhone
 		FROM video_lesson_auth_record r
-		LEFT JOIN video_lesson_group g ON g.id_=r.video_group_id_
+		LEFT JOIN video_lesson_group_log g ON g.video_lesson_group_id_=r.video_group_id_ and r.version_ = g.version_
 		LEFT JOIN `subject` s ON g.lesson_subject_=s.id_
 		LEFT JOIN sys_user t ON g.teacher_id_=t.id_
 		<where>
 			and r.audit_status_ != 'DOING'
 			<if test="null != param.groupId">
-				AND r.group_id_ = #{param.groupId}
+				AND r.video_group_id_ = #{param.groupId}
 			</if>
 			<if test="null != param.search and '' != param.search">
 				AND (
@@ -428,42 +453,42 @@
 
 	<select id="authGroupDetil" resultType="com.yonge.cooleshow.biz.dal.vo.VideoLessonAuthGroup">
 		SELECT
-			<include refid="recordColumns"/>
-			r.video_group_id_ as videoGroupId,
-			r.group_id_ as groupId,
+			g.id_ AS id,
+			g.lesson_name_ AS lessonName,
+			g.lesson_subject_ AS lessonSubject,
+			g.lesson_desc_ AS lessonDesc,
+			g.lesson_price_ AS lessonPrice,
+			g.lesson_cover_url_ AS lessonCoverUrl,
+			g.teacher_id_ AS teacherId,
+			g.lesson_count_ AS lessonCount,
+			g.sort_number_ AS sortNumber,
+			g.lesson_tag_ AS lessonTag,
+			g.top_flag_ AS topFlag,
+			g.hot_flag_ AS hotFlag,
+			g.shelves_flag_ AS shelvesFlag,
+			g.shelves_time_ as shelvesTime,
+			g.shelves_reason_ as shelvesReason,
+			g.create_time_ AS createTime,
+			g.update_time_ AS updateTime,
+			g.audit_version_ as auditVersion,
+			r.audit_id_ AS auditId,
+			r.audit_name_ AS auditName,
 			r.audit_status_ AS auditStatus,
-			r.remarks as remarks,
-			s.name_ AS subjectName,
-			t.username_ AS teacherName,
-			t.real_name_ AS realName,
-			t.phone_ AS teacherPhone
-		FROM video_lesson_auth_record r
-		LEFT JOIN video_lesson_group g ON g.id_=r.video_group_id_
-		LEFT JOIN `subject` s ON g.lesson_subject_=s.id_
-		LEFT JOIN sys_user t ON g.teacher_id_=t.id_
-		where r.video_group_id_ = #{videoGroupId}
-	</select>
-
-	<select id="lastAuthGroupDetil" resultType="com.yonge.cooleshow.biz.dal.vo.VideoLessonAuthGroup">
-		SELECT
-			<include refid="recordColumns"/>
+			r.version_ as version,
 			r.video_group_id_ as videoGroupId,
-			r.group_id_ as groupId,
-			r.audit_status_ AS auditStatus,
 			r.remarks as remarks,
 			s.name_ AS subjectName,
 			t.username_ AS teacherName,
 			t.real_name_ AS realName,
 			t.phone_ AS teacherPhone
-		FROM video_lesson_auth_record r
-		LEFT JOIN video_lesson_group g ON g.id_=r.video_group_id_
+		FROM video_lesson_group g 
+		LEFT JOIN video_lesson_auth_record r ON g.id_=r.video_group_id_
 		LEFT JOIN `subject` s ON g.lesson_subject_=s.id_
 		LEFT JOIN sys_user t ON g.teacher_id_=t.id_
-		where r.video_group_id_ != #{videoGroupId} and r.group_id_ = #{groupId}
+		where g.id_ = #{videoGroupId}
 		order by r.id_ desc limit 1
 	</select>
 
-
 	<select id="selectGroupById" resultType="com.yonge.cooleshow.biz.dal.entity.VideoLessonGroup"
             parameterType="java.lang.Long">
 		SELECT

+ 28 - 25
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/VideoLessonGroupController.java

@@ -1,39 +1,42 @@
 package com.yonge.cooleshow.teacher.controller;
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.yonge.cooleshow.biz.dal.dto.search.ShareProfitParam;
-import com.yonge.cooleshow.biz.dal.dto.search.VideoLessonGroupSearch;
-
-
-import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
-import com.yonge.cooleshow.biz.dal.vo.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 
-import com.yonge.cooleshow.biz.dal.service.AppVersionInfoService;
+import java.util.Date;
 
-import com.yonge.cooleshow.biz.dal.vo.*;
+import javax.validation.constraints.NotNull;
 
-import com.yonge.toolset.base.util.StringUtil;
-import com.yonge.toolset.mybatis.support.PageUtil;
-import com.yonge.cooleshow.biz.dal.valid.AddGroup;
-import com.yonge.cooleshow.biz.dal.valid.UpdateGroup;
-import com.yonge.toolset.base.page.PageInfo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
 import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import com.yonge.cooleshow.common.controller.BaseController;
-import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
+import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.dto.search.VideoLessonGroupSearch;
 import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroup;
+import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
+import com.yonge.cooleshow.biz.dal.service.AppVersionInfoService;
 import com.yonge.cooleshow.biz.dal.service.VideoLessonGroupService;
-import com.yonge.cooleshow.auth.api.entity.SysUser;
-import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
-
-import javax.validation.constraints.NotNull;
-import java.util.Date;
+import com.yonge.cooleshow.biz.dal.valid.AddGroup;
+import com.yonge.cooleshow.biz.dal.valid.UpdateGroup;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupUpVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonShelvesVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonStudentVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonVo;
+import com.yonge.cooleshow.common.controller.BaseController;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.toolset.base.page.PageInfo;
+import com.yonge.toolset.mybatis.support.PageUtil;
 
 /**
  * 视频课基本信息表 web 控制层