|
|
|
@ -16,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
@ -78,6 +79,8 @@ public class YysDeviceController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private YysDeviceService yysDeviceService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private YysDeviceMaterialService yysDeviceMaterialService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ConfigValueUtil configValueUtil;
|
|
|
|
@ -93,9 +96,15 @@ public class YysDeviceController {
|
|
|
|
|
public ActionResult list(@RequestBody YysDevicePagination yysDevicePagination) throws IOException {
|
|
|
|
|
List<YysDeviceEntity> list = yysDeviceService.getList(yysDevicePagination);
|
|
|
|
|
List<Map<String, Object>> realList = new ArrayList<>();
|
|
|
|
|
//查询设备绑定物料信息
|
|
|
|
|
List<YysDeviceMaterialEntity> list1 = yysDeviceMaterialService.list();
|
|
|
|
|
Map<String, List<YysDeviceMaterialEntity>> collect = list1.stream().collect(Collectors.groupingBy(YysDeviceMaterialEntity::getDeviceCode));
|
|
|
|
|
for (YysDeviceEntity entity : list) {
|
|
|
|
|
Map<String, Object> yysDeviceMap = JsonUtil.entityToMap(entity);
|
|
|
|
|
yysDeviceMap.put("id", yysDeviceMap.get("id"));
|
|
|
|
|
if (collect.containsKey(entity.getDeviceCode())) {
|
|
|
|
|
yysDeviceMap.put("data", collect.get(entity.getDeviceCode()));
|
|
|
|
|
}
|
|
|
|
|
//副表数据
|
|
|
|
|
//子表数据
|
|
|
|
|
realList.add(yysDeviceMap);
|
|
|
|
|