cy
2023-11-20 717ff115ee5c57c8df0fd491b40b848090d2c68e
consum-base/src/main/java/com/consum/base/service/LWhGoodsService.java
@@ -1,6 +1,5 @@
package com.consum.base.service;
import com.consum.model.po.LWhGoods;
import com.walker.infrastructure.utils.CollectionUtils;
import com.walker.jdbc.service.BaseServiceImpl;
import org.apache.commons.lang3.StringUtils;
@@ -238,26 +237,27 @@
    private static String MOD_GOODS_TRANSFERING_PREFIX = "update L_WH_GOODS set ";
    public int modGoodsTransfering(List<Long> whGoods, Integer warehouseType, Long toWarehouseId, String toWarehouseName, Integer states) {
        List<LWhGoods> params = new ArrayList<>();
        whGoods.stream().forEach(id -> {
            LWhGoods lWhGoods = new LWhGoods();
            lWhGoods.setId(id);
            if (toWarehouseId != null) {
                lWhGoods.setWarehouseType(warehouseType);
            }
            if (toWarehouseId != null) {
                lWhGoods.setWarehouseId(toWarehouseId);
            }
            if (toWarehouseName != null) {
                lWhGoods.setWarehouseName(toWarehouseName);
            }
            if (states != null) {
                lWhGoods.setStates(states);
            }
            params.add(lWhGoods);
        });
        return updateBatch(params);
        StringBuilder sql = new StringBuilder(MOD_GOODS_TRANSFERING_PREFIX);
        ArrayList<Object> params = new ArrayList<>();
        if (toWarehouseId != null) {
            sql.append(", WAREHOUSE_TYPE=?");
            params.add(warehouseType);
        }
        if (toWarehouseId != null) {
            sql.append(", WAREHOUSE_ID=?");
            params.add(toWarehouseId);
        }
        if (toWarehouseName != null) {
            sql.append(", WAREHOUSE_NAME=?");
            params.add(toWarehouseName);
        }
        if (states != null) {
            sql.append(", STATES=?");
            params.add(states);
        }
        sql.deleteCharAt(22);
        sql.append(" where id in(").append(StringUtils.join(whGoods, ",")).append(")");
        return update(sql.toString(), params.toArray());
    }
}