Search in sources :

Example 1 with FlashActivityDO

use of com.actionworks.flashsale.persistence.model.FlashActivityDO in project flash-sale by ThoughtsBeta.

the class FlashActivityBuilder method toDataObjectForCreate.

public static FlashActivityDO toDataObjectForCreate(FlashActivity flashActivity) {
    FlashActivityDO flashActivityDO = new FlashActivityDO();
    BeanUtils.copyProperties(flashActivity, flashActivityDO);
    return flashActivityDO;
}
Also used : FlashActivityDO(com.actionworks.flashsale.persistence.model.FlashActivityDO)

Example 2 with FlashActivityDO

use of com.actionworks.flashsale.persistence.model.FlashActivityDO in project flash-sale by ThoughtsBeta.

the class FlashActivityRepositoryImpl method findById.

@Override
public Optional<FlashActivity> findById(Long activityId) {
    FlashActivityDO flashActivityDO = flashActivityMapper.getById(activityId);
    if (flashActivityDO == null) {
        return Optional.empty();
    }
    FlashActivity flashActivity = FlashActivityBuilder.toDomainObject(flashActivityDO);
    return Optional.of(flashActivity);
}
Also used : FlashActivity(com.actionworks.flashsale.domain.model.entity.FlashActivity) FlashActivityDO(com.actionworks.flashsale.persistence.model.FlashActivityDO)

Example 3 with FlashActivityDO

use of com.actionworks.flashsale.persistence.model.FlashActivityDO in project flash-sale by ThoughtsBeta.

the class FlashActivityRepositoryImpl method save.

@Override
public int save(FlashActivity flashActivity) {
    FlashActivityDO flashActivityDO = FlashActivityBuilder.toDataObjectForCreate(flashActivity);
    if (flashActivityDO.getId() == null) {
        int effectedRows = flashActivityMapper.insert(flashActivityDO);
        flashActivity.setId(flashActivityDO.getId());
        return effectedRows;
    }
    return flashActivityMapper.update(flashActivityDO);
}
Also used : FlashActivityDO(com.actionworks.flashsale.persistence.model.FlashActivityDO)

Aggregations

FlashActivityDO (com.actionworks.flashsale.persistence.model.FlashActivityDO)3 FlashActivity (com.actionworks.flashsale.domain.model.entity.FlashActivity)1