<?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.huiju.estateagents.property.dao.TransactionReplyMapper">
    <select id="transactionReplyList" resultType="com.huiju.estateagents.property.model.TransactionReply">
    SELECT
        re.id,
        re.org_id,
        re.transaction_id,
        re.uuid_name,
        re.reply_content,
        re.reply_uuid_name,
        re.create_date
    FROM
        tp_transaction_reply re
    WHERE
        re.transaction_id = #{id}
    <if test="taUserName != null and taUserName !=''">
        and re.uuid_name like concat('%',#{ taUserName,jdbcType=VARCHAR},'%')
    </if>
    <if test="replyTaUserName != null and replyTaUserName !=''">
        and re.reply_uuid_name like concat('%',#{ replyTaUserName,jdbcType=VARCHAR},'%')
    </if>
    <if test="createDate != null">
        and  date_format(re.create_date,'%Y%m%d')=date_format(#{createDate},'%Y%m%d')
    </if>
    <if test="status == 0 ">
        AND re.reply_uuid = #{userId,jdbcType=INTEGER} and re.reply_uuid_type = "prop"
    </if>
    <if test="status == 1 ">
        AND  re.reply_uuid_type = "prop"
    </if>
    <if test="status == 2 ">
        AND re.uuid_type = "prop"
    </if>

    <if test="status == 3 ">
        AND re.uuid = #{uuid,jdbcType=INTEGER} and re.uuid_type = #{uuidType,jdbcType=INTEGER}
    </if>
    order by re.create_date desc
    </select>
</mapper>
