New file |
| | |
| | | package com.example.erp.service.sd; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.example.erp.entity.sd.Customer; |
| | | import com.example.erp.mapper.sd.BasicDateMapper; |
| | | import com.example.erp.mapper.sd.CustomerMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.example.erp.entity.sd.BasicData; |
| | | |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | @DS("sd") |
| | | public class BasicDateService { |
| | | @Autowired |
| | | private BasicDateMapper basicDateMapper; |
| | | |
| | | @Autowired |
| | | private CustomerMapper customerMapper; |
| | | |
| | | //获取订单基本数据 |
| | | public Map<String, List<Object>> getOrderBasicData() { |
| | | //获取订单基本数据类型 |
| | | List<String> orderBasicDataType = basicDateMapper.getOrderBasicDataType(); |
| | | //获取订单基本数据 |
| | | List<BasicData> orderBasicData = basicDateMapper.getOrderBasicData(); |
| | | //创建Map对象 |
| | | Map<String, List<Object>> orderBasicDataMap = new HashMap<>(); ; |
| | | //创建List对象 |
| | | |
| | | //遍历订单基本数据类型 |
| | | for(String item :orderBasicDataType){ |
| | | List<Object> orderBasicDataList = new ArrayList<>(); |
| | | //将类型和List对象放入Map中 |
| | | orderBasicDataMap.put(item,orderBasicDataList); |
| | | } |
| | | //遍历订单基本数据 |
| | | for (BasicData item : orderBasicData){ |
| | | //将数据放入List中 |
| | | orderBasicDataMap.get(item.getBasicCategory()).add(item); |
| | | } |
| | | |
| | | //获取客户列表 |
| | | List<Object> orderBasicDataList = new ArrayList<>(); |
| | | orderBasicDataMap.put("customer",orderBasicDataList); |
| | | List<Customer> customerList = customerMapper.getCustomerList(); |
| | | for (Customer customer : customerList){ |
| | | orderBasicDataMap.get("customer").add(customer); |
| | | } |
| | | |
| | | |
| | | //返回Map对象 |
| | | return orderBasicDataMap; |
| | | } |
| | | } |