TienChin-课程管理-课程搜索
1.TienChin 开篇-运行 RuoYiVue2.TienChin 代码格式化-项目结构大改造3.TienChin 项目改造完善&项目结构分析4.TienChin 验证码响应结果分析&验证码生成接口分析5.TienChin 运行 RuoYi-Vue36.TienChin-系统功能介绍7.TienChin 新建业务菜单8.TienChin 创建菜单页面9.TienChin 引入 MyBatisPlus10.TienChin 渠道管理-表创建11.TienChin 渠道管理-渠道类型12.TienChin 渠道管理-工程创建13.TienChin 渠道管理-查看渠道接口14.TienChin 渠道管理-前端展示渠道信息15.TienChin 渠道管理-配置字典常量16.TienChin 渠道管理-字典原理分析17.TienChin 渠道管理-权限分配18.TienChin 渠道管理-添加渠道19.TienChin 渠道管理-配置校验失败信息20.TienChin 渠道管理-添加渠道页面开发21.TienChin 渠道管理-更新渠道接口开发22.TienChin 渠道管理-删除渠道23.TienChin 渠道管理-渠道搜索24.TienChin 渠道管理-渠道导出25.TienChin 渠道管理-渠道导入26.TienChin 渠道管理-渠道页面完善27.TienChin 活动管理-准备工作28.TienChin 活动管理-工程创建29.TienChin 活动管理-活动列表展示30.TienChin 活动管理-活动状态完善31.TienChin 活动管理-添加活动页面32.TienChin 活动管理-添加活动接口33.TienChin 活动管理-设置活动的默认状态34.TienChin 活动管理-完成添加活动35.TienChin 活动管理-修改活动接口36.TienChin 活动管理-修改活动37.TienChin 活动管理-删除活动38.TienChin 活动管理-搜索活动39.TienChin 活动管理-活动导出40.TienChin-课程管理-数据表创建41.TienChin-课程管理-创建工程42.TienChin-课程管理-配置课程字典43.TienChin-课程管理-展示课程列表44.TienChin-课程管理-添加课程接口45.TienChin-课程管理-添加课程页面46.TienChin-课程管理-课程更新接口47.TienChin-课程管理-删除课程
48.TienChin-课程管理-课程搜索
49.TienChin-课程管理-课程导出后端
新建 CourseVO.java:
/**
* CourseVO类是一个课程的值对象,用于存储课程的相关信息。
* 它包含了课程的名称、类型、适用对象、最低价格和最高价格等属性。
*/
public class CourseVO {
private String name; // 课程名称
private String type; // 课程类型
private String applyTo; // 适用对象
private Double minPrice; // 最低价格
private Double maxPrice; // 最高价格
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getApplyTo() {
return applyTo;
}
public void setApplyTo(String applyTo) {
this.applyTo = applyTo;
}
public Double getMinPrice() {
return minPrice;
}
public void setMinPrice(Double minPrice) {
this.minPrice = minPrice;
}
public Double getMaxPrice() {
return maxPrice;
}
public void setMaxPrice(Double maxPrice) {
this.maxPrice = maxPrice;
}
}
CourseController.java
更改列表查询方法:
@PreAuthorize("hasPermission('tienchin:course:list')")
@GetMapping("/list")
TableDataInfo list(CourseVO courseVO) {
startPage();
return getDataTable(iCourseService.selectCourseList(courseVO));
}
ICourseService.java
/**
* 查询课程列表
*
* @param courseVO 课程信息
* @return {@code List<Course>}
*/
List<Course> selectCourseList(CourseVO courseVO);
CourseServiceImpl.java
@Override
public List<Course> selectCourseList(CourseVO courseVO) {
return courseMapper.selectCourseList(courseVO);
}
CourseMapper.java
/**
* 查询课程列表
*
* @param courseVO 课程信息
* @return {@code List<Course>}
*/
List<Course> selectCourseList(CourseVO courseVO);
CourseMapper.xml
<?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="top.it6666.course.mapper.CourseMapper">
<select id="selectCourseList" resultType="top.it6666.course.domain.Course">
SELECT *
FROM tienchin_course
WHERE del_flag = 0
<if test="name != null and name != ''">
AND name LIKE CONCAT('%', #{name}, '%')
</if>
<if test="type != null and type != ''">
AND type = #{type}
</if>
<if test="applyTo != null and applyTo != ''">
AND apply_to = #{applyTo}
</if>
<if test="minPrice != null">
AND price >= #{minPrice}
</if>
<if test="maxPrice != null">
AND price <= #{maxPrice}
</if>
</select>
</mapper>
前端
index.vue:
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="70px">
<el-form-item label="课程名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入课程名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="课程类型" prop="type">
<el-select
v-model="queryParams.type"
placeholder="请选择课程类型"
clearable
>
<el-option
v-for="ct in course_type"
:key="ct.value"
:label="ct.label"
:value="ct.value"
/>
</el-select>
</el-form-item>
<el-form-item label="适用人群" prop="applyTo">
<el-select
v-model="queryParams.applyTo"
placeholder="请选择适用人群"
clearable
>
<el-option
v-for="cat in course_apply_to"
:key="cat.value"
:label="cat.label"
:value="cat.value"
/>
</el-select>
</el-form-item>
<el-form-item label="最低价格" prop="minPrice">
<el-input-number
v-model="queryParams.minPrice"
placeholder="最低价格"
clearable
@keyup.enter="handleQuery"
:precision="2"
:step="100"
:min="0"
/>
</el-form-item>
<el-form-item label="最高价格" prop="maxPrice">
<el-input-number
v-model="queryParams.maxPrice"
placeholder="最高价格"
clearable
@keyup.enter="handleQuery"
:precision="2"
:step="100"
:min="0"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
完善一下搜索条件对应的字段即可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」
· 写一个简单的SQL生成工具