package com.njcn.rdms.module.system.api.user;

import com.njcn.rdms.framework.common.pojo.CommonResult;
import com.njcn.rdms.framework.common.util.object.BeanUtils;
import com.njcn.rdms.module.system.api.user.dto.UserSignatureRespDTO;
import com.njcn.rdms.module.system.dal.dataobject.user.UserSignatureDO;
import com.njcn.rdms.module.system.service.user.UserSignatureService;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import static com.njcn.rdms.framework.common.pojo.CommonResult.success;

@RestController
@Validated
@Hidden
public class UserSignatureApiImpl implements UserSignatureApi {

    @Resource
    private UserSignatureService userSignatureService;

    @Override
    public CommonResult<UserSignatureRespDTO> getByUserId(Long userId) {
        UserSignatureDO signature = userSignatureService.getByUserId(userId);
        return success(BeanUtils.toBean(signature, UserSignatureRespDTO.class));
    }
}
