@ -19,6 +19,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service ;
import org.springframework.transaction.annotation.Transactional ;
import java.util.* ;
/ * *
* @author wangpengfei
* @date 2023 / 5 / 4 14 : 37
@ -44,9 +46,24 @@ public class CrudeOilStorageService extends MybatisBaseService<CrudeOilStorageMa
}
@Transactional
public ResultBean save ( CrudeOilStorageDto dto ) {
ResultBean rb = new ResultBean ( ) ;
CrudeOilStorage entity = new CrudeOilStorage ( ) ;
BeanUtil . copyProperties ( dto , entity , "id" , "sid" ) ;
String [ ] file = dto . getCrudeOilStorageFile ( ) ;
if ( file ! = null ) {
List < Map < String , String > > maps = new ArrayList < > ( ) ;
for ( String s : file ) {
Map < String , String > m = new HashMap < > ( ) ;
m . put ( "mainSid" , entity . getSid ( ) ) ;
m . put ( "url" , s ) ;
m . put ( "sid" , UUID . randomUUID ( ) . toString ( ) ) ;
maps . add ( m ) ;
}
if ( maps . size ( ) > 0 ) {
baseMapper . insertCrudeOilFiles ( maps ) ;
}
}
baseMapper . insert ( entity ) ;
//油罐库存增加
TankInformation tank = tankInformationMapper . getTankBySid ( dto . getTankSid ( ) ) ;