package com.zcloud.basic.info.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.basic.info.domain.gateway.UserEmploymentLogGateway;
import com.zcloud.basic.info.domain.model.UserEmploymentLogE;
import com.zcloud.basic.info.dto.UserEmploymentLogUpdateCmd;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;


/**
 * web-app
 *
 * @Author zhangyue
 * @Date 2025-11-06 19:15:38
 */
@Component
@AllArgsConstructor
public class UserEmploymentLogUpdateExe {
    private final UserEmploymentLogGateway userEmploymentLogGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(UserEmploymentLogUpdateCmd userEmploymentLogUpdateCmd) {
        UserEmploymentLogE userEmploymentLogE = new UserEmploymentLogE();
        BeanUtils.copyProperties(userEmploymentLogUpdateCmd, userEmploymentLogE);
        boolean res = userEmploymentLogGateway.update(userEmploymentLogE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

