| | |
| | | package com.jilongda.manage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.jilongda.common.basic.PageInfo; |
| | | import com.jilongda.manage.mapper.TAppUserMapper; |
| | | import com.jilongda.manage.mapper.TOrderMapper; |
| | | import com.jilongda.manage.model.TAppUser; |
| | | import com.jilongda.manage.model.TOrder; |
| | | import com.jilongda.manage.model.TOrderAftersales; |
| | | import com.jilongda.manage.mapper.TOrderAftersalesMapper; |
| | | import com.jilongda.manage.query.TOrderAftersalesQuery; |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.jilongda.manage.vo.TOrderAftersalesVO; |
| | | import com.jilongda.manage.vo.TSupplierVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TOrderAftersalesServiceImpl extends ServiceImpl<TOrderAftersalesMapper, TOrderAftersales> implements TOrderAftersalesService { |
| | | |
| | | @Autowired |
| | | private TAppUserMapper appUserMapper; |
| | | @Autowired |
| | | private TOrderMapper orderMapper; |
| | | @Override |
| | | public PageInfo<TOrderAftersalesVO> pageList(TOrderAftersalesQuery query) { |
| | | if (StringUtils.hasLength(query.getName())){ |
| | | List<Integer> collect = appUserMapper.selectList(new LambdaQueryWrapper<TAppUser>() |
| | | .eq(TAppUser::getName, query.getName())).stream() |
| | | .map(TAppUser::getId).collect(Collectors.toList()); |
| | | if (collect.isEmpty())collect.add(-1); |
| | | query.setUserIds(collect); |
| | | } |
| | | PageInfo<TOrderAftersalesVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TOrderAftersalesVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | for (TOrderAftersalesVO tOrderAftersalesVO : list) { |
| | | TOrder tOrder = orderMapper.selectById(tOrderAftersalesVO.getOrderId()); |
| | | TAppUser tAppUser = appUserMapper.selectById(tOrder.getUserId()); |
| | | if (tAppUser!=null&&(!StringUtils.hasLength(tOrderAftersalesVO.getRealName()))){ |
| | | tOrderAftersalesVO.setName(tAppUser.getName()); |
| | | tOrderAftersalesVO.setRealName(tAppUser.getRealName()); |
| | | tOrderAftersalesVO.setPhone(tAppUser.getPhone()); |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |