This commit is contained in:
zhujunjieit 2018-12-25 23:43:27 +08:00
parent e62bd05ceb
commit 2db66566af
11 changed files with 283 additions and 155 deletions

View File

@ -87,7 +87,7 @@ public class TrainCourseSectionController extends BaseController
@ResponseBody
public AjaxResult addSave(TrainCourseSection trainCourseSection)
{
return toAjax(trainCourseSectionService.insert(trainCourseSection));
return toAjax(trainCourseSectionService.insertSelective(trainCourseSection));
}
/**

View File

@ -4,6 +4,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.base.BaseEntity;
import javax.persistence.Id;
import java.math.BigDecimal;
import java.util.Date;
/**
@ -32,6 +33,10 @@ public class TrainCourse {
* 课程名称
*/
private String name;
/**
* 价格
*/
private BigDecimal price;
/**
* 课程封面
*/
@ -123,6 +128,14 @@ public class TrainCourse {
return name;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
/**
* 设置课程封面
*/

View File

@ -2,9 +2,9 @@ package com.ruoyi.train.course.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.base.BaseEntity;
import javax.persistence.Id;
import java.util.Date;
import javax.persistence.Id;
import java.util.Date;
/**
* 课程章节表 train_course_section
*
@ -13,153 +13,164 @@ import com.ruoyi.common.base.BaseEntity;
*/
public class TrainCourseSection
{
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/** 章节id */
@Id
/** 章节id */
@Id
private Integer id;
/** 课程ID */
private Integer trainCourseId;
/** 章节名称 */
private String name;
/** 显示顺序 */
private Integer orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 创建者 */
private String createBy;
/** 创建时间 */
private Date createTime;
/** 更新者 */
private String updateBy;
/** 更新时间 */
private Date updateTime;
/** 备注 */
private String remark;
/** 设置章节id */
/** 课程ID */
private Integer trainCourseId;
/** 章节名称 */
private String name;
/** 显示顺序 */
private Integer orderNum;
/** 课件 */
private String courseware;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 创建者 */
private String createBy;
/** 创建时间 */
private Date createTime;
/** 更新者 */
private String updateBy;
/** 更新时间 */
private Date updateTime;
/** 备注 */
private String remark;
/** 设置章节id */
public void setId(Integer id)
{
this.id = id;
}
{
this.id = id;
}
/** 获取章节id */
public Integer getId()
{
return id;
}
/** 设置课程ID */
{
return id;
}
/** 设置课程ID */
public void setTrainCourseId(Integer trainCourseId)
{
this.trainCourseId = trainCourseId;
}
{
this.trainCourseId = trainCourseId;
}
/** 获取课程ID */
public Integer getTrainCourseId()
{
return trainCourseId;
}
/** 设置章节名称 */
{
return trainCourseId;
}
/** 设置章节名称 */
public void setName(String name)
{
this.name = name;
}
{
this.name = name;
}
public String getCourseware() {
return courseware;
}
public void setCourseware(String courseware) {
this.courseware = courseware;
}
/** 获取章节名称 */
public String getName()
{
return name;
}
/** 设置显示顺序 */
{
return name;
}
/** 设置显示顺序 */
public void setOrderNum(Integer orderNum)
{
this.orderNum = orderNum;
}
{
this.orderNum = orderNum;
}
/** 获取显示顺序 */
public Integer getOrderNum()
{
return orderNum;
}
/** 设置删除标志0代表存在 2代表删除 */
{
return orderNum;
}
/** 设置删除标志0代表存在 2代表删除 */
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
{
this.delFlag = delFlag;
}
/** 获取删除标志0代表存在 2代表删除 */
public String getDelFlag()
{
return delFlag;
}
/** 设置创建者 */
{
return delFlag;
}
/** 设置创建者 */
public void setCreateBy(String createBy)
{
this.createBy = createBy;
}
{
this.createBy = createBy;
}
/** 获取创建者 */
public String getCreateBy()
{
return createBy;
}
/** 设置创建时间 */
{
return createBy;
}
/** 设置创建时间 */
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
{
this.createTime = createTime;
}
/** 获取创建时间 */
public Date getCreateTime()
{
return createTime;
}
/** 设置更新者 */
{
return createTime;
}
/** 设置更新者 */
public void setUpdateBy(String updateBy)
{
this.updateBy = updateBy;
}
{
this.updateBy = updateBy;
}
/** 获取更新者 */
public String getUpdateBy()
{
return updateBy;
}
/** 设置更新时间 */
{
return updateBy;
}
/** 设置更新时间 */
public void setUpdateTime(Date updateTime)
{
this.updateTime = updateTime;
}
{
this.updateTime = updateTime;
}
/** 获取更新时间 */
public Date getUpdateTime()
{
return updateTime;
}
/** 设置备注 */
{
return updateTime;
}
/** 设置备注 */
public void setRemark(String remark)
{
this.remark = remark;
}
{
this.remark = remark;
}
/** 获取备注 */
public String getRemark()
{
return remark;
}
public String toString() {
{
return remark;
}
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("trainCourseId", getTrainCourseId())
.append("name", getName())
.append("orderNum", getOrderNum())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
.append("id", getId())
.append("trainCourseId", getTrainCourseId())
.append("name", getName())
.append("courseware", getCourseware())
.append("orderNum", getOrderNum())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deptId" column="dept_id" />
<result property="trainCourseCategoryId" column="train_course_category_id" />
<result property="name" column="name" />
<result property="price" column="price" />
<result property="cover" column="cover" />
<result property="description" column="description" />
<result property="state" column="state" />
@ -21,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectTrainCourseVo">
id, dept_id, train_course_category_id, name, cover, description, state, del_flag, create_by, create_time, update_by, update_time, remark </sql>
id, dept_id, train_course_category_id, name,price, cover, description, state, del_flag, create_by, create_time, update_by, update_time, remark </sql>
<select id="selectTrainCourseList" parameterType="TrainCourse" resultMap="TrainCourseResult">
select

View File

@ -8,6 +8,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="id" column="id" />
<result property="trainCourseId" column="train_course_id" />
<result property="name" column="name" />
<result property="courseware" column="courseware" />
<result property="orderNum" column="order_num" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
@ -18,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectTrainCourseSectionVo">
id, train_course_id, name, order_num, del_flag, create_by, create_time, update_by, update_time, remark </sql>
id, train_course_id, name,courseware, order_num, del_flag, create_by, create_time, update_by, update_time, remark </sql>
<select id="selectTrainCourseSectionList" parameterType="TrainCourseSection" resultMap="TrainCourseSectionResult">
select

View File

@ -3,6 +3,12 @@
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/layui/css/layui.css}" rel="stylesheet"/>
<style>
.layui-upload-img{
width:80px;
height: 80px;
}
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-trainCourse-add">
@ -19,6 +25,12 @@
<input id="name" name="name" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">课程价格:</label>
<div class="col-sm-8">
<input id="price" name="price" class="form-control" type="number">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">课程封面:</label>
<div class="col-sm-8">
@ -32,13 +44,7 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">课程简介:</label>
<div class="col-sm-8">
<input id="description" name="description" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<div class="form-group">
<label class="col-sm-3 control-label" title="(默认 1-公开2-不公开)">是否公开:</label>
<div class="col-sm-8">
<select id="state" name="state" th:with="type=${@dict.getType('train_open_state')}" class="form-control" >
@ -46,6 +52,12 @@
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">课程简介:</label>
<div class="col-sm-8">
<textarea id="description" name="description" placeholder="请输入章节介绍" class="layui-textarea"></textarea>
</div>
</div>
</form>
</div>
<div th:include="include::footer"></div>

View File

@ -3,6 +3,12 @@
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/layui/css/layui.css}" rel="stylesheet"/>
<style>
.layui-upload-img{
width:80px;
height: 80px;
}
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-trainCourse-edit" th:object="${trainCourse}">
@ -11,7 +17,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">课程分类:</label>
<div class="col-sm-8">
<input class="form-control" type="text" name="treeName" onclick="selectCategoryTree()" th:field="${category.name}" readonly="true" id="treeName">
<input class="form-control" type="text" name="treeName" onclick="selectCategoryTree()" th:value="${category.name}" readonly="true" id="treeName">
</div>
</div>
<div class="form-group">
@ -20,6 +26,12 @@
<input id="name" name="name" th:field="*{name}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">课程价格:</label>
<div class="col-sm-8">
<input id="price" name="price" th:field="*{price}" class="form-control" type="number">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">课程封面:</label>
<div class="col-sm-8">
@ -34,12 +46,6 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">课程简介:</label>
<div class="col-sm-8">
<input id="description" name="description" th:field="*{description}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" title="(默认 1-公开2-不公开)">是否公开:</label>
<div class="col-sm-8">
@ -48,6 +54,12 @@
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">课程简介:</label>
<div class="col-sm-8">
<textarea id="description" name="description" th:field="*{description}" placeholder="请输入章节介绍" class="layui-textarea"></textarea>
</div>
</div>
</form>
</div>
<div th:include="include::footer"></div>

View File

@ -29,6 +29,8 @@
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<input type="hidden" id="trainCourseCategoryId" name="trainCourseCategoryId">
<input type="hidden" id="parentId" name="parentId">
<div class="select-list">
<ul>
<li>
@ -100,6 +102,10 @@
field : 'name',
title : '课程名称'
},
{
field : 'price',
title : '课程价格'
},
{
field : 'description',
title : '课程介绍'
@ -145,7 +151,7 @@
$.tree.init(options);
function zOnClick(event, treeId, treeNode) {
$("#trainCoursewareCategoryId").val(treeNode.id);
$("#trainCourseCategoryId").val(treeNode.id);
$("#parentId").val(treeNode.pId);
$.table.search();
}
@ -171,6 +177,7 @@
var url ="/train/course/category";
createMenuItem(url, "分类管理");
}
/**跳转到课程章节*/
function courseSection(id) {
var url = "/train/trainCourseSection?trainCourseId="+id;
createMenuItem(url, "课程内容");

View File

@ -2,6 +2,7 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/layui/css/layui.css}" rel="stylesheet"/>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-trainCourseSection-add">
@ -17,6 +18,27 @@
<input id="name" name="name" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">上传课件:</label>
<div class="col-sm-8">
<input id="courseware" name="courseware" class="form-control" type="hidden">
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-normal" id="testList">选择多文件</button>
<div class="layui-upload-list">
<table class="layui-table">
<thead>
<tr><th>文件名</th>
<th>大小</th>
<th>状态</th>
<th>操作</th>
</tr></thead>
<tbody id="demoList"></tbody>
</table>
</div>
<!--<button type="button" class="layui-btn" id="testListAction">开始上传</button>-->
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">显示顺序:</label>
<div class="col-sm-8">
@ -26,12 +48,13 @@
<div class="form-group">
<label class="col-sm-3 control-label">章节介绍:</label>
<div class="col-sm-8">
<input id="remark" name="remark" class="form-control" type="text">
<textarea id="remark" name="remark" placeholder="请输入章节介绍" class="layui-textarea"></textarea>
</div>
</div>
</form>
</div>
<div th:include="include::footer"></div>
<script th:src="@{/ajax/libs/layui/layui.js}"></script>
<script type="text/javascript">
var prefix = ctx + "train/trainCourseSection"
$("#form-trainCourseSection-add").validate({
@ -44,9 +67,73 @@
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-trainCourseSection-add').serialize());
$("#courseware").val(fileList.join(","));
var formData=$('#form-trainCourseSection-add').serialize();
$.operate.save(prefix + "/add",formData );
}
}
var fileList=new Array();
layui.use('upload', function() {
var $ = layui.jquery
, upload = layui.upload;
//多文件列表示例
var demoListView = $('#demoList')
,uploadListIns = upload.render({
elem: '#testList'
,url: '/upload/files'
,data:{module:"train/courseware"}//文件存放路径
,accept: 'file'
,multiple: true
,auto: true
// ,bindAction: '#testListAction'
,choose: function(obj){
var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
//读取本地文件
obj.preview(function(index, file, result){
var tr = $(['<tr id="upload-'+ index +'">'
,'<td>'+ file.name +'</td>'
,'<td>'+ (file.size/1014).toFixed(1) +'kb</td>'
,'<td>等待上传</td>'
,'<td>'
,'<button class="layui-btn layui-btn-xs demo-reload layui-hide">重传</button>'
,'<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
,'</td>'
,'</tr>'].join(''));
//单个重传
tr.find('.demo-reload').on('click', function(){
obj.upload(index, file);
});
//删除
tr.find('.demo-delete').on('click', function(){
delete files[index]; //删除对应的文件
tr.remove();
uploadListIns.config.elem.next()[0].value = ''; //清空 input file 值,以免删除后出现同名文件不可选
});
demoListView.append(tr);
});
}
,done: function(res, index, upload){
if(res.code == 200){ //上传成功
var tr = demoListView.find('tr#upload-'+ index)
,tds = tr.children();
tds.eq(2).html('<span style="color: #5FB878;">上传成功</span>');
tds.eq(3).html(''); //清空操作
fileList.push(res.fileName);
return delete this.files[index]; //删除文件队列已经上传成功的文件
}
this.error(index, upload);
}
,error: function(index, upload){
var tr = demoListView.find('tr#upload-'+ index)
,tds = tr.children();
tds.eq(2).html('<span style="color: #FF5722;">上传失败</span>');
tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传
}
});
});
</script>
</body>
</html>

View File

@ -2,6 +2,7 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/layui/css/layui.css}" rel="stylesheet"/>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-trainCourseSection-edit" th:object="${trainCourseSection}">
@ -18,6 +19,12 @@
<input id="name" name="name" th:field="*{name}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">课件:</label>
<div class="col-sm-8">
<input id="courseware" name="courseware" th:field="*{courseware}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">显示顺序:</label>
<div class="col-sm-8">
@ -27,7 +34,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">章节介绍:</label>
<div class="col-sm-8">
<input id="remark" name="remark" th:field="*{remark}" class="form-control" type="text">
<textarea id="remark" name="remark" th:field="*{remark}" placeholder="请输入章节介绍" class="layui-textarea"></textarea>
</div>
</div>
</form>

View File

@ -2,28 +2,6 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>
<body class="gray-bg">
<div class="ui-layout-west">
<div class="main-content">
<div class="box box-main">
<div class="box-header">
<div class="box-title">
<i class="fa icon-grid"></i> 课程章节
</div>
<div class="box-tools pull-right">
<a type="button" class="btn btn-box-tool menuItem" href="#" onclick="category()" title="管理分类"><i class="fa fa-edit"></i></a>
<button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>
<button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>
<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新分类"><i class="fa fa-refresh"></i></button>
</div>
</div>
<div class="ui-layout-content">
<div id="tree" class="ztree"></div>
</div>
</div>
</div>
</div>
<div class="container-div ui-layout-center">
<div class="row">
<div class="col-sm-12 search-collapse">
@ -62,13 +40,11 @@
</div>
</div>
<div th:include="include :: footer"></div>
<script th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('train:trainCourseSection:edit')}]];
var removeFlag = [[${@permission.hasPermi('train:trainCourseSection:remove')}]];
var prefix = ctx + "train/trainCourseSection";
$(function() {
$('body').layout({ west__size: 185 });
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",