limin 7 年 前
コミット
e720c974f8

+ 6 - 2
src/main/java/com/goafanti/admin/controller/AdminVideoApiController.java

@@ -114,7 +114,9 @@ public class AdminVideoApiController extends CertifyApiController {
 	@ResponseBody
 	public Result getVideoById(String id) {
 		Result result = new Result();
-		result.setData(adminVideoService.getVideoById(id));
+		JtVideo video = new JtVideo();
+		video.setId(id);
+		result.setData(adminVideoService.getVideoById(video));
 		return result;
 	}
 
@@ -173,7 +175,9 @@ public class AdminVideoApiController extends CertifyApiController {
 					VideoFields.getFieldDesc(bindingResult.getFieldError().getField())));
 			return result;
 		}
-		JtVideo oldVideo = adminVideoService.getVideoById(video.getId());
+		JtVideo v = new JtVideo();
+		v.setId(video.getId());
+		JtVideo oldVideo = adminVideoService.getVideoById(v);
 		if (StringUtils.isBlank(video.getId())) {
 			result.getError().add(
 					buildError(ErrorConstants.PARAM_ERROR, "", "视频id不能为空"));

+ 1 - 1
src/main/java/com/goafanti/admin/service/AdminVideoService.java

@@ -9,7 +9,7 @@ import com.goafanti.core.mybatis.page.Pagination;
 public interface AdminVideoService {
 	Pagination<AdminVideoBo> getVideoList(JtVideo video, Integer pageNo, Integer pageSize,Integer ob);
 	
-	AdminVideoBo getVideoById(String id);
+	AdminVideoBo getVideoById(JtVideo jtVideo);
 	
 	int insertVideo(JtVideo jtVideo);
 	

+ 2 - 2
src/main/java/com/goafanti/admin/service/impl/AdminVideoServiceImpl.java

@@ -35,8 +35,8 @@ public class AdminVideoServiceImpl extends BaseMybatisDao<JtVideoMapper> impleme
 	}
 
 	@Override
-	public AdminVideoBo getVideoById(String id) {
-		return jtVideoMapper.selectById(id);
+	public AdminVideoBo getVideoById(JtVideo jtVideo) {
+		return jtVideoMapper.selectById(jtVideo);
 	}
 
 	@Override

+ 12 - 6
src/main/java/com/goafanti/common/controller/PortalController.java

@@ -241,13 +241,19 @@ public class PortalController extends BaseController {
 	//跳转视频详情
 	@RequestMapping(value="/open/protal/videoDetail", method = RequestMethod.GET)
 	public ModelAndView videoDetail(ModelAndView modelAndView,String id){
-		modelAndView.setViewName("/portal/video/videoDetail");
 		//获得视频信息
-		modelAndView.addObject("videoPlay",adminVideoService.getVideoById(id));
-		
-		//获得所有视频列表
-		modelAndView.addObject("videoList",adminVideoService.getAllVideoExcludeId(id));
-		
+		JtVideo v = new JtVideo();
+		v.setId(id);
+		v.setStatus(1);
+		JtVideo video = adminVideoService.getVideoById(v);
+		if(null != video){
+			modelAndView.addObject("videoPlay",video);
+			//获得所有视频列表
+			modelAndView.addObject("videoList",adminVideoService.getAllVideoExcludeId(id));
+			modelAndView.setViewName("/portal/video/videoDetail");
+		}else{
+			modelAndView.setViewName("/portal/video/video");
+		}
 		return modelAndView;
 	}
 }

+ 1 - 1
src/main/java/com/goafanti/common/dao/JtVideoMapper.java

@@ -78,7 +78,7 @@ public interface JtVideoMapper {
 	 */
 	int updateByPrimaryKey(JtVideo record);
 
-	AdminVideoBo selectById(String id);
+	AdminVideoBo selectById(JtVideo id);
 	
 	int updateByUrl(JtVideo video);
 	

+ 5 - 2
src/main/java/com/goafanti/common/mapper/JtVideoMapper.xml

@@ -481,13 +481,16 @@
   	</if>
    </select>
    <!-- 查看单个信息 -->
-   <select id="selectById" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminVideoBo">
+   <select id="selectById" parameterType="com.goafanti.common.model.JtVideo" resultType="com.goafanti.admin.bo.AdminVideoBo">
     select 
     v.id, v.name, url, type, owner, v.create_time as createTime, v.status, summary, cover_url as coverUrl, 
     release_time as releaseTime, transcoding, md5, v.position, a.name as ownerName  
   	from jt_video v
 	left join admin a on v.owner = a.id
-    where v.id = #{id,jdbcType=VARCHAR}
+    where  v.id = #{id,jdbcType=VARCHAR}
+    <if test="status != null">
+    	and v.status = #{status,jdbcType=INTEGER}
+    </if>
   </select>
   <!-- 根据url 修改数据 -->
   <update id="updateByUrl" parameterType="com.goafanti.common.model.JtVideo">

+ 2 - 2
src/main/webapp/WEB-INF/views/portal/video/videoDetail.html

@@ -27,7 +27,7 @@
 			<div class="videoCenter">
 			    <div class="videoPlay">
 					<video id="videoDe" controls="true" controlslist="nodownload">
-						<source th:src="${videoServer + videoPlay.url}"   type="video/mp4"/> 
+						<source th:if="${videoPlay.url != null}" th:src="${videoServer + videoPlay.url}"   type="video/mp4"/> 
 					</video>
 					<div class="share">
 						<div>
@@ -45,7 +45,7 @@
 					<ul>
 						<!-- 放三个 -->
 						<li class="active">
-							<a th:href="@{/open/protal/videoDetail(id=${videoPlay.id})}">
+							<a  th:if="${videoPlay.url != null}" th:href="@{/open/protal/videoDetail(id=${videoPlay.id})}">
 								<img th:src="${avatarUploadHost+videoPlay.coverUrl}" alt="">
 								<div class="txt">
 									<h4 th:text="${videoPlay.name}">申请军工三证72问</h4>