package com.zcloud.domain.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.domain.domain.gateway.DomainGroupUserGateway;
import com.zcloud.domain.domain.model.DomainGroupUserE;
import com.zcloud.domain.dto.DomainGroupUserUpdateCmd;
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-27 11:29:43
 */
@Component
@AllArgsConstructor
public class DomainGroupUserUpdateExe {
    private final DomainGroupUserGateway domainGroupUserGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(DomainGroupUserUpdateCmd domainGroupUserUpdateCmd) {
        DomainGroupUserE domainGroupUserE = new DomainGroupUserE();
        BeanUtils.copyProperties(domainGroupUserUpdateCmd, domainGroupUserE);
        boolean res = domainGroupUserGateway.update(domainGroupUserE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

