package com.jsh.erp.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jsh.erp.datasource.entities.Log;
import com.jsh.erp.datasource.vo.LogVo4List;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

public interface LogService extends IService<Log> {

    Log getLog(long id)throws Exception;

    List<Log> getLog()throws Exception;

    List<LogVo4List> select(String operation, String userInfo, String clientIp, String tenantLoginName, String tenantType,
                            String beginTime, String endTime, String content)throws Exception;

    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
    int insertLog(JSONObject obj, HttpServletRequest request) throws Exception;

    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
    int updateLog(JSONObject obj, HttpServletRequest request)throws Exception;

    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
    int deleteLog(Long id, HttpServletRequest request)throws Exception;

    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
    int batchDeleteLog(String ids, HttpServletRequest request)throws Exception;

    void insertLog(String moduleName, String content, HttpServletRequest request)throws Exception;

    void insertLogWithUserId(Long userId, Long tenantId, String moduleName, String content, HttpServletRequest request)throws Exception;
}
