<?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.erp.supplier.repository.SupplierOperationLogRepository">

    <resultMap id="BaseResultMap" type="com.erp.supplier.entity.SupplierOperationLog">
        <id column="id" property="id"/>
        <result column="supplier_id" property="supplierId"/>
        <result column="operator_id" property="operatorId"/>
        <result column="operator_name" property="operatorName"/>
        <result column="operation_type" property="operationType"/>
        <result column="operation_desc" property="operationDesc"/>
        <result column="before_data" property="beforeData"/>
        <result column="after_data" property="afterData"/>
        <result column="ip" property="ip"/>
        <result column="user_agent" property="userAgent"/>
        <result column="created_at" property="createdAt"/>
    </resultMap>

    <select id="selectBySupplierId" resultMap="BaseResultMap">
        SELECT * FROM supplier_operation_logs
        WHERE supplier_id = #{supplierId}
        ORDER BY created_at DESC
    </select>

</mapper>
