<?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.bootdo.datas.dao.ExamineLogDao">

    <!--获取列表-->
    <select id="list" resultType="com.bootdo.datas.dto.ExamineLogDTO">
        SELECT * FROM examine_log
        <where>
            <if test="dataType != null and dataType != ''">  and data_type = #{dataType} </if>
            <if test="uniqueKey != null and uniqueKey != ''">  and unique_key = #{uniqueKey} </if>
        </where>
        ORDER BY gmt_create DESC
    </select>

    <select id="countTotal" resultType="int">
        SELECT count(*) FROM examine_log
        <where>
            <if test="dataType != null and dataType != ''">  and data_type = #{dataType} </if>
            <if test="uniqueKey != null and uniqueKey != ''">  and unique_key = #{uniqueKey} </if>
        </where>
    </select>

    <insert id="save">
        insert into examine_log (data_type, unique_key, message, user_id_create)
        values (
            #{dto.dataType},
            #{dto.uniqueKey},
            #{dto.message},
            #{dto.userIdCreate}
        )
    </insert>

</mapper>