@Data
@ToString
@NoArgsConstructor
public class CourseView implements Serializable {
CourseBase courseBase;//基础信息
CourseMarket courseMarket;//课程营销
CoursePic coursePic;//课程图片
TeachplanNode TeachplanNode;//教学计划
}
@ApiOperation(
"
课程视图查询
"
)
public CourseView courseview(String id);
public interface CourseMarketRepository extends JpaRepository<CourseMarket,String> {
}
//课程视图查询
public CourseView getCoruseView(String id) {
CourseView courseView = new CourseView();
//查询课程基本信息
Optional<CourseBase> optional =
courseBaseRepository
.findById(id);
if(optional.isPresent()){
CourseBase courseBase
=
optional.
get();
courseView.setCourseBase(courseBase);
}
//查询课程营销信息
Optional<CourseMarket> courseMarketOptional =
courseMarketRepository
.findById(id);
if(courseMarketOptional.isPresent()){
CourseMarket courseMarket
=
courseMarketOptional.
get();
courseView.setCourseMarket(courseMarket);
}
//查询课程图片信息
Optional<CoursePic> picOptional =
coursePicRepository
.findById(id);
if(picOptional.isPresent()){
CoursePic coursePic
=
picOptional.
get();
courseView.setCoursePic(picOptional.
get());
}
//查询课程计划信息
TeachplanNode teachplanNode
=
teachplanMapper.selectList(id);
courseView.setTeachplanNode(teachplanNode);
return courseView;
}
@Override
@GetMapping(
"
/courseview/{id}
"
)
public CourseView courseview(@PathVariable(
"
id
"
) String id) {
return courseService.
getCoruseView(id);
}
<div class
=
"
banner
‐
left
"
>
<p class
=
"
tit
"
>${courseBase.name}</p>
<p class
=
"
pic
"
><span class
=
"
new
‐
pic
"
>特惠价格¥${courseMarket.
price}</span> <span
class
=
"
old
‐
pic
"
>原价¥${courseMarket.
price_old!}</span></p>
<p class
=
"
info
"
>
<a href=
"
http://ucenter.xuecheng
.com/#/learning/${courseBase.id}/0
"
target
=
"
_blank
"
v
‐
if=
"
learnstatus
== 1
"
v
‐
cloak>马上学习</a>
<a href=
"
#
"
@click=
"
addopencourse
"
v
‐
if=
"
learnstatus
== 2
"
v
‐
cloak>立即报名</a>
<a href=
"
#
"
@click=
"
buy
"
v
‐
if=
"
learnstatus
==
3
"
v
‐
cloak>立即购买</a>
<span><em>难度等级</em>
<#if courseBase.
grade
==
'
200001
'
>
低级
<#elseif courseBase.
grade
==
'
200002
'
>
中级
<#elseif courseBase.
grade
==
'
200003
'
>
高级
</#if>
</span>
<span><em>课程时长</em><stat v
‐
text
=
"
course_stat.s601001
"
></stat>
</span>
<span><em>评分</em><stat v
‐
text
=
"
course_stat.s601002
"
></stat></span>
<span><em>授课模式</em>
<#if courseBase.studymodel==
'
201001
'
>
自由学习
<#elseif courseBase.studymodel==
'
201002
'
>
任务式学习
</#if>
</span>
</p>
</div>
<div class
=
"
banner
‐
rit
"
>
<#if coursePic.
pic??>
<p><img src
=
"
http://img
.xuecheng
.com/${coursePic.
pic}
"
alt
=
""
width=
"
270
"
height
=
"
156
"
>
</p>
<#else>
<p><img src
=
"
/static/img/widget
‐
video.
png
"
alt
=
""
width=
"
270
"
height
=
"
156
"
> </p>
</#if>
<p class
=
"
vid
‐
act
"
><span> <i class
=
"
i
‐
heart
"
></i>收藏 <stat v
‐
text
=
"
course_stat.s601003
"
></stat> </span> <span>分享 <i class
=
"
i
‐
weixin
"
></i><i class
=
"
i
‐
"
>
</i></span></p>
</div>
<div class
=
"
content
"
>
<#if teachplanNode.children??>
<#list teachplanNode.children as firstNode>
<div class
=
"
item
"
>
<div class
=
"
title act
"
><i class
=
"
i
‐
chevron
‐
top
"
>
</i>${firstNode.
pname}</div>
<div class
=
"
about
"
>${firstNode.description!}</div>
<div class
=
"
drop
‐
down
"
style
=
"
height: ${firstNode.children?
size
*
50}px;
"
>
<ul class
=
"
list
‐
box
"
>
<#list firstNode.children as secondNode>
<li>${secondNode.
pname}</li>
</#list>
</ul>
</div>
</div>
</#list>
</#if>
</div>
<body data
‐
spy
=
"
scroll
"
data
‐
target
=
"
#articleNavbar
"
data
‐
offset
=
"
150
"
>
<!
‐‐
页面头部
‐‐
>
<!
‐‐
#include virtual=
"
/include/header.html
"
‐‐
>
<!
‐‐
页面底部
‐‐
>
<!
‐‐
底部版权
‐‐
>
<!
‐‐
#include virtual=
"
/include/footer.html
"
‐‐
>
<script>
//课程id
var courseId
=
"
template
"
</script>
<!
‐‐
#include virtual=
"
/include/course_detail_dynamic.html
"
‐‐
>
<div class
=
"
content
‐
com course
"
>
<div class
=
"
title
"
><span>课程制作</span></div>
<!
‐‐
#include virtual=
"
/teacher/teacher_info_template01.html
"
‐‐
>
</div>
<div class
=
"
about
‐
teach
"
>
<!
‐‐
机构信息
‐‐
>
<!
‐‐
#include virtual=
"
/company/company_info_template.html
"
‐‐
>
</div>
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |