CmPortraitMapper.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.caimei.modules.user.dao.CmPortraitDao">
  4. <select id="selTotal" resultType="com.caimei.modules.user.entity.CmPortrait">
  5. SELECT
  6. (SELECT COUNT(orderID) FROM cm_order WHERE clubID = #{clubID} AND orderTime <![CDATA[ < ]]> now()) AS orderTotal,
  7. (SELECT SUM(payTotalFee) FROM cm_order WHERE clubID = #{clubID} AND orderTime <![CDATA[ < ]]> now()) AS orderTotalAmount,
  8. (SELECT COUNT(cbr.recordID) FROM cm_behavior_record cbr LEFT JOIN club c ON cbr.userID = c.userID WHERE cbr.pageType IN (8, 9) AND c.clubID = #{clubID} AND cbr.accessDate <![CDATA[ < ]]> now()) AS totalkeywords ,
  9. (SELECT COUNT(remarks) FROM cm_club_remarks WHERE clubID = #{clubID} AND addTime <![CDATA[ < ]]> now()) AS remarksTotal
  10. </select>
  11. <select id="selOrderList" resultType="com.caimei.modules.order.entity.NewOrder">
  12. SELECT
  13. (SELECT COUNT(orderID) FROM cm_order WHERE clubID = #{clubID}) as numbers,
  14. (SELECT SUM(payTotalFee) FROM cm_order WHERE clubID = #{clubID}) as totalMoney,
  15. clubID,
  16. secondHandOrderFlag,
  17. rebateFlag,
  18. refundType,
  19. productTotalFee,
  20. STATUS,
  21. orderTime
  22. FROM cm_order
  23. <where>
  24. clubID = #{clubID}
  25. <if test="accessDate != null and accessDate != ''">
  26. AND orderTime like concat('%',#{accessDate},'%')
  27. </if>
  28. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  29. AND orderTime <![CDATA[ >= ]]> #{startTime} AND orderTime <![CDATA[ <= ]]> #{endTime}
  30. </if>
  31. </where>
  32. </select>
  33. <select id="selBehaviorList" resultType="com.caimei.modules.user.entity.CmBehaviorRecord">
  34. SELECT
  35. c.clubID,
  36. COUNT(cbr.pageLabel) as number,
  37. cbr.pageLabel,
  38. cbr.accessDate
  39. FROM cm_behavior_record cbr LEFT JOIN club c ON cbr.userID = c.userID
  40. <where>
  41. cbr.pageType IN (8, 9) AND c.clubID = #{clubID}
  42. <if test="accessDate != null and accessDate != ''">
  43. AND cbr.accessDate = #{accessDate}
  44. </if>
  45. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  46. AND cbr.accessDate between #{startTime} and #{endTime}
  47. </if>
  48. </where>
  49. GROUP BY cbr.pageLabel
  50. ORDER BY COUNT(cbr.pageLabel) LIMIT 10
  51. </select>
  52. <select id="selRemarksList" resultType="com.caimei.modules.user.entity.CmClubRemarks">
  53. SELECT
  54. (SELECT COUNT(remarks) FROM cm_club_remarks WHERE clubID = #{clubID}) as numbers,
  55. clubID,
  56. COUNT(remarks) as number,
  57. remarks,
  58. addTime
  59. FROM cm_club_remarks
  60. <where>
  61. clubID = #{clubID}
  62. <if test="accessDate != null and accessDate != ''">
  63. AND addTime like concat('%', #{accessDate},'%')
  64. </if>
  65. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  66. AND addTime between #{startTime} and #{endTime}
  67. </if>
  68. </where>
  69. GROUP BY remarks ORDER BY COUNT(remarks) LIMIT 10
  70. </select>
  71. <select id="selBehaviorPageTypeList" resultType="com.caimei.modules.user.entity.CmBehaviorRecord">
  72. SELECT
  73. c.clubID,
  74. COUNT(cbr.pageType) as numbers,
  75. cbr.pageLabel,
  76. cbr.accessDate
  77. FROM cm_behavior_record cbr
  78. LEFT JOIN club c ON cbr.userID = c.userID
  79. <where>
  80. c.clubID = #{clubID}
  81. <if test="accessDate != null and accessDate != ''">
  82. AND cbr.accessDate like concat('%', #{accessDate},'%')
  83. </if>
  84. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  85. AND cbr.accessDate between #{startTime} and #{endTime}
  86. </if>
  87. </where>
  88. GROUP BY cbr.pageType ORDER BY COUNT(cbr.pageType) LIMIT 10
  89. </select>
  90. </mapper>