VideoInfoUncensoredMapper.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. package top.lvzhiqiang.mapper;
  2. import org.apache.ibatis.annotations.Delete;
  3. import org.apache.ibatis.annotations.Insert;
  4. import org.apache.ibatis.annotations.Select;
  5. import org.apache.ibatis.annotations.Update;
  6. import top.lvzhiqiang.entity.VideoCast;
  7. import top.lvzhiqiang.entity.VideoGenres;
  8. import top.lvzhiqiang.entity.VideoInfo;
  9. import top.lvzhiqiang.entity.VideoInfoUncensored;
  10. import java.util.List;
  11. import java.util.Map;
  12. /**
  13. * 电影信息流出Mapper
  14. *
  15. * @author lvzhiqiang
  16. * 2022/5/4 18:38
  17. */
  18. public interface VideoInfoUncensoredMapper {
  19. /**
  20. * 删除所有
  21. */
  22. @Delete("DELETE FROM video_info_uncensored where 1=1")
  23. void deleteAll();
  24. /**
  25. * 批量新增
  26. *
  27. * @param videoInfoUncensoredList
  28. */
  29. @Insert({"<script>" +
  30. "INSERT INTO video_info_uncensored(name, identification_code, issue_date, img_url, video_url, main_who, status, create_time, modify_time) " +
  31. "VALUES " +
  32. "<foreach collection='list' item='viu' index=\"index\" separator=\",\">" +
  33. " (#{viu.name}, #{viu.identificationCode}, #{viu.issueDate}, #{viu.imgUrl}, #{viu.videoUrl}, #{viu.mainWho}, #{viu.status}, #{viu.createTime}, now())" +
  34. " </foreach>" +
  35. "</script>"})
  36. int insertList(List<VideoInfoUncensored> videoInfoUncensoredList);
  37. /**
  38. * 根据状态查询识别码
  39. */
  40. @Select("SELECT identification_code FROM video_info_uncensored WHERE delete_flag = 1 and status = #{status}")
  41. List<String> findIcodeByStatus(Integer status);
  42. /**
  43. * 更新状态
  44. *
  45. * @param identificationCode
  46. * @param status
  47. * @return
  48. */
  49. @Update("update video_info_uncensored set status = #{status},modify_time = now() where identification_code = #{identificationCode}")
  50. int updateStatus(String identificationCode, Integer status);
  51. /**
  52. * 查询所有识别码
  53. */
  54. @Select("select distinct identification_code from video_info_uncensored")
  55. List<String> findAllIcode();
  56. /**
  57. * 根据条件查询
  58. */
  59. List<VideoInfo> getVideoInfoUncensoredList(Map<String, Object> params);
  60. /**
  61. * 根据识别码和类型查询
  62. *
  63. * @return
  64. */
  65. @Select({"<script>" +
  66. "select vi.*,vio.score,vio.comment from video_info_uncensored vi left join video_info_other vio on vi.identification_code = vio.identification_code and vio.delete_flag = 1 WHERE vi.delete_flag = 1" +
  67. "<if test=\"identificationCode != null and identificationCode != ''\">" +
  68. " and vi.identification_code like concat('%',#{identificationCode},'%')" +
  69. "</if>" +
  70. "<if test=\"status != null and type != ''\">" +
  71. " and vi.status = #{status}" +
  72. "</if>" +
  73. "<if test=\"order != null and order != ''\">" +
  74. " order by vi.issue_date ${order}" +
  75. "</if>" +
  76. "</script>"})
  77. List<VideoInfoUncensored> findByCodeAndType(String identificationCode, Integer status, String order);
  78. @Update("update video_info_uncensored set delete_flag = 2,modify_time = now() where identification_code = #{identificationCode}")
  79. void delByCode(String identificationCode);
  80. @Update("update video_info_uncensored set length = #{length}, director = #{director}, maker = #{maker}, issuer = #{issuer}, genres = #{genres}, cast = #{cast}, status = #{status}, modify_time = now() where identification_code = #{identificationCode}")
  81. void updateJsoupInfoByCode(VideoInfoUncensored videoInfoUncensored);
  82. @Select("SELECT M.cast name,COUNT(M.cast) count " +
  83. "FROM (" +
  84. " SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(viu.cast, ',', B.HELP_TOPIC_ID + 1), ',', - 1) AS cast" +
  85. " FROM video_info_uncensored viu" +
  86. " JOIN MYSQL.HELP_TOPIC B" +
  87. " ON B.HELP_TOPIC_ID < (LENGTH(viu.cast) - LENGTH(REPLACE(viu.cast, ',', '')) + 1)" +
  88. " WHERE genres != ''" +
  89. " ) M " +
  90. "GROUP BY M.cast " +
  91. "ORDER BY COUNT(M.cast) DESC LIMIT 30")
  92. List<VideoCast> findCast();
  93. @Select("select main_who AS name, count(id) AS count from video_info_uncensored group by main_who order by count(id) desc")
  94. List<VideoGenres> findGenres();
  95. }