微型课程
This commit is contained in:
parent
c90be09e5a
commit
e44c18c9ea
53
ruoyi-ui/src/api/benyi/microcourse.js
Normal file
53
ruoyi-ui/src/api/benyi/microcourse.js
Normal file
@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询微型课程列表
|
||||
export function listMicrocourse(query) {
|
||||
return request({
|
||||
url: '/benyi/microcourse/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询微型课程详细
|
||||
export function getMicrocourse(id) {
|
||||
return request({
|
||||
url: '/benyi/microcourse/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增微型课程
|
||||
export function addMicrocourse(data) {
|
||||
return request({
|
||||
url: '/benyi/microcourse',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改微型课程
|
||||
export function updateMicrocourse(data) {
|
||||
return request({
|
||||
url: '/benyi/microcourse',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除微型课程
|
||||
export function delMicrocourse(id) {
|
||||
return request({
|
||||
url: '/benyi/microcourse/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出微型课程
|
||||
export function exportMicrocourse(query) {
|
||||
return request({
|
||||
url: '/system/microcourse/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
354
ruoyi-ui/src/views/benyi/microcourse/index.vue
Normal file
354
ruoyi-ui/src/views/benyi/microcourse/index.vue
Normal file
@ -0,0 +1,354 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
:inline="true"
|
||||
label-width="70px"
|
||||
>
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input
|
||||
v-model="queryParams.title"
|
||||
placeholder="请输入标题"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="作者" prop="author">
|
||||
<el-input
|
||||
v-model="queryParams.author"
|
||||
placeholder="请输入作者"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="内容" prop="contents">
|
||||
<el-input
|
||||
v-model="queryParams.contents"
|
||||
placeholder="请输入内容"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select
|
||||
v-model="queryParams.type"
|
||||
placeholder="请选择类型"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="适用范围" prop="scpoe">
|
||||
<el-input
|
||||
v-model="queryParams.scpoe"
|
||||
placeholder="请输入适用范围"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="上下册" prop="upanddown">
|
||||
<el-input
|
||||
v-model="queryParams.upanddown"
|
||||
placeholder="请输入上下册"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
size="mini"
|
||||
@click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||
>重置</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['benyi:microcourse:add']"
|
||||
>新增</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['benyi:microcourse:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['benyi:microcourse:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="microcourseList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="编号" align="center" prop="id" />
|
||||
<el-table-column label="标题" align="center" prop="title" />
|
||||
<el-table-column label="作者" align="center" prop="author" />
|
||||
<el-table-column label="内容" align="center" prop="contents" />
|
||||
<el-table-column label="类型" align="center" prop="type" />
|
||||
<el-table-column label="适用范围" align="center" prop="scpoe" />
|
||||
<el-table-column label="上下册" align="center" prop="upanddown" />
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['benyi:microcourse:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['benyi:microcourse:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改微型课程对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入标题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="作者" prop="author">
|
||||
<el-input v-model="form.author" placeholder="请输入作者" />
|
||||
</el-form-item>
|
||||
<el-form-item label="内容" prop="contents">
|
||||
<el-input v-model="form.contents" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="类型">
|
||||
<el-select v-model="form.type" placeholder="请选择类型">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="适用范围" prop="scpoe">
|
||||
<el-input v-model="form.scpoe" placeholder="请输入适用范围" />
|
||||
</el-form-item>
|
||||
<el-form-item label="上下册" prop="upanddown">
|
||||
<el-input v-model="form.upanddown" placeholder="请输入上下册" />
|
||||
</el-form-item>
|
||||
<el-form-item label="序号" prop="sort">
|
||||
<el-input v-model="form.sort" placeholder="请输入序号" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listMicrocourse,
|
||||
getMicrocourse,
|
||||
delMicrocourse,
|
||||
addMicrocourse,
|
||||
updateMicrocourse,
|
||||
} from "@/api/benyi/microcourse";
|
||||
|
||||
export default {
|
||||
name: "Microcourse",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 微型课程表格数据
|
||||
microcourseList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
title: undefined,
|
||||
author: undefined,
|
||||
contents: undefined,
|
||||
type: undefined,
|
||||
scpoe: undefined,
|
||||
upanddown: undefined,
|
||||
sort: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询微型课程列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listMicrocourse(this.queryParams).then((response) => {
|
||||
this.microcourseList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
title: undefined,
|
||||
author: undefined,
|
||||
contents: undefined,
|
||||
type: undefined,
|
||||
scpoe: undefined,
|
||||
upanddown: undefined,
|
||||
sort: undefined,
|
||||
createTime: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.id);
|
||||
this.single = selection.length != 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加微型课程";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids;
|
||||
getMicrocourse(id).then((response) => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改微型课程";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.id != undefined) {
|
||||
updateMicrocourse(this.form).then((response) => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
addMicrocourse(this.form).then((response) => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$confirm(
|
||||
'是否确认删除微型课程编号为"' + ids + '"的数据项?',
|
||||
"警告",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
}
|
||||
)
|
||||
.then(function () {
|
||||
return delMicrocourse(ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(function () {});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
@ -0,0 +1,97 @@
|
||||
package com.ruoyi.project.benyi.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.project.benyi.domain.ByMicrocourse;
|
||||
import com.ruoyi.project.benyi.service.IByMicrocourseService;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 微型课程Controller
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2021-05-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/benyi/microcourse")
|
||||
public class ByMicrocourseController extends BaseController {
|
||||
@Autowired
|
||||
private IByMicrocourseService byMicrocourseService;
|
||||
|
||||
/**
|
||||
* 查询微型课程列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:microcourse:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ByMicrocourse byMicrocourse) {
|
||||
startPage();
|
||||
List<ByMicrocourse> list = byMicrocourseService.selectByMicrocourseList(byMicrocourse);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出微型课程列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:microcourse:export')")
|
||||
@Log(title = "微型课程", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(ByMicrocourse byMicrocourse) {
|
||||
List<ByMicrocourse> list = byMicrocourseService.selectByMicrocourseList(byMicrocourse);
|
||||
ExcelUtil<ByMicrocourse> util = new ExcelUtil<ByMicrocourse>(ByMicrocourse.class);
|
||||
return util.exportExcel(list, "microcourse");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微型课程详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:microcourse:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(byMicrocourseService.selectByMicrocourseById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增微型课程
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:microcourse:add')")
|
||||
@Log(title = "微型课程", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ByMicrocourse byMicrocourse) {
|
||||
return toAjax(byMicrocourseService.insertByMicrocourse(byMicrocourse));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改微型课程
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:microcourse:edit')")
|
||||
@Log(title = "微型课程", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ByMicrocourse byMicrocourse) {
|
||||
return toAjax(byMicrocourseService.updateByMicrocourse(byMicrocourse));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除微型课程
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:microcourse:remove')")
|
||||
@Log(title = "微型课程", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(byMicrocourseService.deleteByMicrocourseByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package com.ruoyi.project.benyi.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
|
||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 微型课程对象 by_microcourse
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2021-05-13
|
||||
*/
|
||||
public class ByMicrocourse extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@Excel(name = "标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
@Excel(name = "作者")
|
||||
private String author;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@Excel(name = "内容")
|
||||
private String contents;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@Excel(name = "类型")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 适用范围
|
||||
*/
|
||||
@Excel(name = "适用范围")
|
||||
private String scpoe;
|
||||
|
||||
@Excel(name = "上下册")
|
||||
private String upanddown;
|
||||
|
||||
@Excel(name = "序号")
|
||||
private Long sort;
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setContents(String contents) {
|
||||
this.contents = contents;
|
||||
}
|
||||
|
||||
public String getContents() {
|
||||
return contents;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setScpoe(String scpoe) {
|
||||
this.scpoe = scpoe;
|
||||
}
|
||||
|
||||
public String getScpoe() {
|
||||
return scpoe;
|
||||
}
|
||||
|
||||
public void setUpanddown(String upanddown) {
|
||||
this.upanddown = upanddown;
|
||||
}
|
||||
|
||||
public String getUpanddown() {
|
||||
return upanddown;
|
||||
}
|
||||
|
||||
public void setSort(Long sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public Long getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("title", getTitle())
|
||||
.append("author", getAuthor())
|
||||
.append("contents", getContents())
|
||||
.append("type", getType())
|
||||
.append("scpoe", getScpoe())
|
||||
.append("upanddown", getUpanddown())
|
||||
.append("sort", getSort())
|
||||
.append("createTime", getCreateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.project.benyi.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.project.benyi.domain.ByMicrocourse;
|
||||
|
||||
/**
|
||||
* 微型课程Mapper接口
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2021-05-13
|
||||
*/
|
||||
public interface ByMicrocourseMapper {
|
||||
/**
|
||||
* 查询微型课程
|
||||
*
|
||||
* @param id 微型课程ID
|
||||
* @return 微型课程
|
||||
*/
|
||||
public ByMicrocourse selectByMicrocourseById(Long id);
|
||||
|
||||
/**
|
||||
* 查询微型课程列表
|
||||
*
|
||||
* @param byMicrocourse 微型课程
|
||||
* @return 微型课程集合
|
||||
*/
|
||||
public List<ByMicrocourse> selectByMicrocourseList(ByMicrocourse byMicrocourse);
|
||||
|
||||
/**
|
||||
* 新增微型课程
|
||||
*
|
||||
* @param byMicrocourse 微型课程
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertByMicrocourse(ByMicrocourse byMicrocourse);
|
||||
|
||||
/**
|
||||
* 修改微型课程
|
||||
*
|
||||
* @param byMicrocourse 微型课程
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateByMicrocourse(ByMicrocourse byMicrocourse);
|
||||
|
||||
/**
|
||||
* 删除微型课程
|
||||
*
|
||||
* @param id 微型课程ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByMicrocourseById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除微型课程
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByMicrocourseByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.project.benyi.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.project.benyi.domain.ByMicrocourse;
|
||||
|
||||
/**
|
||||
* 微型课程Service接口
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2021-05-13
|
||||
*/
|
||||
public interface IByMicrocourseService {
|
||||
/**
|
||||
* 查询微型课程
|
||||
*
|
||||
* @param id 微型课程ID
|
||||
* @return 微型课程
|
||||
*/
|
||||
public ByMicrocourse selectByMicrocourseById(Long id);
|
||||
|
||||
/**
|
||||
* 查询微型课程列表
|
||||
*
|
||||
* @param byMicrocourse 微型课程
|
||||
* @return 微型课程集合
|
||||
*/
|
||||
public List<ByMicrocourse> selectByMicrocourseList(ByMicrocourse byMicrocourse);
|
||||
|
||||
/**
|
||||
* 新增微型课程
|
||||
*
|
||||
* @param byMicrocourse 微型课程
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertByMicrocourse(ByMicrocourse byMicrocourse);
|
||||
|
||||
/**
|
||||
* 修改微型课程
|
||||
*
|
||||
* @param byMicrocourse 微型课程
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateByMicrocourse(ByMicrocourse byMicrocourse);
|
||||
|
||||
/**
|
||||
* 批量删除微型课程
|
||||
*
|
||||
* @param ids 需要删除的微型课程ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByMicrocourseByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除微型课程信息
|
||||
*
|
||||
* @param id 微型课程ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByMicrocourseById(Long id);
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package com.ruoyi.project.benyi.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.project.benyi.mapper.ByMicrocourseMapper;
|
||||
import com.ruoyi.project.benyi.domain.ByMicrocourse;
|
||||
import com.ruoyi.project.benyi.service.IByMicrocourseService;
|
||||
|
||||
/**
|
||||
* 微型课程Service业务层处理
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2021-05-13
|
||||
*/
|
||||
@Service
|
||||
public class ByMicrocourseServiceImpl implements IByMicrocourseService {
|
||||
@Autowired
|
||||
private ByMicrocourseMapper byMicrocourseMapper;
|
||||
|
||||
/**
|
||||
* 查询微型课程
|
||||
*
|
||||
* @param id 微型课程ID
|
||||
* @return 微型课程
|
||||
*/
|
||||
@Override
|
||||
public ByMicrocourse selectByMicrocourseById(Long id) {
|
||||
return byMicrocourseMapper.selectByMicrocourseById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询微型课程列表
|
||||
*
|
||||
* @param byMicrocourse 微型课程
|
||||
* @return 微型课程
|
||||
*/
|
||||
@Override
|
||||
public List<ByMicrocourse> selectByMicrocourseList(ByMicrocourse byMicrocourse) {
|
||||
return byMicrocourseMapper.selectByMicrocourseList(byMicrocourse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增微型课程
|
||||
*
|
||||
* @param byMicrocourse 微型课程
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertByMicrocourse(ByMicrocourse byMicrocourse) {
|
||||
byMicrocourse.setCreateTime(DateUtils.getNowDate());
|
||||
return byMicrocourseMapper.insertByMicrocourse(byMicrocourse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改微型课程
|
||||
*
|
||||
* @param byMicrocourse 微型课程
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateByMicrocourse(ByMicrocourse byMicrocourse) {
|
||||
return byMicrocourseMapper.updateByMicrocourse(byMicrocourse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除微型课程
|
||||
*
|
||||
* @param ids 需要删除的微型课程ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteByMicrocourseByIds(Long[] ids) {
|
||||
return byMicrocourseMapper.deleteByMicrocourseByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除微型课程信息
|
||||
*
|
||||
* @param id 微型课程ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteByMicrocourseById(Long id) {
|
||||
return byMicrocourseMapper.deleteByMicrocourseById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
<?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.ruoyi.project.benyi.mapper.ByMicrocourseMapper">
|
||||
|
||||
<resultMap type="ByMicrocourse" id="ByMicrocourseResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="title" column="title"/>
|
||||
<result property="author" column="author"/>
|
||||
<result property="contents" column="contents"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="scpoe" column="scpoe"/>
|
||||
<result property="upanddown" column="upanddown"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectByMicrocourseVo">
|
||||
select id, title, author, contents, type, scpoe, upanddown, sort, create_time from by_microcourse
|
||||
</sql>
|
||||
|
||||
<select id="selectByMicrocourseList" parameterType="ByMicrocourse" resultMap="ByMicrocourseResult">
|
||||
<include refid="selectByMicrocourseVo"/>
|
||||
<where>
|
||||
<if test="title != null and title != ''">and title = #{title}</if>
|
||||
<if test="author != null and author != ''">and author = #{author}</if>
|
||||
<if test="contents != null and contents != ''">and contents = #{contents}</if>
|
||||
<if test="type != null and type != ''">and type = #{type}</if>
|
||||
<if test="scpoe != null and scpoe != ''">and scpoe = #{scpoe}</if>
|
||||
<if test="upanddown != null and upanddown != ''">and upanddown = #{upanddown}</if>
|
||||
</where>
|
||||
order by sort
|
||||
</select>
|
||||
|
||||
<select id="selectByMicrocourseById" parameterType="Long" resultMap="ByMicrocourseResult">
|
||||
<include refid="selectByMicrocourseVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertByMicrocourse" parameterType="ByMicrocourse" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into by_microcourse
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="title != null and title != ''">title,</if>
|
||||
<if test="author != null and author != ''">author,</if>
|
||||
<if test="contents != null and contents != ''">contents,</if>
|
||||
<if test="type != null and type != ''">type,</if>
|
||||
<if test="scpoe != null and scpoe != ''">scpoe,</if>
|
||||
<if test="upanddown != null and upanddown != ''">upanddown,</if>
|
||||
<if test="sort != null ">sort,</if>
|
||||
<if test="createTime != null ">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="title != null and title != ''">#{title},</if>
|
||||
<if test="author != null and author != ''">#{author},</if>
|
||||
<if test="contents != null and contents != ''">#{contents},</if>
|
||||
<if test="type != null and type != ''">#{type},</if>
|
||||
<if test="scpoe != null and scpoe != ''">#{scpoe},</if>
|
||||
<if test="upanddown != null and upanddown != ''">#{upanddown},</if>
|
||||
<if test="sort != null ">#{sort},</if>
|
||||
<if test="createTime != null ">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateByMicrocourse" parameterType="ByMicrocourse">
|
||||
update by_microcourse
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="title != null and title != ''">title = #{title},</if>
|
||||
<if test="author != null and author != ''">author = #{author},</if>
|
||||
<if test="contents != null and contents != ''">contents = #{contents},</if>
|
||||
<if test="type != null and type != ''">type = #{type},</if>
|
||||
<if test="scpoe != null and scpoe != ''">scpoe = #{scpoe},</if>
|
||||
<if test="upanddown != null and upanddown != ''">upanddown = #{upanddown},</if>
|
||||
<if test="sort != null ">sort = #{sort},</if>
|
||||
<if test="createTime != null ">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteByMicrocourseById" parameterType="Long">
|
||||
delete from by_microcourse where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByMicrocourseByIds" parameterType="String">
|
||||
delete from by_microcourse where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user