<?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.liquidnet.service.kylin.mapper.KylinArtistOperationLogMapper">

    <!-- 根据艺人ID查询操作记录列表 -->
    <select id="selectLogsByArtistId" parameterType="java.lang.String" resultType="com.liquidnet.service.kylin.dao.KylinArtistOperationLogDao">
        SELECT 
            operation_type as operationType,
            CASE operation_type
                WHEN 1 THEN '新增'
                WHEN 2 THEN '编辑'
                WHEN 3 THEN '删除'
                ELSE '未知'
            END as operationTypeName,
            DATE_FORMAT(created_at, '%Y-%m-%d %H:%i:%s') as createdAt,
            operation_content as operationContent,
            operator_name as operatorName
        FROM kylin_artist_operation_log
        WHERE artist_id = #{artistId}
        ORDER BY created_at DESC
    </select>

</mapper>
