<?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.TpTicketRecordCommentMapper">

    <select id="selectByTicketId" parameterType="map" resultType="com.huiju.estateagents.property.model.TpTicketRecordComment" >
    select ttrc.* from tp_ticket tp
                inner join tp_ticket_record ttr on tp.id = ttr.ticket_id
                inner join tp_ticket_record_comment ttrc on ttr.id = ttrc.ticket_record_id
    where tp.id=#{tickerId,jdbcType=INTEGER} order by ttrc.create_date DESC LIMIT #{size,jdbcType=INTEGER}
  </select>

    <select id="selectByTicketRecordId" parameterType="com.huiju.estateagents.property.model.TpTicketRecord" resultType="com.huiju.estateagents.property.model.TpTicketRecordComment" >
        SELECT
         *
        FROM
        tp_ticket_record_comment
        WHERE
        org_id = #{orgId,jdbcType=INTEGER}
        AND ticket_id = #{ticketId,jdbcType=INTEGER}
        AND ticket_record_id = #{id,jdbcType=INTEGER}
    </select>
</mapper>
