<?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.shr.dao.LogMapper">



    <select id="logList" parameterType="com.shr.transfer.log.LogListInVo" resultType="com.shr.transfer.log.LogListOutVoRecords">

        SELECT
            content, system_type, result, create_time
        FROM tb_log
        <where>
            <if test="inVo.dateFrom != null and inVo.dateFrom != '' ">
                and create_time &gt;= #{inVo.dateFrom}
            </if>
            <if test="inVo.dateTo != null and inVo.dateTo != ''">
                and create_time &lt;= #{inVo.dateTo}
            </if>
            <if test="inVo.content != null and inVo.content != ''">
                and content like CONCAT("%", #{inVo.content}, "%")
            </if>
            <if test="inVo.systemType != null and inVo.systemType != ''">
                and system_type = #{inVo.systemType}
            </if>
        </where>

    </select>



    <insert id="createLog" parameterType="com.shr.model.Log">

        INSERT INTO tb_log (content, system_type, result) VALUES (#{content}, #{systemType}, #{result})

    </insert>



    <select id="isTable" resultType="java.lang.Integer">

        select count(*) from user_tables where table_name =upper('tb_log')

    </select>



    <insert id="createTable">

        create table tb_log (
            id VARCHAR2(32) DEFAULT SYS_GUID() PRIMARY KEY,
            content VARCHAR2(500) DEFAULT NULL,
            system_type VARCHAR2(50) DEFAULT NULL,
            result CLOB DEFAULT NULL,
            create_time TIMESTAMP DEFAULT SYSDATE,
            update_time TIMESTAMP DEFAULT SYSDATE
        )

    </insert>



</mapper>
