package com.zcloud.primeport.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.primeport.domain.gateway.MkmjSwipeCardRecordGateway;
import com.zcloud.primeport.domain.model.MkmjSwipeCardRecordE;
import com.zcloud.primeport.dto.MkmjSwipeCardRecordUpdateCmd;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;


/**
 * web-app
 *
 * @Author dearLin
 * @Date 2026-04-22 17:04:02
 */
@Component
@AllArgsConstructor
public class MkmjSwipeCardRecordUpdateExe {
    private final MkmjSwipeCardRecordGateway mkmjSwipeCardRecordGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(MkmjSwipeCardRecordUpdateCmd mkmjSwipeCardRecordUpdateCmd) {
        MkmjSwipeCardRecordE mkmjSwipeCardRecordE = new MkmjSwipeCardRecordE();
        BeanUtils.copyProperties(mkmjSwipeCardRecordUpdateCmd, mkmjSwipeCardRecordE);
        boolean res = mkmjSwipeCardRecordGateway.update(mkmjSwipeCardRecordE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

