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.
gymnasium/src/main/java/com/service/impl/ConfigServiceImpl.java

67 lines
2.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package com.service.impl;
// 定义当前类所在的包路径,表示这是服务实现层的代码
// 导入必要的工具类和服务接口
import java.util.Map;
// Java Map接口用于存储键值对集合
import org.springframework.stereotype.Service;
// Spring服务注解标识该类为服务层组件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// MyBatis-Plus条件构造器用于构建查询条件
import com.baomidou.mybatisplus.plugins.Page;
// MyBatis-Plus分页插件类用于分页查询
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// MyBatis-Plus服务实现基类提供通用CRUD操作
import com.dao.ConfigDao;
// 系统配置DAO接口定义数据库操作方法
import com.entity.ConfigEntity;
// 系统配置实体类,对应数据库表
import com.service.ConfigService;
// 系统配置服务接口,定义业务方法
import com.utils.PageUtils;
// 分页工具类,用于封装分页结果
import com.utils.Query;
// 查询工具类,用于构建查询条件
// 系统配置服务实现类
//继承MyBatis-Plus服务基类并实现自定义服务接口
//@author yangliyuan 作者信息
//@date 2019年10月10日 创建日期
@Service("configService")
// 声明为Spring服务组件指定bean名称为"configService"
public class ConfigServiceImpl extends ServiceImpl<ConfigDao, ConfigEntity> implements ConfigService {
//分页查询系统配置数据
//param params 查询参数Map包含
// - page当前页码
// - limit每页记录数
// - 其他查询条件参数
//return 封装了分页信息的PageUtils对象
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 使用MyBatis-Plus的分页查询方法
// 1. 通过Query工具类从params参数中提取分页信息创建Page对象
// 2. 使用EntityWrapper构建查询条件此处为空条件查询全部
// 3. 执行分页查询并将结果封装到Page对象中
Page<ConfigEntity> page = this.selectPage(
new Query<ConfigEntity>(params).getPage(),
new EntityWrapper<ConfigEntity>()
);
// 将MyBatis-Plus的分页对象转换为统一的PageUtils格式返回
return new PageUtils(page);
}
}