package com.zcloud.basic.info.command;

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


/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2026-01-05 14:12:19
 */
@Component
@AllArgsConstructor
public class UserExpandInfoUpdateExe {
    private final UserExpandInfoGateway userExpandInfoGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(UserExpandInfoUpdateCmd userExpandInfoUpdateCmd) {
        UserExpandInfoE userExpandInfoE = new UserExpandInfoE();
        BeanUtils.copyProperties(userExpandInfoUpdateCmd, userExpandInfoE);
        boolean res = userExpandInfoGateway.update(userExpandInfoE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

