package com.chinaztt.mes.plan.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.chinaztt.mes.plan.dto.CustomerOrderForJointStockCompanyDTO; import com.chinaztt.mes.plan.dto.OrderParamDTO; import com.chinaztt.mes.plan.entity.CustomerOrderForJointStockCompany; import com.chinaztt.mes.plan.entity.OrderParam; import com.chinaztt.mes.plan.mapper.CustomerOrderForJointStockCompanyMapper; import com.chinaztt.mes.plan.mapper.OrderParamMapper; import com.chinaztt.mes.plan.service.CustomerOrderForJointStockCompanyService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; /** * @Description : 客户订单明细表(股份公司) * @ClassName : CustomerOrderForJointStockCompanyServiceImpl * @Author : user * @Date: 2022-08-16 15:22 */ @Slf4j @Service @AllArgsConstructor @Transactional(rollbackFor = Exception.class) public class CustomerOrderForJointStockCompanyServiceImpl extends ServiceImpl implements CustomerOrderForJointStockCompanyService{ private OrderParamMapper orderParamMapper; @Override public IPage getCustomerOrderPage(Page page, QueryWrapper planCustomerOrder, String type) { IPage iPage = baseMapper.getCustomerOrderPage(page, planCustomerOrder, type); return iPage; } @Override public CustomerOrderForJointStockCompanyDTO getCustomerOrderById(Long id) { CustomerOrderForJointStockCompany newCustomerOrder = baseMapper.selectById(id); CustomerOrderForJointStockCompanyDTO customerOrderDTO = new CustomerOrderForJointStockCompanyDTO(); BeanUtils.copyProperties(newCustomerOrder, customerOrderDTO); //获取字段和列名 List orderParamList = orderParamMapper.getAllOrder(); customerOrderDTO.setOrderParamList(orderParamList); //拼接crosstab所需要的验证数据 OrderParam orderParam = orderParamMapper.getParam(); //获取客户订单和绑定的订单参数 JSONObject customerOrderList = baseMapper.getCustomerOrderById(id, orderParam); customerOrderDTO.setCustomerOrderList(customerOrderList); List list = new ArrayList<>(); customerOrderDTO.setCustomerOrderAttachmentList(list); return customerOrderDTO; } }