| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.jilongda.applet.mapper.TOrderGoodsMapper; |
| | | import com.jilongda.applet.model.TOrder; |
| | | import com.jilongda.applet.mapper.TOrderMapper; |
| | | import com.jilongda.applet.model.TOrderGoods; |
| | | import com.jilongda.applet.query.TOrderQuery; |
| | | import com.jilongda.applet.service.TOrderService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.jilongda.applet.vo.TOrderVO; |
| | | import com.jilongda.common.basic.PageInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | @Service |
| | | public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> implements TOrderService { |
| | | |
| | | @Autowired |
| | | private TOrderGoodsMapper orderGoodsMapper; |
| | | @Override |
| | | public PageInfo<TOrderVO> pageList(TOrderQuery query) { |
| | | PageInfo<TOrderVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TOrderVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | for (TOrderVO tOrderVO : list) { |
| | | List<TOrderGoods> orderGoods = orderGoodsMapper.selectList(new LambdaQueryWrapper<TOrderGoods>().eq(TOrderGoods::getOrderId, tOrderVO.getId())); |
| | | for (TOrderGoods orderGood : orderGoods) { |
| | | if (StringUtils.hasLength(orderGood.getModelName())){ |
| | | // 镜架 |
| | | tOrderVO.setFrame(orderGood.getBrandName()+orderGood.getModelName()+" "+orderGood.getColor()); |
| | | continue; |
| | | } |
| | | if (StringUtils.hasLength(orderGood.getLLens())){ |
| | | String temp = null; |
| | | switch (orderGood.getType()){ |
| | | case 1: |
| | | temp = "球面"; |
| | | break; |
| | | case 2: |
| | | temp = "非球面"; |
| | | break; |
| | | case 3: |
| | | temp = "双非"; |
| | | break; |
| | | } |
| | | tOrderVO.setLensL(orderGood.getBrandName() + orderGood.getSeriesName() + temp + orderGood.getRefractiveIndex()); |
| | | continue; |
| | | } |
| | | if (StringUtils.hasLength(orderGood.getRLens())){ |
| | | String temp = null; |
| | | switch (orderGood.getType()){ |
| | | case 1: |
| | | temp = "球面"; |
| | | break; |
| | | case 2: |
| | | temp = "非球面"; |
| | | break; |
| | | case 3: |
| | | temp = "双非"; |
| | | break; |
| | | } |
| | | tOrderVO.setLensR(orderGood.getBrandName() + orderGood.getSeriesName() + temp + orderGood.getRefractiveIndex()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |