MemberDayWriteMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  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.write.statistics.MemberDayWriteMapper">
  4. <resultMap id="resultMap" type="com.slodon.b2b2c.statistics.pojo.MemberDay">
  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="register_time" property="registerTime" />
  11. <result column="recharge_amount" property="rechargeAmount" />
  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="columns">
  21. <trim suffixOverrides=",">
  22. <if test="statsTime != null">
  23. `stats_time`,
  24. </if>
  25. <if test="webSite != null">
  26. `web_site`,
  27. </if>
  28. <if test="memberId != null">
  29. `member_id`,
  30. </if>
  31. <if test="memberName != null">
  32. `member_name`,
  33. </if>
  34. <if test="registerTime != null">
  35. `register_time`,
  36. </if>
  37. <if test="rechargeAmount != null">
  38. `recharge_amount`,
  39. </if>
  40. <if test="orderSubmitNum != null">
  41. `order_submit_num`,
  42. </if>
  43. <if test="orderSubmitAmount != null">
  44. `order_submit_amount`,
  45. </if>
  46. <if test="orderPayNum != null">
  47. `order_pay_num`,
  48. </if>
  49. <if test="orderPayAmount != null">
  50. `order_pay_amount`,
  51. </if>
  52. <if test="returnNum != null">
  53. `return_num`,
  54. </if>
  55. <if test="returnAmount != null">
  56. `return_amount`,
  57. </if>
  58. </trim>
  59. </sql>
  60. <!--按照主键值进行操作-->
  61. <sql id="pkWhere">
  62. WHERE `stats_id` = #{primaryKey}
  63. </sql>
  64. <!--操作条件-->
  65. <sql id="whereCondition">
  66. <if test="example != null">
  67. <trim prefix="WHERE" prefixOverrides="AND|OR">
  68. <if test="example.statsIdNotEquals != null">
  69. AND `stats_id` != #{example.statsIdNotEquals}
  70. </if>
  71. <if test="example.statsIdIn != null">
  72. AND `stats_id` in (${example.statsIdIn})
  73. </if>
  74. <if test="example.statsTimeAfter != null">
  75. AND `stats_time` <![CDATA[ >= ]]> #{example.statsTimeAfter}
  76. </if>
  77. <if test="example.statsTimeBefore != null">
  78. AND `stats_time` <![CDATA[ <= ]]> #{example.statsTimeBefore}
  79. </if>
  80. <if test="example.webSite != null">
  81. AND `web_site` = #{example.webSite}
  82. </if>
  83. <if test="example.memberId != null">
  84. AND `member_id` = #{example.memberId}
  85. </if>
  86. <if test="example.memberName != null">
  87. AND `member_name` = #{example.memberName}
  88. </if>
  89. <if test="example.memberNameLike != null">
  90. AND `member_name` like concat('%',#{example.memberNameLike},'%')
  91. </if>
  92. <if test="example.registerTimeAfter != null">
  93. AND `register_time` <![CDATA[ >= ]]> #{example.registerTimeAfter}
  94. </if>
  95. <if test="example.registerTimeBefore != null">
  96. AND `register_time` <![CDATA[ <= ]]> #{example.registerTimeBefore}
  97. </if>
  98. <if test="example.rechargeAmount != null">
  99. AND `recharge_amount` = #{example.rechargeAmount}
  100. </if>
  101. <if test="example.orderSubmitNum != null">
  102. AND `order_submit_num` = #{example.orderSubmitNum}
  103. </if>
  104. <if test="example.orderSubmitAmount != null">
  105. AND `order_submit_amount` = #{example.orderSubmitAmount}
  106. </if>
  107. <if test="example.orderPayNum != null">
  108. AND `order_pay_num` = #{example.orderPayNum}
  109. </if>
  110. <if test="example.orderPayAmount != null">
  111. AND `order_pay_amount` = #{example.orderPayAmount}
  112. </if>
  113. <if test="example.returnNum != null">
  114. AND `return_num` = #{example.returnNum}
  115. </if>
  116. <if test="example.returnAmount != null">
  117. AND `return_amount` = #{example.returnAmount}
  118. </if>
  119. </trim>
  120. </if>
  121. </sql>
  122. <!--排序条件-->
  123. <sql id="orderBy">
  124. ORDER BY `stats_id` DESC
  125. </sql>
  126. <sql id="orderByOther">
  127. order by ${example.orderBy}
  128. </sql>
  129. <!--分组条件-->
  130. <sql id="groupBy">
  131. group by ${example.groupBy}
  132. </sql>
  133. <!--分页条件-->
  134. <sql id="limit">
  135. <if test="size != null and size &gt; 0">
  136. limit #{startRow},#{size}
  137. </if>
  138. </sql>
  139. <!--查询符合条件的记录数-->
  140. <select id="countByExample" parameterType="com.slodon.b2b2c.statistics.example.MemberDayExample" resultType="java.lang.Integer">
  141. SELECT
  142. COUNT(*)
  143. FROM `stats_member_day`
  144. <include refid="whereCondition" />
  145. </select>
  146. <!--根据主键查询记录-->
  147. <select id="getByPrimaryKey" resultMap="resultMap">
  148. SELECT
  149. *
  150. FROM `stats_member_day`
  151. <include refid="pkWhere" />
  152. </select>
  153. <!--查询符合条件的记录(所有字段)-->
  154. <select id="listByExample" resultMap="resultMap">
  155. SELECT
  156. *
  157. FROM `stats_member_day`
  158. <include refid="whereCondition" />
  159. <if test="example.groupBy != null">
  160. <include refid="groupBy" />
  161. </if>
  162. <choose>
  163. <when test="example.orderBy != null">
  164. <include refid="orderByOther" />
  165. </when>
  166. <otherwise>
  167. <include refid="orderBy" />
  168. </otherwise>
  169. </choose>
  170. </select>
  171. <!--分页查询符合条件的记录(所有字段)-->
  172. <select id="listPageByExample" resultMap="resultMap">
  173. SELECT
  174. *
  175. FROM `stats_member_day`
  176. <include refid="whereCondition" />
  177. <if test="example.groupBy != null">
  178. <include refid="groupBy" />
  179. </if>
  180. <choose>
  181. <when test="example.orderBy != null">
  182. <include refid="orderByOther" />
  183. </when>
  184. <otherwise>
  185. <include refid="orderBy" />
  186. </otherwise>
  187. </choose>
  188. <include refid="limit" />
  189. </select>
  190. <!--查询符合条件的记录(指定字段)-->
  191. <select id="listFieldsByExample" resultMap="resultMap">
  192. SELECT
  193. ${fields}
  194. FROM `stats_member_day`
  195. <include refid="whereCondition" />
  196. <if test="example.groupBy != null">
  197. <include refid="groupBy" />
  198. </if>
  199. <choose>
  200. <when test="example.orderBy != null">
  201. <include refid="orderByOther" />
  202. </when>
  203. <otherwise>
  204. <include refid="orderBy" />
  205. </otherwise>
  206. </choose>
  207. </select>
  208. <!--分页查询符合条件的记录(指定字段)-->
  209. <select id="listFieldsPageByExample" resultMap="resultMap">
  210. SELECT
  211. ${fields}
  212. FROM `stats_member_day`
  213. <include refid="whereCondition" />
  214. <if test="example.groupBy != null">
  215. <include refid="groupBy" />
  216. </if>
  217. <choose>
  218. <when test="example.orderBy != null">
  219. <include refid="orderByOther" />
  220. </when>
  221. <otherwise>
  222. <include refid="orderBy" />
  223. </otherwise>
  224. </choose>
  225. <include refid="limit" />
  226. </select>
  227. <!--根据条件删除记录,可多条删除-->
  228. <delete id="deleteByExample">
  229. DELETE FROM `stats_member_day`
  230. <include refid="whereCondition" />
  231. </delete>
  232. <!--根据主键删除记录-->
  233. <delete id="deleteByPrimaryKey">
  234. DELETE FROM `stats_member_day`
  235. <include refid="pkWhere" />
  236. </delete>
  237. <!--插入一条记录-->
  238. <insert id="insert" keyColumn="stats_id" keyProperty="statsId" parameterType="com.slodon.b2b2c.statistics.pojo.MemberDay" useGeneratedKeys="true">
  239. INSERT INTO `stats_member_day`(
  240. <include refid="columns" />
  241. )
  242. VALUES(
  243. <trim suffixOverrides=",">
  244. <if test="statsTime != null">
  245. #{statsTime},
  246. </if>
  247. <if test="webSite != null">
  248. #{webSite},
  249. </if>
  250. <if test="memberId != null">
  251. #{memberId},
  252. </if>
  253. <if test="memberName != null">
  254. #{memberName},
  255. </if>
  256. <if test="registerTime != null">
  257. #{registerTime},
  258. </if>
  259. <if test="rechargeAmount != null">
  260. #{rechargeAmount},
  261. </if>
  262. <if test="orderSubmitNum != null">
  263. #{orderSubmitNum},
  264. </if>
  265. <if test="orderSubmitAmount != null">
  266. #{orderSubmitAmount},
  267. </if>
  268. <if test="orderPayNum != null">
  269. #{orderPayNum},
  270. </if>
  271. <if test="orderPayAmount != null">
  272. #{orderPayAmount},
  273. </if>
  274. <if test="returnNum != null">
  275. #{returnNum},
  276. </if>
  277. <if test="returnAmount != null">
  278. #{returnAmount},
  279. </if>
  280. </trim>
  281. )
  282. </insert>
  283. <!--按条件更新记录中不为空的字段-->
  284. <update id="updateByExampleSelective">
  285. UPDATE `stats_member_day`
  286. <trim prefix="SET" suffixOverrides=",">
  287. <if test="record.statsTime != null">
  288. `stats_time` = #{record.statsTime},
  289. </if>
  290. <if test="record.webSite != null">
  291. `web_site` = #{record.webSite},
  292. </if>
  293. <if test="record.memberId != null">
  294. `member_id` = #{record.memberId},
  295. </if>
  296. <if test="record.memberName != null">
  297. `member_name` = #{record.memberName},
  298. </if>
  299. <if test="record.registerTime != null">
  300. `register_time` = #{record.registerTime},
  301. </if>
  302. <if test="record.rechargeAmount != null">
  303. `recharge_amount` = #{record.rechargeAmount},
  304. </if>
  305. <if test="record.orderSubmitNum != null">
  306. `order_submit_num` = #{record.orderSubmitNum},
  307. </if>
  308. <if test="record.orderSubmitAmount != null">
  309. `order_submit_amount` = #{record.orderSubmitAmount},
  310. </if>
  311. <if test="record.orderPayNum != null">
  312. `order_pay_num` = #{record.orderPayNum},
  313. </if>
  314. <if test="record.orderPayAmount != null">
  315. `order_pay_amount` = #{record.orderPayAmount},
  316. </if>
  317. <if test="record.returnNum != null">
  318. `return_num` = #{record.returnNum},
  319. </if>
  320. <if test="record.returnAmount != null">
  321. `return_amount` = #{record.returnAmount},
  322. </if>
  323. </trim>
  324. <include refid="whereCondition" />
  325. </update>
  326. <!--按照主键更新记录中不为空的字段-->
  327. <update id="updateByPrimaryKeySelective">
  328. UPDATE `stats_member_day`
  329. <trim prefix="SET" suffixOverrides=",">
  330. <if test="statsTime != null">
  331. `stats_time` = #{statsTime},
  332. </if>
  333. <if test="webSite !=null">
  334. `web_site` = #{webSite},
  335. </if>
  336. <if test="memberId != null">
  337. `member_id` = #{memberId},
  338. </if>
  339. <if test="memberName != null">
  340. `member_name` = #{memberName},
  341. </if>
  342. <if test="registerTime != null">
  343. `register_time` = #{registerTime},
  344. </if>
  345. <if test="rechargeAmount != null">
  346. `recharge_amount` = #{rechargeAmount},
  347. </if>
  348. <if test="orderSubmitNum != null">
  349. `order_submit_num` = #{orderSubmitNum},
  350. </if>
  351. <if test="orderSubmitAmount != null">
  352. `order_submit_amount` = #{orderSubmitAmount},
  353. </if>
  354. <if test="orderPayNum != null">
  355. `order_pay_num` = #{orderPayNum},
  356. </if>
  357. <if test="orderPayAmount != null">
  358. `order_pay_amount` = #{orderPayAmount},
  359. </if>
  360. <if test="returnNum != null">
  361. `return_num` = #{returnNum},
  362. </if>
  363. <if test="returnAmount != null">
  364. `return_amount` = #{returnAmount},
  365. </if>
  366. </trim>
  367. WHERE `stats_id` = #{statsId}
  368. </update>
  369. </mapper>