|
|
package com.service.impl;
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import java.util.Map;
|
|
|
import java.util.List;
|
|
|
|
|
|
import com.baomidou.mybatisplus.mapper.Wrapper;
|
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
|
import com.utils.PageUtils;
|
|
|
import com.utils.Query;
|
|
|
|
|
|
import com.dao.PeisongxinxiDao;
|
|
|
import com.entity.PeisongxinxiEntity;
|
|
|
import com.service.PeisongxinxiService;
|
|
|
import com.entity.vo.PeisongxinxiVO;
|
|
|
import com.entity.view.PeisongxinxiView;
|
|
|
|
|
|
/**
|
|
|
* 配送信息服务实现类
|
|
|
* 核心职责:管理配送信息(Peisongxinxi)数据的业务逻辑
|
|
|
*
|
|
|
* 技术架构:
|
|
|
* 1. 继承MyBatis-Plus的ServiceImpl,获得基础的CRUD能力
|
|
|
* 2. 实现自定义的PeisongxinxiService接口,定义配送信息特有的业务方法
|
|
|
* 3. 使用VO(Value Object)和View对象实现数据分层
|
|
|
*/
|
|
|
@Service("peisongxinxiService") // Spring服务注解,指定bean名称为"peisongxinxiService"
|
|
|
public class PeisongxinxiServiceImpl extends ServiceImpl<PeisongxinxiDao, PeisongxinxiEntity> implements PeisongxinxiService {
|
|
|
|
|
|
/**
|
|
|
* 分页查询配送信息(基础版本)
|
|
|
* 使用默认的EntityWrapper进行条件查询,返回实体对象分页
|
|
|
* @param params 请求参数,包含分页参数(page、limit等)
|
|
|
* @return 分页工具对象,包含分页数据和分页信息
|
|
|
*/
|
|
|
@Override
|
|
|
public PageUtils queryPage(Map<String, Object> params) {
|
|
|
// 创建分页查询:使用Query工具类解析参数创建Page对象
|
|
|
Page<PeisongxinxiEntity> page = this.selectPage(
|
|
|
new Query<PeisongxinxiEntity>(params).getPage(), // 解析分页参数
|
|
|
new EntityWrapper<PeisongxinxiEntity>() // 创建空的查询条件包装器
|
|
|
);
|
|
|
return new PageUtils(page); // 返回自定义的分页工具对象
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 分页查询配送信息(增强版本)
|
|
|
* 支持自定义查询条件和返回视图对象,包含关联数据
|
|
|
* @param params 请求参数,包含分页参数
|
|
|
* @param wrapper 自定义查询条件包装器
|
|
|
* @return 分页工具对象,包含分页的视图数据
|
|
|
*/
|
|
|
@Override
|
|
|
public PageUtils queryPage(Map<String, Object> params, Wrapper<PeisongxinxiEntity> wrapper) {
|
|
|
// 创建分页对象
|
|
|
Page<PeisongxinxiView> page = new Query<PeisongxinxiView>(params).getPage();
|
|
|
// 执行分页查询,获取视图数据(包含关联表信息)
|
|
|
page.setRecords(baseMapper.selectListView(page, wrapper));
|
|
|
// 封装分页结果
|
|
|
PageUtils pageUtil = new PageUtils(page);
|
|
|
return pageUtil;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询配送信息VO列表
|
|
|
* 返回值对象列表,用于列表展示,包含核心业务字段
|
|
|
* @param wrapper 查询条件包装器
|
|
|
* @return 配送信息VO列表
|
|
|
*/
|
|
|
@Override
|
|
|
public List<PeisongxinxiVO> selectListVO(Wrapper<PeisongxinxiEntity> wrapper) {
|
|
|
return baseMapper.selectListVO(wrapper);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询单个配送信息VO
|
|
|
* 返回单个值对象,用于详情展示
|
|
|
* @param wrapper 查询条件包装器
|
|
|
* @return 单个配送信息VO对象
|
|
|
*/
|
|
|
@Override
|
|
|
public PeisongxinxiVO selectVO(Wrapper<PeisongxinxiEntity> wrapper) {
|
|
|
return baseMapper.selectVO(wrapper);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询配送信息视图列表
|
|
|
* 返回视图对象列表,包含完整的关联数据(如用户信息、快递员信息、快递信息等)
|
|
|
* @param wrapper 查询条件包装器
|
|
|
* @return 配送信息视图列表
|
|
|
*/
|
|
|
@Override
|
|
|
public List<PeisongxinxiView> selectListView(Wrapper<PeisongxinxiEntity> wrapper) {
|
|
|
return baseMapper.selectListView(wrapper);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询单个配送信息视图
|
|
|
* 返回单个视图对象,包含所有关联的表数据,用于详情页展示
|
|
|
* @param wrapper 查询条件包装器
|
|
|
* @return 单个配送信息视图对象
|
|
|
*/
|
|
|
@Override
|
|
|
public PeisongxinxiView selectView(Wrapper<PeisongxinxiEntity> wrapper) {
|
|
|
return baseMapper.selectView(wrapper);
|
|
|
}
|
|
|
} |