package com.fs.doc.mapper;

import java.util.List;
import com.fs.doc.domain.DocRecordReply;
import com.fs.doc.param.DocRecordReplyQueryParam;
import com.fs.doc.vo.DocRecordReplyListQueryVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 回复Mapper接口
 * 
 * @author fs
 * @date 2023-01-09
 */
public interface DocRecordReplyMapper 
{
    /**
     * 查询回复
     * 
     * @param replyId 回复ID
     * @return 回复
     */
    public DocRecordReply selectDocRecordReplyById(Long replyId);

    /**
     * 查询回复列表
     * 
     * @param docRecordReply 回复
     * @return 回复集合
     */
    public List<DocRecordReply> selectDocRecordReplyList(DocRecordReply docRecordReply);

    /**
     * 新增回复
     * 
     * @param docRecordReply 回复
     * @return 结果
     */
    public int insertDocRecordReply(DocRecordReply docRecordReply);

    /**
     * 修改回复
     * 
     * @param docRecordReply 回复
     * @return 结果
     */
    public int updateDocRecordReply(DocRecordReply docRecordReply);

    /**
     * 删除回复
     * 
     * @param replyId 回复ID
     * @return 结果
     */
    public int deleteDocRecordReplyById(Long replyId);

    /**
     * 批量删除回复
     * 
     * @param replyIds 需要删除的数据ID
     * @return 结果
     */
    public int deleteDocRecordReplyByIds(Long[] replyIds);

    @Select({"<script> " +
            "select r.*,cu.nick_name as company_nick_name from doc_record_reply r left join company_user cu on cu.user_id=r.company_user_id  " +
            "where 1=1 " +
            "<if test = 'maps.recordId != null     '> " +
            "and r.record_id =#{maps.recordId} " +
            "</if>" +
            "order by r.reply_id desc "+
            "<if test = 'maps.limit != null     '> " +
            "limit #{maps.limit} " +
            "</if>" +
            "</script>"})
    List<DocRecordReplyListQueryVO> selectDocRecordReplyListVOQuery(@Param("maps") DocRecordReplyQueryParam map);
}
