VideoSitePoolMapper.java 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package top.lvzhiqiang.mapper;
  2. import org.apache.ibatis.annotations.*;
  3. import top.lvzhiqiang.entity.VideoSitePool;
  4. import java.util.List;
  5. /**
  6. * 电影站点池Mapper
  7. *
  8. * @author lvzhiqiang
  9. * 2022/4/28 15:53
  10. */
  11. public interface VideoSitePoolMapper {
  12. /**
  13. * 删除所有
  14. */
  15. @Delete("DELETE FROM video_site_pool where 1=1")
  16. void deleteAll();
  17. /**
  18. * 批量新增
  19. *
  20. * @param videoSitePoolList
  21. */
  22. @Insert({"<script>" +
  23. "INSERT INTO video_site_pool(url, type, create_time, modify_time) " +
  24. "VALUES " +
  25. "<foreach collection='list' item='vsp' index=\"index\" separator=\",\">" +
  26. " (#{vsp.url}, #{vsp.type}, now(), now())" +
  27. " </foreach>" +
  28. "</script>"})
  29. int insertList(List<VideoSitePool> videoSitePoolList);
  30. /**
  31. * 新增
  32. *
  33. * @param videoSitePool
  34. */
  35. @Insert("INSERT INTO video_site_pool(url, type, create_time, modify_time) " +
  36. "VALUES (#{url}, #{type}, now(), now())")
  37. @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
  38. int insert(VideoSitePool videoSitePool);
  39. /**
  40. * 查询所有
  41. */
  42. @Select("SELECT url FROM video_site_pool where type = #{type}")
  43. List<String> findUrlByType(@Param("type") Integer type);
  44. /**
  45. * 查询所有
  46. */
  47. @Select("SELECT url FROM video_site_pool where type = #{type} and delete_flag = #{deleteFlag}")
  48. List<String> findUrlByTypeAndDeleteFlag(@Param("type") Integer type, @Param("deleteFlag") Integer deleteFlag);
  49. /**
  50. * 更新状态
  51. *
  52. * @param url
  53. * @param deleteFlag
  54. * @return
  55. */
  56. @Update("update video_site_pool set delete_flag = #{deleteFlag},modify_time = now() where url = #{url}")
  57. int updateDeleteFlag(@Param("url") String url, @Param("deleteFlag") Integer deleteFlag);
  58. /**
  59. * 根据url模糊查询
  60. *
  61. * @return
  62. */
  63. @Select({"<script>" +
  64. "select * from video_site_pool WHERE delete_flag = 1" +
  65. "<if test=\"url != null and url != ''\">" +
  66. " and url like concat('%',#{url},'%')" +
  67. "</if>" +
  68. "<if test=\"order != null and order != ''\">" +
  69. " order by create_time ${order}" +
  70. "</if>" +
  71. "</script>"})
  72. List<VideoSitePool> findByUrl(String url, String order);
  73. }