mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
同步煤源价格
This commit is contained in:
@@ -9,7 +9,8 @@ import cn.lihongjie.coal.coalInfo.dto.UpdateCoalInfoDto;
|
||||
import cn.lihongjie.coal.coalInfo.entity.CoalInfoEntity;
|
||||
import cn.lihongjie.coal.coalInfo.mapper.CoalInfoMapper;
|
||||
import cn.lihongjie.coal.coalInfo.repository.CoalInfoRepository;
|
||||
import java.lang.String;
|
||||
import cn.lihongjie.coal.coalPrice.entity.CoalPriceEntity;
|
||||
import cn.lihongjie.coal.coalPrice.service.CoalPriceService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
@@ -30,21 +31,33 @@ public class CoalInfoService extends BaseService<CoalInfoEntity, CoalInfoReposit
|
||||
@Autowired
|
||||
private ConversionService conversionService;
|
||||
|
||||
@Autowired
|
||||
CoalPriceService coalPriceService;
|
||||
public CoalInfoDto create(CreateCoalInfoDto request) {
|
||||
CoalInfoEntity entity = mapper.toEntity(request);
|
||||
|
||||
|
||||
this.repository.save(entity);
|
||||
return getById(entity.getId())
|
||||
this.repository.save(entity);
|
||||
|
||||
updatePrice(entity);
|
||||
return getById(entity.getId())
|
||||
;
|
||||
}
|
||||
|
||||
public CoalInfoDto update(UpdateCoalInfoDto request) {
|
||||
private void updatePrice(CoalInfoEntity entity) {
|
||||
CoalPriceEntity coalPrice = new CoalPriceEntity();
|
||||
coalPrice.setCoalInfo(entity);
|
||||
coalPrice.setPrice(entity.getInitPrice());
|
||||
|
||||
coalPriceService.save(coalPrice);
|
||||
}
|
||||
|
||||
public CoalInfoDto update(UpdateCoalInfoDto request) {
|
||||
CoalInfoEntity entity = this.repository.get(request.getId());
|
||||
this.mapper.updateEntity(entity, request);
|
||||
|
||||
this.repository.save(entity);
|
||||
|
||||
updatePrice(entity);
|
||||
return getById(entity.getId())
|
||||
;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user