Vue和Java常用代码

一、Java分组,加收集ID获取数据

//收集查询的ID
List materialIds = receiveGoodsOrder.getReceiveGoodsOrderDetailList().stream()
                .map(ReceiveGoodsOrderDetail::getGoodsId)
				.filter(o -> o != null)
				.distinct()
				.collect(Collectors.toList());

//mybatis根据ID集合查询


//查询后转换成map,得到每个物料对应的类
Map materialMap = materialService.findByIds(materialIds).stream()
				.collect(Collectors.toMap(Material::getId, v -> v, (v1, v2) -> v2));

//根据仓库ID分组,无序
Map> listMap =			receiveGoodsOrder.getReceiveGoodsOrderDetailList().stream().collect(Collectors.groupingBy(t -> t.getStorageId()));
 //根据仓库 拆单
for(Map.Entry> entry : listMap.entrySet()){
	String storageId = entry.getKey();
    for (ReceiveGoodsOrderDetail receiveGoodsOrderDetail : entry.getValue()) {

    }
}

//有序分组
LinkedHashMap> prodMap = detailList.stream()      .collect(Collectors.groupingBy(MachineTypeDetail::getProdStage,LinkedHashMap::new,Collectors.toList()));

二、Css 动态设置背景颜色宽度

下图红框样式

Vue和Java常用代码_第1张图片

 backgroundSize为后端返回的比率

  
实际投入
{{orderInfo.lcm_put_num}}
.intPutClass.put{
    border: 1px solid #f2c63e;
    background: linear-gradient(to left , #f2c63e , #f2c63e)  left top no-repeat ;
  }

三、Vue

1、定时任务,创建和销毁

  created() {
    //轮询刷新页面数据,5秒轮询
    let _this = this
    _this.timer = setInterval(
    function() {
      LcdEvent.initOrderInfo()
    }, 5000 )
  },
  
  beforeDestroy() {
    //销毁
    clearInterval(this.timer)
    this.timer = null
  },

2、页面默认焦点与选中

created() {
    //orderNo为,input的ref
    this.$nextTick(() => {
      this.$refs['orderNo'].$refs.input.focus()
    })
  },

 document.getElementById('orderNo').select()  

你可能感兴趣的:(java,java)