添加课程管理模块
This commit is contained in:
parent
7c1b5b7725
commit
d1f4c3539f
7
pom.xml
7
pom.xml
@ -185,6 +185,12 @@
|
|||||||
<version>${ruoyi.version}</version>
|
<version>${ruoyi.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-core</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
@ -195,6 +201,7 @@
|
|||||||
<module>ruoyi-quartz</module>
|
<module>ruoyi-quartz</module>
|
||||||
<module>ruoyi-generator</module>
|
<module>ruoyi-generator</module>
|
||||||
<module>ruoyi-common</module>
|
<module>ruoyi-common</module>
|
||||||
|
<module>ruoyi-core</module>
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
@ -54,6 +54,11 @@
|
|||||||
<artifactId>ruoyi-generator</artifactId>
|
<artifactId>ruoyi-generator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
26
ruoyi-core/pom.xml
Normal file
26
ruoyi-core/pom.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi</artifactId>
|
||||||
|
<version>3.8.8</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>ruoyi-core</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
@ -0,0 +1,103 @@
|
|||||||
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
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.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.Course;
|
||||||
|
import com.ruoyi.system.service.ICourseService;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-11-07
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/course")
|
||||||
|
public class CourseController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ICourseService courseService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询课程列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(Course course)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<Course> list = courseService.selectCourseList(course);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出课程列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:course:export')")
|
||||||
|
@Log(title = "课程", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, Course course)
|
||||||
|
{
|
||||||
|
List<Course> list = courseService.selectCourseList(course);
|
||||||
|
ExcelUtil<Course> util = new ExcelUtil<Course>(Course.class);
|
||||||
|
util.exportExcel(response, list, "课程数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取课程详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:course:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Integer id)
|
||||||
|
{
|
||||||
|
return success(courseService.selectCourseById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增课程
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:course:add')")
|
||||||
|
@Log(title = "课程", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody Course course)
|
||||||
|
{
|
||||||
|
return toAjax(courseService.insertCourse(course));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改课程
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:course:edit')")
|
||||||
|
@Log(title = "课程", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody Course course)
|
||||||
|
{
|
||||||
|
return toAjax(courseService.updateCourse(course));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除课程
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:course:remove')")
|
||||||
|
@Log(title = "课程", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Integer[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(courseService.deleteCourseByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
149
ruoyi-core/src/main/java/com/ruoyi/system/domain/Course.java
Normal file
149
ruoyi-core/src/main/java/com/ruoyi/system/domain/Course.java
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程对象 db_course
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-11-07
|
||||||
|
*/
|
||||||
|
public class Course extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 课程ID */
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/** 主讲老师 */
|
||||||
|
@Excel(name = "主讲老师")
|
||||||
|
private String teacher;
|
||||||
|
|
||||||
|
/** 课程标题 */
|
||||||
|
@Excel(name = "课程标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/** 课程简介 */
|
||||||
|
@Excel(name = "课程简介")
|
||||||
|
private String about;
|
||||||
|
|
||||||
|
/** 课程详细 */
|
||||||
|
@Excel(name = "课程详细")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/** 课程数量 */
|
||||||
|
@Excel(name = "课程数量")
|
||||||
|
private Long lessone;
|
||||||
|
|
||||||
|
/** 课程价格 */
|
||||||
|
@Excel(name = "课程价格")
|
||||||
|
private Long price;
|
||||||
|
|
||||||
|
/** 课程时长 */
|
||||||
|
@Excel(name = "课程时长")
|
||||||
|
private Long duration;
|
||||||
|
|
||||||
|
/** 最大学生 */
|
||||||
|
@Excel(name = "最大学生")
|
||||||
|
private Long maxStudents;
|
||||||
|
|
||||||
|
public void setId(Integer id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setTeacher(String teacher)
|
||||||
|
{
|
||||||
|
this.teacher = teacher;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTeacher()
|
||||||
|
{
|
||||||
|
return teacher;
|
||||||
|
}
|
||||||
|
public void setTitle(String title)
|
||||||
|
{
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle()
|
||||||
|
{
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
public void setAbout(String about)
|
||||||
|
{
|
||||||
|
this.about = about;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAbout()
|
||||||
|
{
|
||||||
|
return about;
|
||||||
|
}
|
||||||
|
public void setDescription(String description)
|
||||||
|
{
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription()
|
||||||
|
{
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
public void setLessone(Long lessone)
|
||||||
|
{
|
||||||
|
this.lessone = lessone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getLessone()
|
||||||
|
{
|
||||||
|
return lessone;
|
||||||
|
}
|
||||||
|
public void setPrice(Long price)
|
||||||
|
{
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getPrice()
|
||||||
|
{
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
public void setDuration(Long duration)
|
||||||
|
{
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDuration()
|
||||||
|
{
|
||||||
|
return duration;
|
||||||
|
}
|
||||||
|
public void setMaxStudents(Long maxStudents)
|
||||||
|
{
|
||||||
|
this.maxStudents = maxStudents;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMaxStudents()
|
||||||
|
{
|
||||||
|
return maxStudents;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("teacher", getTeacher())
|
||||||
|
.append("title", getTitle())
|
||||||
|
.append("about", getAbout())
|
||||||
|
.append("description", getDescription())
|
||||||
|
.append("lessone", getLessone())
|
||||||
|
.append("price", getPrice())
|
||||||
|
.append("duration", getDuration())
|
||||||
|
.append("maxStudents", getMaxStudents())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.system.domain.Course;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-11-07
|
||||||
|
*/
|
||||||
|
public interface CourseMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询课程
|
||||||
|
*
|
||||||
|
* @param id 课程主键
|
||||||
|
* @return 课程
|
||||||
|
*/
|
||||||
|
public Course selectCourseById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询课程列表
|
||||||
|
*
|
||||||
|
* @param course 课程
|
||||||
|
* @return 课程集合
|
||||||
|
*/
|
||||||
|
public List<Course> selectCourseList(Course course);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增课程
|
||||||
|
*
|
||||||
|
* @param course 课程
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertCourse(Course course);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改课程
|
||||||
|
*
|
||||||
|
* @param course 课程
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateCourse(Course course);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除课程
|
||||||
|
*
|
||||||
|
* @param id 课程主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteCourseById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除课程
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteCourseByIds(Integer[] ids);
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.system.domain.Course;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-11-07
|
||||||
|
*/
|
||||||
|
public interface ICourseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询课程
|
||||||
|
*
|
||||||
|
* @param id 课程主键
|
||||||
|
* @return 课程
|
||||||
|
*/
|
||||||
|
public Course selectCourseById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询课程列表
|
||||||
|
*
|
||||||
|
* @param course 课程
|
||||||
|
* @return 课程集合
|
||||||
|
*/
|
||||||
|
public List<Course> selectCourseList(Course course);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增课程
|
||||||
|
*
|
||||||
|
* @param course 课程
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertCourse(Course course);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改课程
|
||||||
|
*
|
||||||
|
* @param course 课程
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateCourse(Course course);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除课程
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的课程主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteCourseByIds(Integer[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除课程信息
|
||||||
|
*
|
||||||
|
* @param id 课程主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteCourseById(Integer id);
|
||||||
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.system.mapper.CourseMapper;
|
||||||
|
import com.ruoyi.system.domain.Course;
|
||||||
|
import com.ruoyi.system.service.ICourseService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-11-07
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CourseServiceImpl implements ICourseService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private CourseMapper courseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询课程
|
||||||
|
*
|
||||||
|
* @param id 课程主键
|
||||||
|
* @return 课程
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Course selectCourseById(Integer id)
|
||||||
|
{
|
||||||
|
return courseMapper.selectCourseById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询课程列表
|
||||||
|
*
|
||||||
|
* @param course 课程
|
||||||
|
* @return 课程
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Course> selectCourseList(Course course)
|
||||||
|
{
|
||||||
|
return courseMapper.selectCourseList(course);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增课程
|
||||||
|
*
|
||||||
|
* @param course 课程
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertCourse(Course course)
|
||||||
|
{
|
||||||
|
return courseMapper.insertCourse(course);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改课程
|
||||||
|
*
|
||||||
|
* @param course 课程
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateCourse(Course course)
|
||||||
|
{
|
||||||
|
return courseMapper.updateCourse(course);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除课程
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的课程主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteCourseByIds(Integer[] ids)
|
||||||
|
{
|
||||||
|
return courseMapper.deleteCourseByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除课程信息
|
||||||
|
*
|
||||||
|
* @param id 课程主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteCourseById(Integer id)
|
||||||
|
{
|
||||||
|
return courseMapper.deleteCourseById(id);
|
||||||
|
}
|
||||||
|
}
|
91
ruoyi-core/src/main/resources/mapper/system/CourseMapper.xml
Normal file
91
ruoyi-core/src/main/resources/mapper/system/CourseMapper.xml
Normal file
@ -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.system.mapper.CourseMapper">
|
||||||
|
|
||||||
|
<resultMap type="Course" id="CourseResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="teacher" column="teacher" />
|
||||||
|
<result property="title" column="title" />
|
||||||
|
<result property="about" column="about" />
|
||||||
|
<result property="description" column="description" />
|
||||||
|
<result property="lessone" column="lessone" />
|
||||||
|
<result property="price" column="price" />
|
||||||
|
<result property="duration" column="duration" />
|
||||||
|
<result property="maxStudents" column="max_students" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectCourseVo">
|
||||||
|
select id, teacher, title, about, description, lessone, price, duration, max_students from db_course
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectCourseList" parameterType="Course" resultMap="CourseResult">
|
||||||
|
<include refid="selectCourseVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="teacher != null and teacher != ''"> and teacher = #{teacher}</if>
|
||||||
|
<if test="title != null and title != ''"> and title = #{title}</if>
|
||||||
|
<if test="about != null and about != ''"> and about = #{about}</if>
|
||||||
|
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||||
|
<if test="lessone != null "> and lessone = #{lessone}</if>
|
||||||
|
<if test="price != null "> and price = #{price}</if>
|
||||||
|
<if test="duration != null "> and duration = #{duration}</if>
|
||||||
|
<if test="maxStudents != null "> and max_students = #{maxStudents}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCourseById" parameterType="Integer" resultMap="CourseResult">
|
||||||
|
<include refid="selectCourseVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertCourse" parameterType="Course" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into db_course
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="teacher != null">teacher,</if>
|
||||||
|
<if test="title != null">title,</if>
|
||||||
|
<if test="about != null">about,</if>
|
||||||
|
<if test="description != null">description,</if>
|
||||||
|
<if test="lessone != null">lessone,</if>
|
||||||
|
<if test="price != null">price,</if>
|
||||||
|
<if test="duration != null">duration,</if>
|
||||||
|
<if test="maxStudents != null">max_students,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="teacher != null">#{teacher},</if>
|
||||||
|
<if test="title != null">#{title},</if>
|
||||||
|
<if test="about != null">#{about},</if>
|
||||||
|
<if test="description != null">#{description},</if>
|
||||||
|
<if test="lessone != null">#{lessone},</if>
|
||||||
|
<if test="price != null">#{price},</if>
|
||||||
|
<if test="duration != null">#{duration},</if>
|
||||||
|
<if test="maxStudents != null">#{maxStudents},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateCourse" parameterType="Course">
|
||||||
|
update db_course
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="teacher != null">teacher = #{teacher},</if>
|
||||||
|
<if test="title != null">title = #{title},</if>
|
||||||
|
<if test="about != null">about = #{about},</if>
|
||||||
|
<if test="description != null">description = #{description},</if>
|
||||||
|
<if test="lessone != null">lessone = #{lessone},</if>
|
||||||
|
<if test="price != null">price = #{price},</if>
|
||||||
|
<if test="duration != null">duration = #{duration},</if>
|
||||||
|
<if test="maxStudents != null">max_students = #{maxStudents},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteCourseById" parameterType="Integer">
|
||||||
|
delete from db_course where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteCourseByIds" parameterType="String">
|
||||||
|
delete from db_course where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
@ -111,12 +111,12 @@ public class SecurityConfig
|
|||||||
.authorizeHttpRequests((requests) -> {
|
.authorizeHttpRequests((requests) -> {
|
||||||
permitAllUrl.getUrls().forEach(url -> requests.requestMatchers(url).permitAll());
|
permitAllUrl.getUrls().forEach(url -> requests.requestMatchers(url).permitAll());
|
||||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
||||||
requests.requestMatchers("/login", "/register", "/captchaImage").permitAll()
|
requests
|
||||||
// 静态资源,可匿名访问
|
.requestMatchers("/login", "/register", "/captchaImage").permitAll()
|
||||||
.requestMatchers(HttpMethod.GET, "/", "/*.html", "/**.html", "/**.css", "/**.js", "/profile/**").permitAll()
|
.requestMatchers(HttpMethod.GET, "/", "/*.html", "/**.html", "/**.css", "/**.js", "/profile/**").permitAll()
|
||||||
.requestMatchers("/swagger-ui.html", "/v3/api-docs/**", "/swagger-ui/**", "/druid/**").permitAll()
|
.requestMatchers("/swagger-ui.html", "/v3/api-docs/**", "/swagger-ui/**", "/druid/**").permitAll()
|
||||||
// 除上面外的所有请求全部需要鉴权认证
|
.requestMatchers("/system/course/**").permitAll()
|
||||||
.anyRequest().authenticated();
|
.anyRequest().authenticated();
|
||||||
})
|
})
|
||||||
// 添加Logout filter
|
// 添加Logout filter
|
||||||
.logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler))
|
.logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user