SalesDataUploadDao.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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.kmall.admin.dao.SalesDataUploadDao">
  4. <resultMap type="com.kmall.admin.entity.SalesDataUploadEntity" id="salesDataUploadMap">
  5. <result property="fileId" column="file_id"/>
  6. <result property="fileName" column="file_name"/>
  7. <result property="fileType" column="file_type"/>
  8. <result property="uploadAddress" column="upload_address"/>
  9. <result property="createrSn" column="creater_sn"/>
  10. <result property="createrTime" column="creater_time"/>
  11. <result property="billTime" column="bill_time"/>
  12. <result property="checkTime" column="check_time"/>
  13. <result property="merchSN" column="merch_sn"/>
  14. <result property="shopSN" column="shop_sn"/>
  15. <result property="thirdMerchSN" column="third_merch_sn"/>
  16. </resultMap>
  17. <select id="queryObject" resultType="com.kmall.admin.entity.SalesDataUploadEntity">
  18. select
  19. u.file_id,
  20. u.file_name,
  21. u.file_type,
  22. u.upload_address,
  23. u.creater_sn,
  24. u.creater_time,
  25. su.username
  26. from mall_sales_data_upload u
  27. left join sys_user su
  28. on su.user_id = u.creater_sn
  29. where file_id = #{id}
  30. </select>
  31. <select id="queryList" resultType="com.kmall.admin.entity.SalesDataUploadEntity">
  32. select
  33. u.file_id,
  34. u.file_name,
  35. u.file_type,
  36. u.upload_address,
  37. u.creater_sn,
  38. u.creater_time,
  39. u.bill_time,
  40. u.check_time,
  41. u.merch_sn,
  42. u.third_merch_sn,
  43. u.shop_sn,
  44. ms.store_name shopName,
  45. su.username
  46. from mall_sales_data_upload u
  47. left join sys_user su
  48. on su.user_id = u.creater_sn
  49. left join mall_store ms
  50. on u.shop_sn = ms.id
  51. WHERE 1=1
  52. <if test="name != null and name.trim() != ''">
  53. AND u.file_name LIKE concat('%',#{name},'%')
  54. </if>
  55. <if test="startTime != null and startTime.trim() != ''">
  56. AND u.creater_time >= #{startTime}
  57. </if>
  58. <if test="endTime != null and endTime.trim() != ''">
  59. AND u.creater_time &lt;= #{endTime}
  60. </if>
  61. <if test="merchSN != null and merchSN.trim() != ''">
  62. AND u.merch_sn = #{merchSN}
  63. </if>
  64. <if test="thirdMerchSN != null and thirdMerchSN.trim() != ''">
  65. AND u.third_merch_sn = #{thirdMerchSN}
  66. </if>
  67. <if test="shopSN != null and shopSN.trim() != ''">
  68. AND u.shop_sn = #{shopSN}
  69. </if>
  70. <choose>
  71. <when test="sidx != null and sidx.trim() != ''">
  72. order by ${sidx} ${order}
  73. </when>
  74. <otherwise>
  75. order by bill_time DESC, file_id desc
  76. </otherwise>
  77. </choose>
  78. <if test="offset != null and limit != null">
  79. limit #{offset}, #{limit}
  80. </if>
  81. </select>
  82. <select id="queryTotal" resultType="int">
  83. select count(*) from mall_sales_data_upload
  84. WHERE 1=1
  85. <if test="name != null and name.trim() != ''">
  86. AND file_name LIKE concat('%',#{name},'%')
  87. </if>
  88. <if test="startTime != null and startTime.trim() != ''">
  89. AND creater_time >= #{startTime}
  90. </if>
  91. <if test="endTime != null and endTime.trim() != ''">
  92. AND creater_time &lt;= #{endTime}
  93. </if>
  94. <if test="merchSN != null and merchSN.trim() != ''">
  95. AND merch_sn = #{merchSN}
  96. </if>
  97. <if test="thirdMerchSN != null and thirdMerchSN.trim() != ''">
  98. AND third_merch_sn = #{thirdMerchSN}
  99. </if>
  100. <if test="shopSN != null and shopSN.trim() != ''">
  101. AND shop_sn = #{shopSN}
  102. </if>
  103. </select>
  104. <select id="queryObjects" resultType="com.kmall.admin.entity.SalesDataUploadEntity">
  105. select
  106. file_id,
  107. file_name,
  108. file_type,
  109. upload_address,
  110. creater_sn,
  111. creater_time,
  112. bill_time,
  113. check_time,
  114. merch_sn,
  115. third_merch_sn,
  116. shop_sn
  117. from mall_sales_data_upload
  118. where file_id in
  119. <foreach item="fileId" collection="array" open="(" separator="," close=")">
  120. #{fileId}
  121. </foreach>
  122. </select>
  123. <insert id="save" parameterType="com.kmall.admin.entity.SalesDataUploadEntity" useGeneratedKeys="true" keyProperty="fileId">
  124. insert into mall_sales_data_upload(
  125. `file_name`,
  126. `file_type`,
  127. `upload_address`,
  128. `creater_sn`,
  129. `creater_time`,
  130. `bill_time`,
  131. `check_time`,
  132. `merch_sn`,
  133. `third_merch_sn`,
  134. `shop_sn`)
  135. values(
  136. #{fileName},
  137. #{fileType},
  138. #{uploadAddress},
  139. #{createrSn},
  140. #{createrTime},
  141. #{billTime},
  142. #{checkTime},
  143. #{merchSN},
  144. #{thirdMerchSN},
  145. #{shopSN})
  146. </insert>
  147. <insert id="saveSalesDownload" parameterType="com.kmall.admin.entity.SalesDataDownloadEntity" useGeneratedKeys="true" keyProperty="id">
  148. insert into mall_sales_data_download(
  149. `file_id`,
  150. `download_ip`,
  151. `download_sn`,
  152. `download_time`)
  153. values(
  154. #{fileId},
  155. #{downloadIP},
  156. #{downloadSn},
  157. #{downloadTime})
  158. </insert>
  159. <update id="update" parameterType="com.kmall.admin.entity.SalesDataUploadEntity">
  160. update mall_sales_data_upload
  161. <set>
  162. <if test="fileName != null">`file_name` = #{fileName}, </if>
  163. <if test="fileType != null">`file_type` = #{fileType}, </if>
  164. <if test="uploadAddress != null">`upload_address` = #{uploadAddress}, </if>
  165. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  166. <if test="createrTime != null">`creater_time` = #{createrTime}</if>
  167. </set>
  168. where file_id = #{fileId}
  169. </update>
  170. <delete id="delete">
  171. delete from mall_sales_data_upload where file_id = #{value}
  172. </delete>
  173. <delete id="deleteBatch">
  174. delete from mall_sales_data_upload where file_id in
  175. <foreach item="fileId" collection="array" open="(" separator="," close=")">
  176. #{fileId}
  177. </foreach>
  178. </delete>
  179. </mapper>