<?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.toesbieya.my.mapper.RecUserActionMapper">
    <sql id="searchCondition">
        <if test="uid!=null">and uid=#{uid}</if>
        <if test="uname!=null and uname!=''">and uname like "%"#{uname}"%"</if>
        <if test="type!=null and type!=''">and type in (${type})</if>
        <if test="ip!=null and ip!=''">and ip =#{ip}</if>
        <if test="url!=null and url!=''">and url =#{url}</if>
        <if test="startTime!=null">and time <![CDATA[ >= ]]> #{startTime}</if>
        <if test="endTime!=null">and time <![CDATA[ <= ]]> #{endTime}</if>
    </sql>
    <select id="search" resultType="com.toesbieya.my.model.entity.RecUserAction"
            parameterType="com.toesbieya.my.model.vo.search.UserActionSearch">
        select *
        from rec_user_action
        where 1
        <include refid="searchCondition"/>
        order by time desc
    </select>

    <insert id="insert" parameterType="com.toesbieya.my.model.entity.RecUserAction">
        insert into rec_user_action (uid, uname, ip, url, time, action, error, type)
        VALUES (#{uid}, #{uname}, #{ip}, #{url}, #{time}, #{action}, #{error}, #{type})
    </insert>
</mapper>