| | |
| | | package com.consum.base.service; |
| | | |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class LGoodsWhRecordServiceImpl extends BaseServiceImpl { |
| | | private static String insert_new_record = "INSERT INTO L_GOODS_WH_RECORD (WAREHOUSE_FLOW_ID,DEAL_TIME,LAST_RECORD, WH_GOODS_ID,WAREHOUSE_TYPE, WAREHOUSE_ID)SELECT ?, ?,1,ID, WAREHOUSE_TYPE, WAREHOUSE_ID FROM L_WH_GOODS WHERE ID IN (?)"; |
| | | private static String insert_new_record = "INSERT INTO L_GOODS_WH_RECORD (WAREHOUSE_FLOW_ID,DEAL_TIME,LAST_RECORD, WH_GOODS_ID,WAREHOUSE_TYPE, WAREHOUSE_ID)SELECT ?, ?,1,ID, WAREHOUSE_TYPE, WAREHOUSE_ID FROM L_WH_GOODS WHERE ID IN ("; |
| | | |
| | | public int insertNewRecord(List<Long> outGoodsIds, long lWarehouseFlowId, long dealTime) { |
| | | this.updSetNotLast(outGoodsIds); |
| | | ArrayList<Object> params = new ArrayList<>(); |
| | | params.add(lWarehouseFlowId); |
| | | params.add(dealTime); |
| | | params.add(outGoodsIds); |
| | | return this.update(insert_new_record, params.toArray()); |
| | | return this.update(insert_new_record + StringUtils.join(outGoodsIds, ",") + ")", params.toArray()); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 设置为非最新 |
| | | */ |
| | | private static String updSetNotLast = "update L_GOODS_WH_RECORD set LAST_RECORD = 0 where WH_GOODS_ID in(?)"; |
| | | private static String updSetNotLast = "update L_GOODS_WH_RECORD set LAST_RECORD = 0 where LAST_RECORD=1 and WH_GOODS_ID in("; |
| | | |
| | | public int updSetNotLast(List<Long> outGoodsIds) { |
| | | ArrayList<Object> params = new ArrayList<>(); |
| | | params.add(outGoodsIds); |
| | | return this.update(updSetNotLast, params.toArray()); |
| | | return this.update(updSetNotLast + StringUtils.join(outGoodsIds, ",") + ")", new String[]{}); |
| | | } |
| | | } |