<?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="org.springblade.bank.userlog.mapper.UserLogMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="userLogResultMap" type="org.springblade.bank.userlog.entity.UserLog">
        <result column="id" property="id"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="bank_no" property="bankNo"/>
        <result column="org_no" property="orgNo"/>
        <result column="org_name" property="orgName"/>
        <result column="table_name" property="tableName"/>
        <result column="person_no" property="personNo"/>
        <result column="person_name" property="personName"/>
        <result column="operation_type" property="operationType"/>
        <result column="old_data" property="oldData"/>
        <result column="new_data" property="newData"/>
    </resultMap>


    <select id="selectUserLogPage" resultMap="userLogResultMap">
        select * from zh_user_log where is_deleted = 0
        <if test="userLog!=null">
            <if test="userLog.orgNo!=null">
                AND org_no = '${userLog.orgNo}'
            </if>
            <if test="userLog.personNo!=null">
                AND person_no = '${userLog.personNo}'
            </if>
            <if test="userLog.tableName!=null">
                AND table_name = '${userLog.tableName}'
            </if>
             <if test="userLog.operationType!=null">
                AND operation_type = '${userLog.operationType}'
            </if>

            <if test="userLog.createTime_begin!=null and userLog.createTime_end!=null">
                and create_time BETWEEN '${userLog.createTime_begin}' and '${userLog.createTime_end}'
            </if>

        </if>
        ORDER BY create_time DESC
    </select>

</mapper>
