<?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.mall.order.mapper.MqMessageMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.order.domain.entity.MqMessage">
        <id column="message_id" property="messageId"/>
        <id column="content" property="content"/>
        <id column="to_exchane" property="toExchane"/>
        <id column="routing_key" property="routingKey"/>
        <id column="class_type" property="classType"/>
        <id column="message_status" property="messageStatus"/>
        <id column="create_time" property="createTime"/>
        <id column="update_time" property="updateTime"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        message_id,content,to_exchane,routing_key,class_type,message_status,create_time,update_time
    </sql>

    <!-- 分页查询内容 -->
    <select id="selectListByPage" resultType="com.mall.order.domain.vo.MqMessageVo">
        select
        <include refid="Base_Column_List"/>
        from mq_message
        <where>
            <if test="dto.messageId != null and dto.messageId != ''">
                and message_id like CONCAT('%',#{dto.messageId},'%')
            </if>
            <if test="dto.content != null and dto.content != ''">
                and content like CONCAT('%',#{dto.content},'%')
            </if>
            <if test="dto.toExchane != null and dto.toExchane != ''">
                and to_exchane like CONCAT('%',#{dto.toExchane},'%')
            </if>
            <if test="dto.routingKey != null and dto.routingKey != ''">
                and routing_key like CONCAT('%',#{dto.routingKey},'%')
            </if>
            <if test="dto.classType != null and dto.classType != ''">
                and class_type like CONCAT('%',#{dto.classType},'%')
            </if>
            <if test="dto.messageStatus != null and dto.messageStatus != ''">
                and message_status like CONCAT('%',#{dto.messageStatus},'%')
            </if>
            <if test="dto.createTime != null and dto.createTime != ''">
                and create_time like CONCAT('%',#{dto.createTime},'%')
            </if>
            <if test="dto.updateTime != null and dto.updateTime != ''">
                and update_time like CONCAT('%',#{dto.updateTime},'%')
            </if>
        </where>
    </select>

</mapper>
