<?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.bonus.canteen.core.notice.print.v2.mapper.NoticePrintRecordMapper">
    <select id="getRecordList" resultType="com.bonus.canteen.core.notice.print.v2.vo.NoticePrintRecordPageVO">
        SELECT record_id,
               device_name,
               bus_id,
               print_type,
               if_success,
               crtime,
               msg
        FROM notice_print_record
        <where>
            <if test="content.busId != null">
                AND bus_id LIKE CONCAT('%', #{content.busId}, '%')
            </if>
            <if test="content.deviceId != null">
                AND device_id = #{content.deviceId}
            </if>
            <if test="content.sceneList != null and content.sceneList.size() != 0">
                AND print_type IN
                <foreach collection="content.sceneList" open="(" close=")" separator="," item="scene">
                    #{scene}
                </foreach>
            </if>
        </where>
        ORDER BY crtime DESC
    </select>
</mapper>
