package com.ssj.dao.sys.compositioncomment.dao;

import com.ssj.bean.sys.compositioncomment.domain.CompositionComment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author yrf
 * @description
 * @time 2019/8/27 17:15
 */
public interface CompositionCommentDao extends JpaRepository<CompositionComment, String> {

    /**
     * 根据作业图片id删除作文评语
     * @param homeworkPictureId 图片id
     */
    @Modifying
    @Query(nativeQuery = true, value = "delete from scon_composition_comment where homework_picture_id = ?1 ")
    void deleteByHomeworkPictureId(String homeworkPictureId);

    /**
     * 根据作业图片id查询作文评语
     * @param homeworkPictureId 图片id
     */
    List<CompositionComment> findByHomeworkPictureId(String homeworkPictureId);
}
