package com.fs.system.mapper;

import java.util.List;

import com.fs.company.param.CompanyTcmReportListQueryParam;
import com.fs.company.vo.CompanyTcmReportListVO;
import com.fs.system.domain.SysOperLog;
import com.fs.system.vo.SysOperLogVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 操作日志 数据层
 *

 */
public interface SysOperLogMapper
{
    /**
     * 新增操作日志
     *
     * @param operLog 操作日志对象
     */
    public void insertOperlog(SysOperLog operLog);

    /**
     * 查询系统操作日志集合
     *
     * @param operLog 操作日志对象
     * @return 操作日志集合
     */
    public List<SysOperLog> selectOperLogList(SysOperLog operLog);

    /**
     * 批量删除系统操作日志
     *
     * @param operIds 需要删除的操作日志ID
     * @return 结果
     */
    public int deleteOperLogByIds(Long[] operIds);

    /**
     * 查询操作日志详细
     *
     * @param operId 操作ID
     * @return 操作日志对象
     */
    public SysOperLog selectOperLogById(Long operId);

    /**
     * 清空操作日志
     */
    public void cleanOperLog();

    @Select({"<script> " +
            " SELECT o.*,u.nick_name as oper_nick_name from sys_oper_log o left join sys_user u on o.oper_name=u.user_name " +
            " where 1=1 "+

            "<if test = 'maps.title != null and  maps.title !=\"\"    '> " +
            "and o.title like CONCAT('%',#{maps.title},'%') " +
            "</if>" +

            "<if test = 'maps.businessType != null and maps.businessType !=\"\"     '> " +
            "and o.business_sype =#{maps.businessType} " +
            "</if>" +
            "<if test = 'maps.businessTypes != null  and maps.businessTypes != \"\"    '> " +
            "and o.business_type IN " +
            "<foreach collection=\"maps.businessTypes.split(',')\"  item='item' index='index'  open='(' separator=',' close=')'> #{item} </foreach>"+
            "</if>" +

            "<if test = 'maps.status != null '> " +
            " and o.status = #{maps.status}" +
            "</if>" +

            "<if test = 'maps.operName != null and  maps.operName !=\"\"    '> " +
            "and o.oper_name like CONCAT('%',#{maps.operName},'%') " +
            "</if>" +

            "<if test = 'maps.beginTime != null and maps.beginTime != \"\" '> " +
            "and date_format(o.oper_time,'%y%m%d') &gt;= date_format(#{maps.beginTime},'%y%m%d') " +
            "</if>" +
            "<if test = 'maps.endTime != null and maps.endTime != \"\" '> " +
            "and date_format(o.oper_time,'%y%m%d') &lt;= date_format(#{maps.endTime},'%y%m%d') " +
            "</if>" +
            "${maps.params.dataScope}"+
            " order by o.oper_id desc " +
            "</script>"})
    List<SysOperLogVO> selectOperLogListVO(@Param("maps") SysOperLog operLog);
}
