package com.usky.system.controller.api;

import com.usky.common.core.bean.ApiResult;
import com.usky.common.core.util.BeanMapperUtils;
import com.usky.system.RemoteLogService;
import com.usky.system.domain.SysLogininfor;
import com.usky.system.domain.SysLogininforVO;
import com.usky.system.domain.SysOperLog;
import com.usky.system.domain.SysOperLogVO;
import com.usky.system.service.ISysLogininforService;
import com.usky.system.service.ISysOperLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yq
 * @date 2022/7/1 11:08
 */
@RequestMapping("/logApi")
@RestController
public class SysLogControllerApi implements RemoteLogService {

    @Autowired
    private ISysOperLogService sysOperLogService;

    @Autowired
    private ISysLogininforService sysLogininforService;
    @Override
    public ApiResult<Boolean> saveLog(SysOperLogVO sysOperLog) {
        return ApiResult.success(sysOperLogService.save(BeanMapperUtils.map(sysOperLog, SysOperLog.class)));
    }

    @Override
    public ApiResult<Boolean> saveLogininfor(SysLogininforVO sysLogininfor) {
        return ApiResult.success(sysLogininforService.save(BeanMapperUtils.map(sysLogininfor, SysLogininfor.class)));
    }
}
