微型课程
This commit is contained in:
@ -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>
|
Reference in New Issue
Block a user