package cn.superdesk.uniorder.service.thirdpart.qchjc.log.impl;

import cn.hutool.core.date.DateUtil;
import cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.log.QchjcLogEntity;
import cn.superdesk.uniorder.dao.mapper.thirdpart.qchjc.log.QchjcLogEntityMapper;
import cn.superdesk.uniorder.service.thirdpart.qchjc.log.QchjcLogService;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author xc
 * @description
 * @date 2022/4/8 17:32
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class QchjcLogServiceImpl implements QchjcLogService {

    private final QchjcLogEntityMapper qchjcLogEntityMapper;

    @Override
    public int insertSelective(QchjcLogEntity qchjcLogEntity) {
        return qchjcLogEntityMapper.insertSelective(qchjcLogEntity);
    }

    @Override
    public int updateByPrimaryKeySelective(QchjcLogEntity qchjcLogEntity) {
        return qchjcLogEntityMapper.updateByPrimaryKeySelective(qchjcLogEntity);
    }

    @Override
    public void deleteObj(Long id) {
        qchjcLogEntityMapper.deleteByPrimaryKey(id);
    }

    @Override
    public QchjcLogEntity findById(Long id) {
        return qchjcLogEntityMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<QchjcLogEntity> findAll(Map<String, Object> queryMap) {
        return null;
    }

    @Override
    public PageInfo<QchjcLogEntity> findByPaging(Map<String, Object> params, Integer pageNo, Integer pageSize) {
        return null;
    }

    @Override
    public void record(int result, String method, String param, String response) {
        QchjcLogEntity qchjcLogEntity = QchjcLogEntity.builder()
                .result(result)
                .method(method)
                .param(param)
                .response(response)
                .time(DateUtil.date())
                .build();
        insertSelective(qchjcLogEntity);
    }
}
