package com.gic.haoban.manage.service.service.impl;

import java.util.Date;
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.api.dto.qdto.QywxErrorLogListQDTO;
import com.gic.haoban.manage.service.dao.mapper.TabQywxErrorLogMapper;
import com.gic.haoban.manage.service.entity.TabQywxErrorLog;
import com.gic.haoban.manage.service.pojo.bo.TabQywxErrorLogBO;
import com.gic.haoban.manage.service.service.QywxErrorLogService;

/**
 * 企微报错日志(TabQywxErrorLog)表服务实现类
 *
 * @author mozhu
 * @date 2022-04-18 15:28:02
 */
@Service
public class TabQywxErrorLogServiceImpl implements QywxErrorLogService {

    @Autowired
    private TabQywxErrorLogMapper tabQywxErrorLogMapper;

    @Override
    public TabQywxErrorLogBO insert(TabQywxErrorLogBO tabQywxErrorLogBO) {
        String wxEnterpriseId = tabQywxErrorLogBO.getWxEnterpriseId();
        if (StringUtils.isBlank(wxEnterpriseId)) {
            return null;
        }
        tabQywxErrorLogBO.setId(UniqueIdUtils.uniqueLong());
        tabQywxErrorLogBO.setCreateTime(new Date());
        this.tabQywxErrorLogMapper.insert(EntityUtil.changeEntityByOrika(TabQywxErrorLog.class, tabQywxErrorLogBO));
        return tabQywxErrorLogBO;
    }

    @Override
    public List<TabQywxErrorLog> queryListByPage(QywxErrorLogListQDTO qywxErrorLogListQDTO) {
        return this.tabQywxErrorLogMapper.queryListByPage(qywxErrorLogListQDTO);
    }

}
