Article.sql.xml 4.5 KB

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