<?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.chinaweal.aiccs.aiccs.system.mapper.LogMapper">

    <resultMap id="BaseResultMap" type="com.chinaweal.aiccs.aiccs.system.entity.LogVO">
        <id column="uuid" property="uuid" />
        <result column="username" property="username" />
        <result column="host" property="host" />
        <result column="uri" property="uri" />
        <result column="method" property="method" />
        <result column="time" property="time" />
        <result column="device" property="device" />
        <result column="query" property="query" />
        <result column="body" property="body" />
        <result column="time_spend" property="timeSpend" />
        <result column="status" property="status" />
        <result column="ex" property="ex" />
    </resultMap>

    <select id="queryAll" resultMap="BaseResultMap">
        select * from youfool.rest_log rl where 1=1 and username is not null
        <if test="customParamMap.username != null and customParamMap.username != '' ">
            and username = #{customParamMap.username}
        </if>
        <if test="customParamMap.startDate != null and customParamMap.startDate != '' ">
            and create_time &gt;= #{customParamMap.startDate}
        </if>
        <if test="customParamMap.endDate != null and customParamMap.endDate != '' ">
            and create_time &lt;= #{customParamMap.endDate}
        </if>
        <if test="customParamMap.oneDate != null and customParamMap.oneDate != '' ">
            and date_format( create_time,'%Y-%m-%d') = #{customParamMap.oneDate}
        </if>
    </select>

</mapper>