提交 a6b73794 authored 作者: zhouzhigang's avatar zhouzhigang

--no commit message

上级 3d0844e1
......@@ -189,21 +189,7 @@ public class ResourceLibraryController {
@ApiOperation(value = "保存当前视频播放状态" , notes ="保存当前视频播放状态")
@PostMapping(value = "/relation-resource/update")
public CallBack<Boolean> updateStatus(@RequestBody UpdatePlayStatusForm form){
ResourceRelation e = new ResourceRelation();
e.setObjectId(form.getCourseId());
e.setResourceId(form.getVideoId());
e.setRelationtype(1);
e.setResourceType(5);
ResourceRelation resourceRelation = new ResourceRelation();
try {
resourceRelation = resourceRelationService.selectOne(resourceRelation);
} catch (Exception e1) {
throw new BaseException("通过课程id视频id获取课程视频关联关系异常");
}
if(resourceRelation != null) {
resourceRelation.setIsPlay("1");
}
return resourceRelationService.updateByPrimaryKey(resourceRelation) ? CallBack.success() : CallBack.fail();
return CallBack.success(resourceRelationService.updateStatus(form));
}
//关联资源begin
......
......@@ -5,6 +5,7 @@ import java.util.List;
import com.zrqx.core.service.BaseService;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.resource.commons.form.bg.QueryResourceRelationForm;
import com.zrqx.resource.commons.form.bg.UpdatePlayStatusForm;
import com.zrqx.resource.commons.model.resourcerelation.ResourceRelation;
import com.zrqx.resource.commons.vo.bg.ResourceRelationVo;
......@@ -26,4 +27,13 @@ public interface ResourceRelationService extends BaseService<ResourceRelation, I
* @return
*/
Integer getMaxSort(String resourceType);
/**
* 保存当前视频播放状态
* @param form
* @return
* @author chyj
* @date: 2020年5月6日 下午4:15:26
*/
boolean updateStatus(UpdatePlayStatusForm form);
}
......@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.zrqx.core.enums.AllResourceTypeEnum;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.page.PageParam;
......@@ -22,6 +23,8 @@ import com.zrqx.resource.bg.mapper.imagelibrary.ImageLibraryMapper;
import com.zrqx.resource.bg.mapper.projectlibrary.ProjectLibraryMapper;
import com.zrqx.resource.bg.mapper.videolibrary.VideoLibraryMapper;
import com.zrqx.resource.commons.form.bg.QueryResourceRelationForm;
import com.zrqx.resource.commons.form.bg.UpdatePlayStatusForm;
import com.zrqx.resource.commons.form.bg.marketing.UpdateStatusForm;
import com.zrqx.resource.commons.model.annexlibrary.AnnexLibrary;
import com.zrqx.resource.commons.model.articlelibrary.ArticleLibrary;
import com.zrqx.resource.commons.model.audiolibrary.AudioLibrary;
......@@ -155,4 +158,41 @@ public class ResourceRelationServiceImpl extends BaseServiceImpl<ResourceRelatio
}
return sort;
}
@Override
public boolean updateStatus(UpdatePlayStatusForm form) {
//将课程下的其他视频置为不是当前播放状态
ResourceRelation relation = new ResourceRelation();
relation.setObjectId(form.getCourseId());
relation.setIsPlay("1");
ResourceRelation rr = new ResourceRelation();
try {
rr = mapper.selectOne(relation);
} catch (Exception e1) {
throw new BaseException("通过课程id视频id获取课程视频关联关系异常");
}
if(rr != null) {
rr.setIsPlay("0");
mapper.updateByPrimaryKey(rr);
}
ResourceRelation e = new ResourceRelation();
e.setObjectId(form.getCourseId());
e.setResourceId(form.getVideoId());
e.setRelationtype(1);
e.setResourceType(5);
ResourceRelation resourceRelation = new ResourceRelation();
try {
resourceRelation = mapper.selectOne(resourceRelation);
} catch (Exception e1) {
throw new BaseException("通过课程id视频id获取课程视频关联关系异常");
}
if(resourceRelation != null) {
resourceRelation.setIsPlay("1");
}
return mapper.updateByPrimaryKey(resourceRelation) > 0;
}
}
......@@ -82,7 +82,7 @@ public interface FgResourceRelationMapper extends BaseMapper<ResourceRelation>
+ "</if>"
+ " and ar.resourceType = 5 and ar.relationtype=1"
+ " union"
+ " select li.id as resourceId,li.resourceType,li.`name`,li.`status`,li.timeLength,li.clickNum,li.uploadTime,sort,li.priceOption from "
+ " select li.id as resourceId,li.resourceType,li.`name`,li.`status`,li.timeLength,li.clickNum,li.uploadTime,sort,li.priceOption,ar.isPlay from "
+ "res_resource_relation ar LEFT JOIN res_audio_library li on li.id=ar.resourceId "
+ "where 1 = 1 and li.status = 1 "
+ "<if test='"+ NOTBLANK +"(oid)'> "
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论