TOrderMapper.xml 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  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.shawn.repository.TOrderMapper">
  4. <resultMap id="BaseResultMap" type="com.shawn.model.entity.TOrder">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  7. <result column="modify_date" jdbcType="TIMESTAMP" property="modifyDate" />
  8. <result column="admin_id" jdbcType="BIGINT" property="adminId" />
  9. <result column="admin_proportion" jdbcType="DECIMAL" property="adminProportion" />
  10. <result column="agency_id" jdbcType="BIGINT" property="agencyId" />
  11. <result column="agency_proportion" jdbcType="DECIMAL" property="agencyProportion" />
  12. <result column="alt_info" jdbcType="VARCHAR" property="altInfo" />
  13. <result column="client_id" jdbcType="VARCHAR" property="clientId" />
  14. <result column="equipment_id" jdbcType="BIGINT" property="equipmentId" />
  15. <result column="frp_code" jdbcType="VARCHAR" property="frpCode" />
  16. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  17. <result column="merchant_proportion" jdbcType="DECIMAL" property="merchantProportion" />
  18. <result column="pay_date" jdbcType="TIMESTAMP" property="payDate" />
  19. <result column="personage_id" jdbcType="BIGINT" property="personageId" />
  20. <result column="personage_proportion" jdbcType="DECIMAL" property="personageProportion" />
  21. <result column="price" jdbcType="DECIMAL" property="price" />
  22. <result column="product_id" jdbcType="BIGINT" property="productId" />
  23. <result column="product_name" jdbcType="VARCHAR" property="productName" />
  24. <result column="refund_date" jdbcType="TIMESTAMP" property="refundDate" />
  25. <result column="sn" jdbcType="VARCHAR" property="sn" />
  26. <result column="status" jdbcType="INTEGER" property="status" />
  27. <result column="type" jdbcType="INTEGER" property="type" />
  28. <result column="trx_no" jdbcType="VARCHAR" property="trxNo" />
  29. <result column="refund_trx_no" jdbcType="VARCHAR" property="refundTrxNo" />
  30. <result column="refund_amount" jdbcType="DECIMAL" property="refundAmount" />
  31. </resultMap>
  32. <resultMap id="chartBean" type="com.shawn.model.Bean.ChartBean">
  33. <result column="categorie" jdbcType="VARCHAR" property="categorie" />
  34. <result column="saleNum" jdbcType="INTEGER" property="saleNum" />
  35. <result column="salePrice" jdbcType="DECIMAL" property="salePrice" />
  36. </resultMap>
  37. <sql id="Example_Where_Clause">
  38. <where>
  39. <foreach collection="oredCriteria" item="criteria" separator="or">
  40. <if test="criteria.valid">
  41. <trim prefix="(" prefixOverrides="and" suffix=")">
  42. <foreach collection="criteria.criteria" item="criterion">
  43. <choose>
  44. <when test="criterion.noValue">
  45. and ${criterion.condition}
  46. </when>
  47. <when test="criterion.singleValue">
  48. and ${criterion.condition} #{criterion.value}
  49. </when>
  50. <when test="criterion.betweenValue">
  51. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  52. </when>
  53. <when test="criterion.listValue">
  54. and ${criterion.condition}
  55. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  56. #{listItem}
  57. </foreach>
  58. </when>
  59. </choose>
  60. </foreach>
  61. </trim>
  62. </if>
  63. </foreach>
  64. </where>
  65. </sql>
  66. <sql id="Update_By_Example_Where_Clause">
  67. <where>
  68. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  69. <if test="criteria.valid">
  70. <trim prefix="(" prefixOverrides="and" suffix=")">
  71. <foreach collection="criteria.criteria" item="criterion">
  72. <choose>
  73. <when test="criterion.noValue">
  74. and ${criterion.condition}
  75. </when>
  76. <when test="criterion.singleValue">
  77. and ${criterion.condition} #{criterion.value}
  78. </when>
  79. <when test="criterion.betweenValue">
  80. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  81. </when>
  82. <when test="criterion.listValue">
  83. and ${criterion.condition}
  84. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  85. #{listItem}
  86. </foreach>
  87. </when>
  88. </choose>
  89. </foreach>
  90. </trim>
  91. </if>
  92. </foreach>
  93. </where>
  94. </sql>
  95. <sql id="Base_Column_List">
  96. id, create_date, modify_date, admin_id, admin_proportion, agency_id, agency_proportion,
  97. alt_info, client_id, equipment_id, frp_code, merchant_id, merchant_proportion, pay_date,
  98. personage_id, personage_proportion, price, product_id, product_name, refund_date,
  99. sn, status, type, trx_no, refund_trx_no, refund_amount
  100. </sql>
  101. <select id="selectByExample" parameterType="com.shawn.model.entity.TOrderExample" resultMap="BaseResultMap">
  102. select
  103. <if test="distinct">
  104. distinct
  105. </if>
  106. <include refid="Base_Column_List" />
  107. from t_order
  108. <if test="_parameter != null">
  109. <include refid="Example_Where_Clause" />
  110. </if>
  111. <if test="orderByClause != null">
  112. order by ${orderByClause}
  113. </if>
  114. <if test="limit != null">
  115. <if test="offset != null">
  116. limit ${offset}, ${limit}
  117. </if>
  118. <if test="offset == null">
  119. limit ${limit}
  120. </if>
  121. </if>
  122. </select>
  123. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  124. select
  125. <include refid="Base_Column_List" />
  126. from t_order
  127. where id = #{id,jdbcType=BIGINT}
  128. </select>
  129. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  130. delete from t_order
  131. where id = #{id,jdbcType=BIGINT}
  132. </delete>
  133. <delete id="deleteByExample" parameterType="com.shawn.model.entity.TOrderExample">
  134. delete from t_order
  135. <if test="_parameter != null">
  136. <include refid="Example_Where_Clause" />
  137. </if>
  138. </delete>
  139. <insert id="insert" parameterType="com.shawn.model.entity.TOrder">
  140. insert into t_order (id, create_date, modify_date,
  141. admin_id, admin_proportion, agency_id,
  142. agency_proportion, alt_info, client_id,
  143. equipment_id, frp_code, merchant_id,
  144. merchant_proportion, pay_date, personage_id,
  145. personage_proportion, price, product_id,
  146. product_name, refund_date, sn,
  147. status, type, trx_no,
  148. refund_trx_no, refund_amount)
  149. values (#{id,jdbcType=BIGINT}, #{createDate,jdbcType=TIMESTAMP}, #{modifyDate,jdbcType=TIMESTAMP},
  150. #{adminId,jdbcType=BIGINT}, #{adminProportion,jdbcType=DECIMAL}, #{agencyId,jdbcType=BIGINT},
  151. #{agencyProportion,jdbcType=DECIMAL}, #{altInfo,jdbcType=VARCHAR}, #{clientId,jdbcType=VARCHAR},
  152. #{equipmentId,jdbcType=BIGINT}, #{frpCode,jdbcType=VARCHAR}, #{merchantId,jdbcType=BIGINT},
  153. #{merchantProportion,jdbcType=DECIMAL}, #{payDate,jdbcType=TIMESTAMP}, #{personageId,jdbcType=BIGINT},
  154. #{personageProportion,jdbcType=DECIMAL}, #{price,jdbcType=DECIMAL}, #{productId,jdbcType=BIGINT},
  155. #{productName,jdbcType=VARCHAR}, #{refundDate,jdbcType=TIMESTAMP}, #{sn,jdbcType=VARCHAR},
  156. #{status,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{trxNo,jdbcType=VARCHAR},
  157. #{refundTrxNo,jdbcType=VARCHAR}, #{refundAmount,jdbcType=DECIMAL})
  158. </insert>
  159. <insert id="insertSelective" parameterType="com.shawn.model.entity.TOrder">
  160. insert into t_order
  161. <trim prefix="(" suffix=")" suffixOverrides=",">
  162. <if test="id != null">
  163. id,
  164. </if>
  165. <if test="createDate != null">
  166. create_date,
  167. </if>
  168. <if test="modifyDate != null">
  169. modify_date,
  170. </if>
  171. <if test="adminId != null">
  172. admin_id,
  173. </if>
  174. <if test="adminProportion != null">
  175. admin_proportion,
  176. </if>
  177. <if test="agencyId != null">
  178. agency_id,
  179. </if>
  180. <if test="agencyProportion != null">
  181. agency_proportion,
  182. </if>
  183. <if test="altInfo != null">
  184. alt_info,
  185. </if>
  186. <if test="clientId != null">
  187. client_id,
  188. </if>
  189. <if test="equipmentId != null">
  190. equipment_id,
  191. </if>
  192. <if test="frpCode != null">
  193. frp_code,
  194. </if>
  195. <if test="merchantId != null">
  196. merchant_id,
  197. </if>
  198. <if test="merchantProportion != null">
  199. merchant_proportion,
  200. </if>
  201. <if test="payDate != null">
  202. pay_date,
  203. </if>
  204. <if test="personageId != null">
  205. personage_id,
  206. </if>
  207. <if test="personageProportion != null">
  208. personage_proportion,
  209. </if>
  210. <if test="price != null">
  211. price,
  212. </if>
  213. <if test="productId != null">
  214. product_id,
  215. </if>
  216. <if test="productName != null">
  217. product_name,
  218. </if>
  219. <if test="refundDate != null">
  220. refund_date,
  221. </if>
  222. <if test="sn != null">
  223. sn,
  224. </if>
  225. <if test="status != null">
  226. status,
  227. </if>
  228. <if test="type != null">
  229. type,
  230. </if>
  231. <if test="trxNo != null">
  232. trx_no,
  233. </if>
  234. <if test="refundTrxNo != null">
  235. refund_trx_no,
  236. </if>
  237. <if test="refundAmount != null">
  238. refund_amount,
  239. </if>
  240. </trim>
  241. <trim prefix="values (" suffix=")" suffixOverrides=",">
  242. <if test="id != null">
  243. #{id,jdbcType=BIGINT},
  244. </if>
  245. <if test="createDate != null">
  246. #{createDate,jdbcType=TIMESTAMP},
  247. </if>
  248. <if test="modifyDate != null">
  249. #{modifyDate,jdbcType=TIMESTAMP},
  250. </if>
  251. <if test="adminId != null">
  252. #{adminId,jdbcType=BIGINT},
  253. </if>
  254. <if test="adminProportion != null">
  255. #{adminProportion,jdbcType=DECIMAL},
  256. </if>
  257. <if test="agencyId != null">
  258. #{agencyId,jdbcType=BIGINT},
  259. </if>
  260. <if test="agencyProportion != null">
  261. #{agencyProportion,jdbcType=DECIMAL},
  262. </if>
  263. <if test="altInfo != null">
  264. #{altInfo,jdbcType=VARCHAR},
  265. </if>
  266. <if test="clientId != null">
  267. #{clientId,jdbcType=VARCHAR},
  268. </if>
  269. <if test="equipmentId != null">
  270. #{equipmentId,jdbcType=BIGINT},
  271. </if>
  272. <if test="frpCode != null">
  273. #{frpCode,jdbcType=VARCHAR},
  274. </if>
  275. <if test="merchantId != null">
  276. #{merchantId,jdbcType=BIGINT},
  277. </if>
  278. <if test="merchantProportion != null">
  279. #{merchantProportion,jdbcType=DECIMAL},
  280. </if>
  281. <if test="payDate != null">
  282. #{payDate,jdbcType=TIMESTAMP},
  283. </if>
  284. <if test="personageId != null">
  285. #{personageId,jdbcType=BIGINT},
  286. </if>
  287. <if test="personageProportion != null">
  288. #{personageProportion,jdbcType=DECIMAL},
  289. </if>
  290. <if test="price != null">
  291. #{price,jdbcType=DECIMAL},
  292. </if>
  293. <if test="productId != null">
  294. #{productId,jdbcType=BIGINT},
  295. </if>
  296. <if test="productName != null">
  297. #{productName,jdbcType=VARCHAR},
  298. </if>
  299. <if test="refundDate != null">
  300. #{refundDate,jdbcType=TIMESTAMP},
  301. </if>
  302. <if test="sn != null">
  303. #{sn,jdbcType=VARCHAR},
  304. </if>
  305. <if test="status != null">
  306. #{status,jdbcType=INTEGER},
  307. </if>
  308. <if test="type != null">
  309. #{type,jdbcType=INTEGER},
  310. </if>
  311. <if test="trxNo != null">
  312. #{trxNo,jdbcType=VARCHAR},
  313. </if>
  314. <if test="refundTrxNo != null">
  315. #{refundTrxNo,jdbcType=VARCHAR},
  316. </if>
  317. <if test="refundAmount != null">
  318. #{refundAmount,jdbcType=DECIMAL},
  319. </if>
  320. </trim>
  321. </insert>
  322. <select id="countByExample" parameterType="com.shawn.model.entity.TOrderExample" resultType="java.lang.Long">
  323. select count(*) from t_order
  324. <if test="_parameter != null">
  325. <include refid="Example_Where_Clause" />
  326. </if>
  327. </select>
  328. <update id="updateByExampleSelective" parameterType="map">
  329. update t_order
  330. <set>
  331. <if test="record.id != null">
  332. id = #{record.id,jdbcType=BIGINT},
  333. </if>
  334. <if test="record.createDate != null">
  335. create_date = #{record.createDate,jdbcType=TIMESTAMP},
  336. </if>
  337. <if test="record.modifyDate != null">
  338. modify_date = #{record.modifyDate,jdbcType=TIMESTAMP},
  339. </if>
  340. <if test="record.adminId != null">
  341. admin_id = #{record.adminId,jdbcType=BIGINT},
  342. </if>
  343. <if test="record.adminProportion != null">
  344. admin_proportion = #{record.adminProportion,jdbcType=DECIMAL},
  345. </if>
  346. <if test="record.agencyId != null">
  347. agency_id = #{record.agencyId,jdbcType=BIGINT},
  348. </if>
  349. <if test="record.agencyProportion != null">
  350. agency_proportion = #{record.agencyProportion,jdbcType=DECIMAL},
  351. </if>
  352. <if test="record.altInfo != null">
  353. alt_info = #{record.altInfo,jdbcType=VARCHAR},
  354. </if>
  355. <if test="record.clientId != null">
  356. client_id = #{record.clientId,jdbcType=VARCHAR},
  357. </if>
  358. <if test="record.equipmentId != null">
  359. equipment_id = #{record.equipmentId,jdbcType=BIGINT},
  360. </if>
  361. <if test="record.frpCode != null">
  362. frp_code = #{record.frpCode,jdbcType=VARCHAR},
  363. </if>
  364. <if test="record.merchantId != null">
  365. merchant_id = #{record.merchantId,jdbcType=BIGINT},
  366. </if>
  367. <if test="record.merchantProportion != null">
  368. merchant_proportion = #{record.merchantProportion,jdbcType=DECIMAL},
  369. </if>
  370. <if test="record.payDate != null">
  371. pay_date = #{record.payDate,jdbcType=TIMESTAMP},
  372. </if>
  373. <if test="record.personageId != null">
  374. personage_id = #{record.personageId,jdbcType=BIGINT},
  375. </if>
  376. <if test="record.personageProportion != null">
  377. personage_proportion = #{record.personageProportion,jdbcType=DECIMAL},
  378. </if>
  379. <if test="record.price != null">
  380. price = #{record.price,jdbcType=DECIMAL},
  381. </if>
  382. <if test="record.productId != null">
  383. product_id = #{record.productId,jdbcType=BIGINT},
  384. </if>
  385. <if test="record.productName != null">
  386. product_name = #{record.productName,jdbcType=VARCHAR},
  387. </if>
  388. <if test="record.refundDate != null">
  389. refund_date = #{record.refundDate,jdbcType=TIMESTAMP},
  390. </if>
  391. <if test="record.sn != null">
  392. sn = #{record.sn,jdbcType=VARCHAR},
  393. </if>
  394. <if test="record.status != null">
  395. status = #{record.status,jdbcType=INTEGER},
  396. </if>
  397. <if test="record.type != null">
  398. type = #{record.type,jdbcType=INTEGER},
  399. </if>
  400. <if test="record.trxNo != null">
  401. trx_no = #{record.trxNo,jdbcType=VARCHAR},
  402. </if>
  403. <if test="record.refundTrxNo != null">
  404. refund_trx_no = #{record.refundTrxNo,jdbcType=VARCHAR},
  405. </if>
  406. <if test="record.refundAmount != null">
  407. refund_amount = #{record.refundAmount,jdbcType=DECIMAL},
  408. </if>
  409. </set>
  410. <if test="_parameter != null">
  411. <include refid="Update_By_Example_Where_Clause" />
  412. </if>
  413. </update>
  414. <update id="updateByExample" parameterType="map">
  415. update t_order
  416. set id = #{record.id,jdbcType=BIGINT},
  417. create_date = #{record.createDate,jdbcType=TIMESTAMP},
  418. modify_date = #{record.modifyDate,jdbcType=TIMESTAMP},
  419. admin_id = #{record.adminId,jdbcType=BIGINT},
  420. admin_proportion = #{record.adminProportion,jdbcType=DECIMAL},
  421. agency_id = #{record.agencyId,jdbcType=BIGINT},
  422. agency_proportion = #{record.agencyProportion,jdbcType=DECIMAL},
  423. alt_info = #{record.altInfo,jdbcType=VARCHAR},
  424. client_id = #{record.clientId,jdbcType=VARCHAR},
  425. equipment_id = #{record.equipmentId,jdbcType=BIGINT},
  426. frp_code = #{record.frpCode,jdbcType=VARCHAR},
  427. merchant_id = #{record.merchantId,jdbcType=BIGINT},
  428. merchant_proportion = #{record.merchantProportion,jdbcType=DECIMAL},
  429. pay_date = #{record.payDate,jdbcType=TIMESTAMP},
  430. personage_id = #{record.personageId,jdbcType=BIGINT},
  431. personage_proportion = #{record.personageProportion,jdbcType=DECIMAL},
  432. price = #{record.price,jdbcType=DECIMAL},
  433. product_id = #{record.productId,jdbcType=BIGINT},
  434. product_name = #{record.productName,jdbcType=VARCHAR},
  435. refund_date = #{record.refundDate,jdbcType=TIMESTAMP},
  436. sn = #{record.sn,jdbcType=VARCHAR},
  437. status = #{record.status,jdbcType=INTEGER},
  438. type = #{record.type,jdbcType=INTEGER},
  439. trx_no = #{record.trxNo,jdbcType=VARCHAR},
  440. refund_trx_no = #{record.refundTrxNo,jdbcType=VARCHAR},
  441. refund_amount = #{record.refundAmount,jdbcType=DECIMAL}
  442. <if test="_parameter != null">
  443. <include refid="Update_By_Example_Where_Clause" />
  444. </if>
  445. </update>
  446. <update id="updateByPrimaryKeySelective" parameterType="com.shawn.model.entity.TOrder">
  447. update t_order
  448. <set>
  449. <if test="createDate != null">
  450. create_date = #{createDate,jdbcType=TIMESTAMP},
  451. </if>
  452. <if test="modifyDate != null">
  453. modify_date = #{modifyDate,jdbcType=TIMESTAMP},
  454. </if>
  455. <if test="adminId != null">
  456. admin_id = #{adminId,jdbcType=BIGINT},
  457. </if>
  458. <if test="adminProportion != null">
  459. admin_proportion = #{adminProportion,jdbcType=DECIMAL},
  460. </if>
  461. <if test="agencyId != null">
  462. agency_id = #{agencyId,jdbcType=BIGINT},
  463. </if>
  464. <if test="agencyProportion != null">
  465. agency_proportion = #{agencyProportion,jdbcType=DECIMAL},
  466. </if>
  467. <if test="altInfo != null">
  468. alt_info = #{altInfo,jdbcType=VARCHAR},
  469. </if>
  470. <if test="clientId != null">
  471. client_id = #{clientId,jdbcType=VARCHAR},
  472. </if>
  473. <if test="equipmentId != null">
  474. equipment_id = #{equipmentId,jdbcType=BIGINT},
  475. </if>
  476. <if test="frpCode != null">
  477. frp_code = #{frpCode,jdbcType=VARCHAR},
  478. </if>
  479. <if test="merchantId != null">
  480. merchant_id = #{merchantId,jdbcType=BIGINT},
  481. </if>
  482. <if test="merchantProportion != null">
  483. merchant_proportion = #{merchantProportion,jdbcType=DECIMAL},
  484. </if>
  485. <if test="payDate != null">
  486. pay_date = #{payDate,jdbcType=TIMESTAMP},
  487. </if>
  488. <if test="personageId != null">
  489. personage_id = #{personageId,jdbcType=BIGINT},
  490. </if>
  491. <if test="personageProportion != null">
  492. personage_proportion = #{personageProportion,jdbcType=DECIMAL},
  493. </if>
  494. <if test="price != null">
  495. price = #{price,jdbcType=DECIMAL},
  496. </if>
  497. <if test="productId != null">
  498. product_id = #{productId,jdbcType=BIGINT},
  499. </if>
  500. <if test="productName != null">
  501. product_name = #{productName,jdbcType=VARCHAR},
  502. </if>
  503. <if test="refundDate != null">
  504. refund_date = #{refundDate,jdbcType=TIMESTAMP},
  505. </if>
  506. <if test="sn != null">
  507. sn = #{sn,jdbcType=VARCHAR},
  508. </if>
  509. <if test="status != null">
  510. status = #{status,jdbcType=INTEGER},
  511. </if>
  512. <if test="type != null">
  513. type = #{type,jdbcType=INTEGER},
  514. </if>
  515. <if test="trxNo != null">
  516. trx_no = #{trxNo,jdbcType=VARCHAR},
  517. </if>
  518. <if test="refundTrxNo != null">
  519. refund_trx_no = #{refundTrxNo,jdbcType=VARCHAR},
  520. </if>
  521. <if test="refundAmount != null">
  522. refund_amount = #{refundAmount,jdbcType=DECIMAL},
  523. </if>
  524. </set>
  525. where id = #{id,jdbcType=BIGINT}
  526. </update>
  527. <update id="updateByPrimaryKey" parameterType="com.shawn.model.entity.TOrder">
  528. update t_order
  529. set create_date = #{createDate,jdbcType=TIMESTAMP},
  530. modify_date = #{modifyDate,jdbcType=TIMESTAMP},
  531. admin_id = #{adminId,jdbcType=BIGINT},
  532. admin_proportion = #{adminProportion,jdbcType=DECIMAL},
  533. agency_id = #{agencyId,jdbcType=BIGINT},
  534. agency_proportion = #{agencyProportion,jdbcType=DECIMAL},
  535. alt_info = #{altInfo,jdbcType=VARCHAR},
  536. client_id = #{clientId,jdbcType=VARCHAR},
  537. equipment_id = #{equipmentId,jdbcType=BIGINT},
  538. frp_code = #{frpCode,jdbcType=VARCHAR},
  539. merchant_id = #{merchantId,jdbcType=BIGINT},
  540. merchant_proportion = #{merchantProportion,jdbcType=DECIMAL},
  541. pay_date = #{payDate,jdbcType=TIMESTAMP},
  542. personage_id = #{personageId,jdbcType=BIGINT},
  543. personage_proportion = #{personageProportion,jdbcType=DECIMAL},
  544. price = #{price,jdbcType=DECIMAL},
  545. product_id = #{productId,jdbcType=BIGINT},
  546. product_name = #{productName,jdbcType=VARCHAR},
  547. refund_date = #{refundDate,jdbcType=TIMESTAMP},
  548. sn = #{sn,jdbcType=VARCHAR},
  549. status = #{status,jdbcType=INTEGER},
  550. type = #{type,jdbcType=INTEGER},
  551. trx_no = #{trxNo,jdbcType=VARCHAR},
  552. refund_trx_no = #{refundTrxNo,jdbcType=VARCHAR},
  553. refund_amount = #{refundAmount,jdbcType=DECIMAL}
  554. where id = #{id,jdbcType=BIGINT}
  555. </update>
  556. <insert id="insertBatch" parameterType="java.util.List">
  557. insert into t_order (id,create_date,modify_date,admin_id,admin_proportion,agency_id,agency_proportion,alt_info,client_id,equipment_id,frp_code,merchant_id,merchant_proportion,pay_date,personage_id,personage_proportion,price,product_id,product_name,refund_date,sn,status,type,trx_no,refund_trx_no,refund_amount)
  558. <foreach collection="list" index="index" item="item" separator="union all">
  559. select #{item.id,jdbcType=BIGINT},#{item.createDate,jdbcType=TIMESTAMP},#{item.modifyDate,jdbcType=TIMESTAMP},#{item.adminId,jdbcType=BIGINT},#{item.adminProportion,jdbcType=DECIMAL},#{item.agencyId,jdbcType=BIGINT},#{item.agencyProportion,jdbcType=DECIMAL},#{item.altInfo,jdbcType=VARCHAR},#{item.clientId,jdbcType=VARCHAR},#{item.equipmentId,jdbcType=BIGINT},#{item.frpCode,jdbcType=VARCHAR},#{item.merchantId,jdbcType=BIGINT},#{item.merchantProportion,jdbcType=DECIMAL},#{item.payDate,jdbcType=TIMESTAMP},#{item.personageId,jdbcType=BIGINT},#{item.personageProportion,jdbcType=DECIMAL},#{item.price,jdbcType=DECIMAL},#{item.productId,jdbcType=BIGINT},#{item.productName,jdbcType=VARCHAR},#{item.refundDate,jdbcType=TIMESTAMP},#{item.sn,jdbcType=VARCHAR},#{item.status,jdbcType=INTEGER},#{item.type,jdbcType=INTEGER},#{item.trxNo,jdbcType=VARCHAR},#{item.refundTrxNo,jdbcType=VARCHAR},#{item.refundAmount,jdbcType=DECIMAL} from dual
  560. </foreach>
  561. </insert>
  562. <delete id="deleteBatchByIdList" parameterType="java.util.List">
  563. DELETE FROM t_order where id in
  564. <foreach close=")" collection="list" item="item" open="(" separator=",">
  565. #{item}
  566. </foreach>
  567. </delete>
  568. <update id="updateBatchByIdList" parameterType="com.shawn.model.param.TOrderParam">
  569. update t_order
  570. <trim prefix="set" suffixOverrides=",">
  571. <if test="id != null">
  572. id = #{id},
  573. </if>
  574. <if test="createDate != null">
  575. create_date = #{createDate},
  576. </if>
  577. <if test="modifyDate != null">
  578. modify_date = #{modifyDate},
  579. </if>
  580. <if test="adminId != null">
  581. admin_id = #{adminId},
  582. </if>
  583. <if test="adminProportion != null">
  584. admin_proportion = #{adminProportion},
  585. </if>
  586. <if test="agencyId != null">
  587. agency_id = #{agencyId},
  588. </if>
  589. <if test="agencyProportion != null">
  590. agency_proportion = #{agencyProportion},
  591. </if>
  592. <if test="altInfo != null">
  593. alt_info = #{altInfo},
  594. </if>
  595. <if test="clientId != null">
  596. client_id = #{clientId},
  597. </if>
  598. <if test="equipmentId != null">
  599. equipment_id = #{equipmentId},
  600. </if>
  601. <if test="frpCode != null">
  602. frp_code = #{frpCode},
  603. </if>
  604. <if test="merchantId != null">
  605. merchant_id = #{merchantId},
  606. </if>
  607. <if test="merchantProportion != null">
  608. merchant_proportion = #{merchantProportion},
  609. </if>
  610. <if test="payDate != null">
  611. pay_date = #{payDate},
  612. </if>
  613. <if test="personageId != null">
  614. personage_id = #{personageId},
  615. </if>
  616. <if test="personageProportion != null">
  617. personage_proportion = #{personageProportion},
  618. </if>
  619. <if test="price != null">
  620. price = #{price},
  621. </if>
  622. <if test="productId != null">
  623. product_id = #{productId},
  624. </if>
  625. <if test="productName != null">
  626. product_name = #{productName},
  627. </if>
  628. <if test="refundDate != null">
  629. refund_date = #{refundDate},
  630. </if>
  631. <if test="sn != null">
  632. sn = #{sn},
  633. </if>
  634. <if test="status != null">
  635. status = #{status},
  636. </if>
  637. <if test="type != null">
  638. type = #{type},
  639. </if>
  640. <if test="trxNo != null">
  641. trx_no = #{trxNo},
  642. </if>
  643. <if test="refundTrxNo != null">
  644. refund_trx_no = #{refundTrxNo},
  645. </if>
  646. <if test="refundAmount != null">
  647. refund_amount = #{refundAmount},
  648. </if>
  649. </trim>
  650. where id in
  651. <foreach close=")" collection="primaryKeyList" item="item" open="(" separator=",">
  652. #{item}
  653. </foreach>
  654. </update>
  655. <!-- 日统计 -->
  656. <select id="getDayStatistics" resultMap="chartBean" parameterType="com.shawn.model.param.StatisticsParam">
  657. select concat(DATE_FORMAT( a.create_date,'%H'),'点') as categorie,count(1) as saleNum,sum(a.price) as salePrice from t_order a
  658. where a.status='1' -- 支付成功
  659. <if test="adminId != null and adminId !=''">
  660. and a.admin_id= #{adminId} -- 所属商家id
  661. </if>
  662. <if test="equipmentId != null and equipmentId !=''">
  663. and a.equipment_id= #{equipmentId} -- 设备id
  664. </if>
  665. and DATE_FORMAT( a.create_date,'%Y/%m/%d') = #{startDate}
  666. group by DATE_FORMAT( a.create_date,'%H')
  667. order by categorie
  668. </select>
  669. <!-- 周统计 -->
  670. <select id="getWeekStatistics" resultMap="chartBean" parameterType="com.shawn.model.param.StatisticsParam">
  671. SELECT tab1.categorie,ifnull(tab2.saleNum,0) as saleNum,ifnull(tab2.salePrice,0) as salePrice from (
  672. select '周1' as categorie from dual UNION all
  673. select '周2' as categorie from dual UNION all
  674. select '周3' as categorie from dual UNION all
  675. select '周4' as categorie from dual UNION all
  676. select '周5' as categorie from dual UNION all
  677. select '周6' as categorie from dual UNION all
  678. select '周日' as categorie from dual) tab1
  679. left join (
  680. select case DATE_FORMAT( a.create_date,'%w') when 0 then '周日' else CONCAT('周',DATE_FORMAT( a.create_date,'%w')) end as categorie,
  681. count(1) as saleNum,sum(a.price) as salePrice from t_order a
  682. where a.status='1' -- 支付成功
  683. <if test="adminId != null and adminId !=''">
  684. and a.admin_id= #{adminId} -- 所属商家id
  685. </if>
  686. <if test="equipmentId != null and equipmentId !=''">
  687. and a.equipment_id= #{equipmentId} -- 设备id
  688. </if>
  689. AND a.create_date >= STR_TO_DATE(CONCAT(#{startDate},' 00:00:00'),'%Y/%m/%d %H:%i:%s')
  690. <![CDATA[ AND a.create_date <= STR_TO_DATE(CONCAT(#{endDate},' 23:59:59'),'%Y/%m/%d %H:%i:%s') ]]>
  691. group by DATE_FORMAT( a.create_date,'%w')
  692. ) tab2 on tab1.categorie = tab2.categorie
  693. </select>
  694. <!-- 月统计 -->
  695. <select id="getMonthStatistics" resultMap="chartBean" parameterType="com.shawn.model.param.StatisticsParam">
  696. select DATE_FORMAT( a.create_date,'%m月%d') as categorie,count(1) as saleNum,sum(a.price) as salePrice from t_order a
  697. where a.status='1' -- 支付成功
  698. <if test="adminId != null and adminId !=''">
  699. and a.admin_id= #{adminId} -- 所属商家id
  700. </if>
  701. <if test="equipmentId != null and equipmentId !=''">
  702. and a.equipment_id= #{equipmentId} -- 设备id
  703. </if>
  704. AND a.create_date >= STR_TO_DATE(CONCAT(#{startDate},' 00:00:00'),'%Y/%m/%d %H:%i:%s')
  705. <![CDATA[ AND a.create_date <= STR_TO_DATE(CONCAT(#{endDate},' 23:59:59'),'%Y/%m/%d %H:%i:%s') ]]>
  706. group by DATE_FORMAT( a.create_date,'%m月%d')
  707. </select>
  708. <!-- 年统计 -->
  709. <select id="getYearStatistics" resultMap="chartBean" parameterType="com.shawn.model.param.StatisticsParam">
  710. SELECT tab1.categorie,ifnull(tab2.saleNum,0) as saleNum,ifnull(tab2.salePrice,0) as salePrice from (
  711. select '01月' as categorie from dual UNION all
  712. select '02月' as categorie from dual UNION all
  713. select '03月' as categorie from dual UNION all
  714. select '04月' as categorie from dual UNION all
  715. select '05月' as categorie from dual UNION all
  716. select '06月' as categorie from dual UNION all
  717. select '07月' as categorie from dual UNION all
  718. select '08月' as categorie from dual UNION all
  719. select '09月' as categorie from dual UNION all
  720. select '10月' as categorie from dual UNION all
  721. select '11月' as categorie from dual UNION all
  722. select '12月' as categorie from dual) tab1
  723. left join (
  724. select concat(DATE_FORMAT( a.create_date,'%m'),'月') as categorie,count(1) as saleNum,sum(a.price) as salePrice from t_order a
  725. where a.status='1' -- 支付成功
  726. <if test="adminId != null and adminId !=''">
  727. and a.admin_id= #{adminId} -- 所属商家id
  728. </if>
  729. <if test="equipmentId != null and equipmentId !=''">
  730. and a.equipment_id= #{equipmentId} -- 设备id
  731. </if>
  732. AND a.create_date >= STR_TO_DATE(CONCAT(#{startDate},' 00:00:00'),'%Y/%m/%d %H:%i:%s')
  733. <![CDATA[ AND a.create_date <= STR_TO_DATE(CONCAT(#{endDate},' 23:59:59'),'%Y/%m/%d %H:%i:%s') ]]>
  734. group by DATE_FORMAT( a.create_date,'%m')
  735. ) tab2 on tab1.categorie = tab2.categorie
  736. </select>
  737. <!-- 汇总统计-->
  738. <select id="getMainStatistics" resultMap="chartBean">
  739. select 'day' as categorie, count(1) as saleNum,ifnull(sum(a.price),0) as salePrice from t_order a
  740. where date_format(a.create_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
  741. and a.status='1'
  742. <if test="adminId != null and adminId !=''">
  743. and a.admin_id= #{adminId} -- 所属商家id
  744. </if>
  745. <if test="equipmentId != null and equipmentId !=''">
  746. and a.equipment_id= #{equipmentId} -- 设备id
  747. </if>
  748. UNION all
  749. select 'week' as categorie, count(1) as saleNum,ifnull(sum(a.price),0) as salePrice from t_order a
  750. where YEARWEEK(date_format(a.create_date,'%Y-%m-%d'),1) = YEARWEEK(now(),1)
  751. and a.status='1'
  752. <if test="adminId != null and adminId !=''">
  753. and a.admin_id= #{adminId} -- 所属商家id
  754. </if>
  755. <if test="equipmentId != null and equipmentId !=''">
  756. and a.equipment_id= #{equipmentId} -- 设备id
  757. </if>
  758. UNION all
  759. select 'month' as categorie, count(1) as saleNum,ifnull(sum(a.price),0) as salePrice from t_order a
  760. where date_format(a.create_date,'%Y-%m') = date_format(now(),'%Y-%m')
  761. and a.status='1'
  762. <if test="adminId != null and adminId !=''">
  763. and a.admin_id= #{adminId} -- 所属商家id
  764. </if>
  765. <if test="equipmentId != null and equipmentId !=''">
  766. and a.equipment_id= #{equipmentId} -- 设备id
  767. </if>
  768. UNION all
  769. select 'year' as categorie, count(1) as saleNum,ifnull(sum(a.price),0) as salePrice from t_order a
  770. where date_format(a.create_date,'%Y') = date_format(now(),'%Y')
  771. and a.status='1'
  772. <if test="adminId != null and adminId !=''">
  773. and a.admin_id= #{adminId} -- 所属商家id
  774. </if>
  775. <if test="equipmentId != null and equipmentId !=''">
  776. and a.equipment_id= #{equipmentId} -- 设备id
  777. </if>
  778. </select>
  779. <!-- 统计 机器销售-->
  780. <select id="getEquipmentStatistics" resultMap="chartBean" parameterType="com.shawn.model.param.StatisticsParam">
  781. select ifnull(b.name,SUBSTRING(a.client_id,1,4)) as categorie,count(1) as saleNum,sum(a.price) as salePrice
  782. from t_order a,t_equipment b
  783. where b.id = a.equipment_id
  784. and a.admin_id= #{adminId} -- 所属商家id
  785. AND a.create_date >= STR_TO_DATE(CONCAT(#{startDate},' 00:00:00'),'%Y/%m/%d %H:%i:%s')
  786. <![CDATA[ AND a.create_date <= STR_TO_DATE(CONCAT(#{endDate},' 23:59:59'),'%Y/%m/%d %H:%i:%s') ]]>
  787. group by b.id
  788. order by saleNum desc
  789. limit 10
  790. </select>
  791. </mapper>