<?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.cmeeting.mapper.primary.OperationLogMapper">

    <resultMap id="BaseResultMap" type="com.cmeeting.pojo.OperationLog">
            <id property="id" column="id" />
            <result property="userName" column="user_name" />
            <result property="userId" column="user_id" />
            <result property="location" column="location" />
            <result property="operation" column="operation" />
            <result property="createTime" column="create_time" />
    </resultMap>

    <sql id="Base_Column_List">
        id,user_name,user_id,location,operation,create_time
    </sql>

    <!-- 查询操作日志列表 -->
    <select id="selectOperLogList" resultMap="BaseResultMap">
        select
            <include refid="Base_Column_List" />
        from
            operation_log
        <where>
            <if test="searchValue != null and searchValue != ''">
                and ( user_name like concat('%',#{searchValue},'%') or user_id like concat('%',#{searchValue},'%') )
            </if>
            <if test="createTimeStart != null">
                and create_time &gt;= #{createTimeStart}
            </if>
            <if test="createTimeEnd != null">
                and create_time &lt;= #{createTimeEnd}
            </if>
        </where>
    </select>

</mapper>
