Article.sql.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <das-client>
  3. <Sqls>
  4. <Sql name='getArticleList'>
  5. <![CDATA[
  6. select m.*,IFNULL(n.BrowseNumber,0) as BrowseNumber,IFNULL(n.PointNumber,0) as PointNumber,IFNULL(n.CollectionNumber,0) as CollectionNumber,IFNULL(n.CommentNumber,0) as CommentNumber, IFNULL(n.PushNumber,0) as PushNumber
  7. from Org_Article m JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1 and m.ArticleState =1 @Condition
  8. ]]>
  9. </Sql>
  10. <Sql name='getArticleListCount'>
  11. <![CDATA[
  12. select count(*) from Org_Article m
  13. LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1 and m.ArticleState =1 @Condition
  14. ]]>
  15. </Sql>
  16. <Sql name='getArticleById'>
  17. <![CDATA[
  18. select m.*,IFNULL(n.BrowseNumber,0) as BrowseNumber,IFNULL(n.PointNumber,0) as PointNumber,IFNULL(n.CollectionNumber,0) as CollectionNumber,IFNULL(n.CommentNumber,0) as CommentNumber, IFNULL(n.PushNumber,0) as PushNumber
  19. from Org_Article m JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1 @Condition
  20. ]]>
  21. </Sql>
  22. <!--<Sql name='getCollectionArticleList'>
  23. <![CDATA[
  24. select aa.* ,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber, IFNULL(n.PushNumber,0) as PushNumber from (
  25. select m.* from Org_Article m INNER JOIN User_ArticleCollection n on m.articleid=n.ArticleId and 1=1 @UserParam) as aa LEFT JOIN
  26. User_ArticleStatistics n on aa.ArticleId=n.ArticleId where 1=1 @Condition
  27. ]]>
  28. </Sql>-->
  29. <Sql name='getCollectionArticleList'>
  30. <![CDATA[
  31. select aa.* ,n.BrowseNumber,n.PointNumber,n.CollectionNumber,IFNULL(n.CommentNumber,0) as CommentNumber, IFNULL(n.PushNumber,0) as PushNumber from (
  32. select m.* from Org_Article m INNER JOIN User_ArticleCollection n on m.articleid=n.ArticleId and 1=1 and m.ArticleState =1 @UserParam) as aa LEFT JOIN
  33. User_ArticleStatistics n on aa.ArticleId=n.ArticleId where 1=1 @Condition
  34. ]]>
  35. </Sql>
  36. <Sql name='getCollectionArticleListCount'>
  37. <![CDATA[
  38. select count(*) from (
  39. select m.* from Org_Article m INNER JOIN User_ArticleCollection n on m.articleid=n.ArticleId and 1=1 and m.ArticleState =1 @UserParam) as aa LEFT JOIN
  40. User_ArticleStatistics n on aa.ArticleId=n.ArticleId where 1=1 @Condition
  41. ]]>
  42. </Sql>
  43. <Sql name='pointNumberCount'>
  44. <![CDATA[
  45. select * from User_Behavior where BehaviorAction=1 and 1=1 @Condition
  46. ]]>
  47. </Sql>
  48. <Sql name='collectionNumberCount'>
  49. <![CDATA[
  50. select * from User_ArticleCollection where 1=1 @Condition
  51. ]]>
  52. </Sql>
  53. <Sql name='updateArticleStatistic'>
  54. <![CDATA[
  55. update User_ArticleStatistics set @behaviorParam where @ArticleId
  56. ]]>
  57. </Sql>
  58. <Sql name='updateCollectionStatistic'>
  59. <![CDATA[
  60. update User_ArticleStatistics set @behaviorParam= (
  61. select count(*) from User_ArticleCollection where 1=1 @Condition) where @ArticleId
  62. ]]>
  63. </Sql>
  64. <Sql name='updateCommentStatistic'>
  65. <![CDATA[
  66. update User_ArticleStatistics set @behaviorParam= (
  67. select count(*) from User_ArticleComment where 1=1 @Condition) where @ArticleId
  68. ]]>
  69. </Sql>
  70. <Sql name='insertArticleStatistic'>
  71. <![CDATA[
  72. INSERT INTO User_ArticleStatistics (
  73. ArticleId
  74. )
  75. SELECT ?
  76. FROM dual where not exists( select ArticleId from User_ArticleStatistics where 1=1 and ArticleId=? );
  77. ]]>
  78. </Sql>
  79. <Sql name='deleteArticleStatistic'>
  80. <![CDATA[
  81. delete from User_ArticleStatistics
  82. ]]>
  83. </Sql>
  84. <Sql name='queryArticleStatistic'>
  85. <![CDATA[
  86. select * from (
  87. select count(case behavioraction when '1' then 'PointNumber' end) as PointNumber,
  88. count(case behavioraction when '3' then 'ShareNumber' end) as ShareNumber,
  89. count(case behavioraction when '4' then 'BrowseNumber' end) as BrowseNumber,ArticleId
  90. from User_Behavior where 1=1 @Condition) as aa LEFT JOIN
  91. (select count(*) as CommentNumber,ArticleId from User_ArticleComment where 1=1 @Condition) as bb ON aa.articleid=bb.articleid
  92. LEFT JOIN
  93. (select count(*) as CollectionNumber,ArticleId from User_ArticleCollection where 1=1 @Condition and usertype=2)as cc
  94. ON aa.articleid=bb.articleid
  95. ]]>
  96. </Sql>
  97. <Sql name='insertArticleInitStatistic'>
  98. <![CDATA[
  99. INSERT INTO User_ArticleStatistics (ArticleId, BrowseNumber, PointNumber, CommentNumber, ShareNumber, CollectionNumber,PushNumber) VALUES (?,?,?,?,?,?,?);
  100. ]]>
  101. </Sql>
  102. <Sql name='getDoctorArticleList'>
  103. <![CDATA[
  104. select * from (
  105. select m.*,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m
  106. LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where m.isauthentication=1 and 1=1 and m.ArticleState =1 @Condition
  107. union
  108. select m.* ,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m
  109. LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where m.isauthentication=2 and 1=1 and m.ArticleState =1 @Condition @Operatorid
  110. ) as aa @PageParam
  111. ]]>
  112. </Sql>
  113. <Sql name='getDoctorArticleListCount'>
  114. <![CDATA[
  115. select articleid from (
  116. select articleid from Org_Article where isauthentication=1 and 1=1 and m.ArticleState =1 @Condition
  117. union
  118. select articleid from Org_Article where isauthentication=2 and 1=1 and m.ArticleState =1 @Condition @Operatorid
  119. ) as aa
  120. ]]>
  121. </Sql>
  122. <Sql name='getDoctorArticalByUserId'>
  123. <![CDATA[
  124. select m.*,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m
  125. LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1 and m.ArticleState =1 @Condition
  126. ]]>
  127. </Sql>
  128. <Sql name='getDoctorArticalByUserIdCount'>
  129. <![CDATA[
  130. select m.*,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m
  131. LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1 and m.ArticleState =1 @Condition
  132. ]]>
  133. </Sql>
  134. </Sqls>
  135. </das-client>