Update ForumServiceImpl.java

杜韦注释
p2x9nfpei 4 months ago
parent efcd7b8430
commit e074130ae0

@ -1,41 +1,67 @@
// 定义包名为 com.service.impl
package com.service.impl;
// 导入 com.utils 包下的 StringUtil 类
import com.utils.StringUtil;
// 导入 com.service 包下的 DictionaryService 接口
import com.service.DictionaryService;
// 导入 com.utils 包下的 ClazzDiff 类
import com.utils.ClazzDiff;
// 导入 Spring 框架的 BeanUtils 类
import org.springframework.beans.BeanUtils;
// 导入 Spring 框架的 Autowired 注解
import org.springframework.beans.factory.annotation.Autowired;
// 导入 Spring 框架的 Service 注解
import org.springframework.stereotype.Service;
// 导入 Java 反射机制中的 Field 类
import java.lang.reflect.Field;
// 导入 Java 集合框架中的相关类
import java.util.*;
// 导入 MyBatis-Plus 的 Page 类
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入 Spring 框架的 Transactional 注解
import org.springframework.transaction.annotation.Transactional;
// 导入自定义的 PageUtils 类
import com.utils.PageUtils;
// 导入自定义的 Query 类
import com.utils.Query;
// 导入 Spring 框架的 ContextLoader 类
import org.springframework.web.context.ContextLoader;
// 导入 Servlet 上下文类
import javax.servlet.ServletContext;
// 导入 HTTP 请求类
import javax.servlet.http.HttpServletRequest;
// 导入 Spring 框架的 Nullable 注解
import org.springframework.lang.Nullable;
// 导入 Spring 框架的 Assert 类
import org.springframework.util.Assert;
// 导入数据访问对象 ForumDao 接口
import com.dao.ForumDao;
// 导入实体类 ForumEntity
import com.entity.ForumEntity;
// 导入服务接口 ForumService
import com.service.ForumService;
// 导入视图类 ForumView
import com.entity.view.ForumView;
/**
*
*/
// 使用 Spring 的 Service 注解,将该类标记为服务组件,名称为 forumService
@Service("forumService")
// 使用 Spring 的 Transactional 注解,开启事务管理
@Transactional
// 定义 ForumServiceImpl 类,继承自 MyBatis-Plus 的 ServiceImpl 类,并实现 ForumService 接口
public class ForumServiceImpl extends ServiceImpl<ForumDao, ForumEntity> implements ForumService {
// 重写 ForumService 接口中的 queryPage 方法
@Override
// 定义 queryPage 方法,用于查询分页数据,接收一个包含查询参数的 Map 对象
public PageUtils queryPage(Map<String,Object> params) {
// 根据传入的参数创建一个 ForumView 类型的分页对象
Page<ForumView> page =new Query<ForumView>(params).getPage();
// 调用 baseMapper 的 selectListView 方法查询数据列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page,params));
// 根据分页对象创建 PageUtils 对象并返回
return new PageUtils(page);
}
}
Loading…
Cancel
Save