MemberStoreYearReadMapper.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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.slodon.b2b2c.dao.read.statistics.MemberStoreYearReadMapper">
  4. <resultMap id="resultMap" type="com.slodon.b2b2c.statistics.pojo.MemberStoreYear">
  5. <id column="stats_id" property="statsId" />
  6. <result column="stats_time" property="statsTime" />
  7. <result column="web_site" property="webSite" />
  8. <result column="member_id" property="memberId" />
  9. <result column="member_name" property="memberName" />
  10. <result column="store_id" property="storeId" />
  11. <result column="store_name" property="storeName" />
  12. <result column="order_submit_num" property="orderSubmitNum" />
  13. <result column="order_submit_amount" property="orderSubmitAmount" />
  14. <result column="order_pay_num" property="orderPayNum" />
  15. <result column="order_pay_amount" property="orderPayAmount" />
  16. <result column="return_num" property="returnNum" />
  17. <result column="return_amount" property="returnAmount" />
  18. </resultMap>
  19. <!--按照主键值进行操作-->
  20. <sql id="pkWhere">
  21. WHERE `stats_id` = #{primaryKey}
  22. </sql>
  23. <!--操作条件-->
  24. <sql id="whereCondition">
  25. <if test="example != null">
  26. <trim prefix="WHERE" prefixOverrides="AND|OR">
  27. <if test="example.statsIdNotEquals != null">
  28. AND `stats_id` != #{example.statsIdNotEquals}
  29. </if>
  30. <if test="example.statsIdIn != null">
  31. AND `stats_id` in (${example.statsIdIn})
  32. </if>
  33. <if test="example.statsTimeAfter != null">
  34. AND `stats_time` <![CDATA[ >= ]]> #{example.statsTimeAfter}
  35. </if>
  36. <if test="example.statsTimeBefore != null">
  37. AND `stats_time` <![CDATA[ <= ]]> #{example.statsTimeBefore}
  38. </if>
  39. <if test="example.webSite != null">
  40. AND `web_site` = #{example.webSite}
  41. </if>
  42. <if test="example.memberId != null">
  43. AND `member_id` = #{example.memberId}
  44. </if>
  45. <if test="example.memberName != null">
  46. AND `member_name` = #{example.memberName}
  47. </if>
  48. <if test="example.memberNameLike != null">
  49. AND `member_name` like concat('%',#{example.memberNameLike},'%')
  50. </if>
  51. <if test="example.storeId != null">
  52. AND `store_id` = #{example.storeId}
  53. </if>
  54. <if test="example.storeName != null">
  55. AND `store_name` = #{example.storeName}
  56. </if>
  57. <if test="example.storeNameLike != null">
  58. AND `store_name` like concat('%',#{example.storeNameLike},'%')
  59. </if>
  60. <if test="example.orderSubmitNum != null">
  61. AND `order_submit_num` = #{example.orderSubmitNum}
  62. </if>
  63. <if test="example.orderSubmitAmount != null">
  64. AND `order_submit_amount` = #{example.orderSubmitAmount}
  65. </if>
  66. <if test="example.orderPayNum != null">
  67. AND `order_pay_num` = #{example.orderPayNum}
  68. </if>
  69. <if test="example.orderPayAmount != null">
  70. AND `order_pay_amount` = #{example.orderPayAmount}
  71. </if>
  72. <if test="example.returnNum != null">
  73. AND `return_num` = #{example.returnNum}
  74. </if>
  75. <if test="example.returnAmount != null">
  76. AND `return_amount` = #{example.returnAmount}
  77. </if>
  78. </trim>
  79. </if>
  80. </sql>
  81. <!--排序条件-->
  82. <sql id="orderBy">
  83. ORDER BY `stats_id` DESC
  84. </sql>
  85. <sql id="orderByOther">
  86. order by ${example.orderBy}
  87. </sql>
  88. <!--分组条件-->
  89. <sql id="groupBy">
  90. group by ${example.groupBy}
  91. </sql>
  92. <!--分页条件-->
  93. <sql id="limit">
  94. <if test="size != null and size &gt; 0">
  95. limit #{startRow},#{size}
  96. </if>
  97. </sql>
  98. <!--查询符合条件的记录数-->
  99. <select id="countByExample" parameterType="com.slodon.b2b2c.statistics.example.MemberStoreYearExample" resultType="java.lang.Integer">
  100. SELECT
  101. COUNT(*)
  102. FROM `stats_member_store_year`
  103. <include refid="whereCondition" />
  104. </select>
  105. <!--根据主键查询记录-->
  106. <select id="getByPrimaryKey" resultMap="resultMap">
  107. SELECT
  108. *
  109. FROM `stats_member_store_year`
  110. <include refid="pkWhere" />
  111. </select>
  112. <!--查询符合条件的记录(所有字段)-->
  113. <select id="listByExample" resultMap="resultMap">
  114. SELECT
  115. *
  116. FROM `stats_member_store_year`
  117. <include refid="whereCondition" />
  118. <if test="example.groupBy != null">
  119. <include refid="groupBy" />
  120. </if>
  121. <choose>
  122. <when test="example.orderBy != null">
  123. <include refid="orderByOther" />
  124. </when>
  125. <otherwise>
  126. <include refid="orderBy" />
  127. </otherwise>
  128. </choose>
  129. </select>
  130. <!--分页查询符合条件的记录(所有字段)-->
  131. <select id="listPageByExample" resultMap="resultMap">
  132. SELECT
  133. *
  134. FROM `stats_member_store_year`
  135. <include refid="whereCondition" />
  136. <if test="example.groupBy != null">
  137. <include refid="groupBy" />
  138. </if>
  139. <choose>
  140. <when test="example.orderBy != null">
  141. <include refid="orderByOther" />
  142. </when>
  143. <otherwise>
  144. <include refid="orderBy" />
  145. </otherwise>
  146. </choose>
  147. <include refid="limit" />
  148. </select>
  149. <!--查询符合条件的记录(指定字段)-->
  150. <select id="listFieldsByExample" resultMap="resultMap">
  151. SELECT
  152. ${fields}
  153. FROM `stats_member_store_year`
  154. <include refid="whereCondition" />
  155. <if test="example.groupBy != null">
  156. <include refid="groupBy" />
  157. </if>
  158. <choose>
  159. <when test="example.orderBy != null">
  160. <include refid="orderByOther" />
  161. </when>
  162. <otherwise>
  163. <include refid="orderBy" />
  164. </otherwise>
  165. </choose>
  166. </select>
  167. <!--分页查询符合条件的记录(指定字段)-->
  168. <select id="listFieldsPageByExample" resultMap="resultMap">
  169. SELECT
  170. ${fields}
  171. FROM `stats_member_store_year`
  172. <include refid="whereCondition" />
  173. <if test="example.groupBy != null">
  174. <include refid="groupBy" />
  175. </if>
  176. <choose>
  177. <when test="example.orderBy != null">
  178. <include refid="orderByOther" />
  179. </when>
  180. <otherwise>
  181. <include refid="orderBy" />
  182. </otherwise>
  183. </choose>
  184. <include refid="limit" />
  185. </select>
  186. </mapper>