<?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.njcn.system.mapper.UserLogMapper">

    <insert id="insertBatch">
        INSERT INTO sys_user_log (
            id,
            login_name,
            user_name,
            ip,
            operate,
            operate_type,
            result,
            fail_reason,
            LEVEL,
            type,
            service_name,
            state,
            create_by,
            create_time,
            update_by,
            update_time
        )
        values
        <foreach collection="list" item="item" separator="," index="index">
        (   #{item.id},
            #{item.loginName},
            #{item.userName},
            #{item.ip},
            #{item.operate},
            #{item.operateType},
            #{item.result},
            #{item.failReason},
            #{item.level},
            #{item.type},
            #{item.serviceName},
            #{item.state},
            #{item.createBy},
            #{item.createTime},
            #{item.updateBy},
            #{item.updateTime} )
        </foreach>

    </insert>
    <select id="ids" resultType="java.lang.String">
        select id from sys_user_log
        where id in
        <foreach collection="ids" item="item" index="index"  open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>
    <select id="getMemoInfo" resultType="java.lang.Float">
        SELECT
            TRUNCATE (data_length / 1024 / 1024, 2) AS '数据容量(MB)'
        FROM
            information_schema.tables
        where table_schema = #{schema}  and table_name="sys_user_log"
    </select>

    <select id="getAllIndex" resultType="String">
        SELECT
            id
        FROM
            sys_user_log
    </select>

</mapper>
