1
0

SalesDataUploadDao.xml 5.3 KB

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