You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
3.9 KiB
92 lines
3.9 KiB
// 声明该类所在的包为 com.service.impl
|
|
package com.service.impl;
|
|
|
|
// 导入 Spring 框架的 Service 注解,用于将该类标记为服务层组件
|
|
import org.springframework.stereotype.Service;
|
|
// 导入 Java 的 Map 接口,用于处理键值对数据
|
|
import java.util.Map;
|
|
// 导入 Java 的 List 接口,用于处理列表数据
|
|
import java.util.List;
|
|
|
|
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
|
|
import com.baomidou.mybatisplus.mapper.Wrapper;
|
|
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
// 导入自定义的分页工具类
|
|
import com.utils.PageUtils;
|
|
// 导入自定义的查询工具类
|
|
import com.utils.Query;
|
|
|
|
// 导入我的课程数据访问对象
|
|
import com.dao.WodekechengDao;
|
|
// 导入我的课程实体类
|
|
import com.entity.WodekechengEntity;
|
|
// 导入我的课程服务接口
|
|
import com.service.WodekechengService;
|
|
// 导入我的课程值对象类
|
|
import com.entity.vo.WodekechengVO;
|
|
// 导入我的课程视图类
|
|
import com.entity.view.WodekechengView;
|
|
|
|
// 使用 @Service 注解将该类标记为 Spring 服务,服务名为 wodekechengService
|
|
@Service("wodekechengService")
|
|
// 定义我的课程服务实现类,继承自 ServiceImpl 并实现 WodekechengService 接口
|
|
public class WodekechengServiceImpl extends ServiceImpl<WodekechengDao, WodekechengEntity> implements WodekechengService {
|
|
|
|
// 重写 queryPage 方法,根据传入的参数查询我的课程实体的分页数据
|
|
@Override
|
|
public PageUtils queryPage(Map<String, Object> params) {
|
|
// 创建一个分页对象,根据传入的参数生成
|
|
Page<WodekechengEntity> page = this.selectPage(
|
|
new Query<WodekechengEntity>(params).getPage(),
|
|
// 创建一个空的查询条件包装器
|
|
new EntityWrapper<WodekechengEntity>()
|
|
);
|
|
// 返回分页工具类对象,封装分页信息
|
|
return new PageUtils(page);
|
|
}
|
|
|
|
// 重写 queryPage 方法,根据传入的参数和查询条件查询我的课程视图的分页数据
|
|
@Override
|
|
public PageUtils queryPage(Map<String, Object> params, Wrapper<WodekechengEntity> wrapper) {
|
|
// 创建一个分页对象,根据传入的参数生成,用于存储我的课程视图数据
|
|
Page<WodekechengView> page = new Query<WodekechengView>(params).getPage();
|
|
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取我的课程视图列表,并设置到分页对象中
|
|
page.setRecords(baseMapper.selectListView(page, wrapper));
|
|
// 返回分页工具类对象,封装分页信息
|
|
PageUtils pageUtil = new PageUtils(page);
|
|
return pageUtil;
|
|
}
|
|
|
|
// 重写 selectListVO 方法,根据查询条件查询我的课程值对象列表
|
|
@Override
|
|
public List<WodekechengVO> selectListVO(Wrapper<WodekechengEntity> wrapper) {
|
|
// 调用基础映射器的 selectListVO 方法进行查询
|
|
return baseMapper.selectListVO(wrapper);
|
|
}
|
|
|
|
// 重写 selectVO 方法,根据查询条件查询单个我的课程值对象
|
|
@Override
|
|
public WodekechengVO selectVO(Wrapper<WodekechengEntity> wrapper) {
|
|
// 调用基础映射器的 selectVO 方法进行查询
|
|
return baseMapper.selectVO(wrapper);
|
|
}
|
|
|
|
// 重写 selectListView 方法,根据查询条件查询我的课程视图列表
|
|
@Override
|
|
public List<WodekechengView> selectListView(Wrapper<WodekechengEntity> wrapper) {
|
|
// 调用基础映射器的 selectListView 方法进行查询
|
|
return baseMapper.selectListView(wrapper);
|
|
}
|
|
|
|
// 重写 selectView 方法,根据查询条件查询单个我的课程视图
|
|
@Override
|
|
public WodekechengView selectView(Wrapper<WodekechengEntity> wrapper) {
|
|
// 调用基础映射器的 selectView 方法进行查询
|
|
return baseMapper.selectView(wrapper);
|
|
}
|
|
} |