CoinApiConfigMapper.java 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. package top.lvzhiqiang.mapper;
  2. import com.alibaba.fastjson.JSONObject;
  3. import org.apache.ibatis.annotations.Delete;
  4. import org.apache.ibatis.annotations.Insert;
  5. import org.apache.ibatis.annotations.Select;
  6. import top.lvzhiqiang.entity.CoinApiConfig;
  7. import java.util.List;
  8. /**
  9. * coin-API-配置Mapper
  10. *
  11. * @author lvzhiqiang
  12. * 2023/9/9 17:37
  13. */
  14. public interface CoinApiConfigMapper {
  15. /**
  16. * 删除所有
  17. */
  18. @Delete("DELETE FROM coin_api_config")
  19. void deleteAll();
  20. /**
  21. * 批量新增
  22. *
  23. * @param coinApiConfigList
  24. */
  25. @Insert({"<script>" +
  26. "INSERT INTO coin_api_config(name_cn, name_en, url, return_en, return_cn, type, type2, status, create_time, modify_time) " +
  27. "VALUES " +
  28. "<foreach collection='list' item='bac' index=\"index\" separator=\",\">" +
  29. " (#{bac.nameCn}, #{bac.nameEn}, #{bac.url}, #{bac.returnEn}, #{bac.returnCn}, #{bac.type}, #{bac.type2}, #{bac.status}, now(), now())" +
  30. " </foreach>" +
  31. "</script>"})
  32. void insertList(List<CoinApiConfig> coinApiConfigList);
  33. /**
  34. * 查询所有
  35. */
  36. @Select("SELECT * FROM coin_api_config WHERE delete_flag = 1")
  37. List<CoinApiConfig> findAll();
  38. /**
  39. * 根据codeDesc模糊查询
  40. */
  41. @Select({"<script>" +
  42. "select * from coin_api_config WHERE delete_flag = 1" +
  43. "<if test=\"nameCn != null and nameCn != ''\">" +
  44. " and name_cn like concat('%',#{nameCn},'%')" +
  45. "</if>" +
  46. "<if test=\"url != null and url != ''\">" +
  47. " and url like concat('%',#{url},'%')" +
  48. "</if>" +
  49. "<if test=\"type != null \">" +
  50. " and type = #{type}" +
  51. "</if>" +
  52. "<if test=\"type2 != null \">" +
  53. " and type2 = #{type2}" +
  54. "</if>" +
  55. "<if test=\"status != null \">" +
  56. " and status = #{status}" +
  57. "</if>" +
  58. " order by sort desc" +
  59. "</script>"})
  60. List<CoinApiConfig> findByParams(String nameCn, String url, Integer type, Integer type2, Integer status);
  61. @Select("SELECT M.trackCategory " +
  62. "FROM (SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(cw.track_category, ',', B.HELP_TOPIC_ID + 1), ',', - 1) AS trackCategory " +
  63. " FROM coin_watchlist cw " +
  64. " JOIN MYSQL.HELP_TOPIC B " +
  65. " ON B.HELP_TOPIC_ID < (LENGTH(cw.track_category) - LENGTH(REPLACE(cw.track_category, ',', '')) + 1)) M " +
  66. "GROUP BY M.trackCategory " +
  67. "ORDER BY COUNT(M.trackCategory) DESC")
  68. List<String> findTrackCategoryList();
  69. @Select("select style_name from coin_color_style where delete_flag = 1")
  70. List<String> findColorStyleList();
  71. @Select("select id,category_name categoryName from file_image_category where delete_flag = 1")
  72. List<JSONObject> findFileImageCategoryList();
  73. @Select("select id,category_name categoryName from file_music_collection_category where delete_flag = 1")
  74. List<JSONObject> findFileMusicCategoryList();
  75. @Select("select id,category_name categoryName from coin_exchange_category where delete_flag = 1")
  76. List<JSONObject> findFileCurrentHoldingCategoryList();
  77. }