<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.zcloud.modules.sys.dao.SysLogDao">
    <update id="createTable" parameterType="java.lang.String">
        CREATE TABLE IF NOT EXISTS ${tableName} LIKE sys_log;
    </update>
    <select id="existsTable" resultType="java.lang.Boolean" parameterType="java.lang.String">
        SELECT COUNT(*)
        FROM information_schema.TABLES
        WHERE TABLE_SCHEMA = 'videoresource'
          AND TABLE_NAME = #{tableName}
    </select>
    <insert id="insertIntoTable" parameterType="map">
        INSERT INTO ${tableName} (id, username, operation, method, params, time, ip, create_date, corpinfo_id)
        VALUES (#{logEntity.id}, #{logEntity.username}, #{logEntity.operation}, #{logEntity.method},
                #{logEntity.params}, #{logEntity.time}, #{logEntity.ip}, #{logEntity.createDate}, #{logEntity.corpinfoId})
    </insert>
</mapper>
