StockChangeDao.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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.haikong.StockChangeDao">
  4. <resultMap type="com.kmall.admin.entity.haikong.StockChangeEntity" id="stockChangeMap">
  5. <result property="id" column="id"/>
  6. <result property="type" column="type"/>
  7. <result property="time" column="time"/>
  8. <result property="merchSn" column="merch_sn"/>
  9. <result property="merch" column="merch"/>
  10. <result property="storeId" column="store_id"/>
  11. <result property="store" column="store"/>
  12. <result property="thirdMerchSn" column="third_merch_sn"/>
  13. <result property="audit" column="audit"/>
  14. <result property="thirdMerch" column="third_merch"/>
  15. <result property="remark" column="remark"/>
  16. <result property="createBy" column="create_by"/>
  17. <result property="createTime" column="create_time"/>
  18. <result property="modifyBy" column="modify_by"/>
  19. <result property="modifyTime" column="modify_time"/>
  20. <result property="auditBy" column="audit_by"/>
  21. <result property="auditTime" column="audit_time"/>
  22. </resultMap>
  23. <select id="queryObject" resultType="com.kmall.admin.entity.haikong.StockChangeEntity">
  24. select
  25. `id`,
  26. `type`,
  27. `time`,
  28. `merch_sn`,
  29. `merch`,
  30. `store_id`,
  31. `store`,
  32. `third_merch_sn`,
  33. `audit`,
  34. `third_merch`,
  35. `remark`,
  36. `create_by`,
  37. `create_time`,
  38. `modify_by`,
  39. `modify_time`,
  40. `audit_by`,
  41. `audit_time`
  42. from mall_stock_change
  43. where id = #{id}
  44. </select>
  45. <select id="queryList" resultType="com.kmall.admin.entity.haikong.StockChangeEntity">
  46. select
  47. c.`id`,
  48. c.`type`,
  49. c.`time`,
  50. c.`merch_sn`,
  51. c.`merch`,
  52. c.`store_id`,
  53. c.`store`,
  54. c.`third_merch_sn`,
  55. c.`audit`,
  56. c.`third_merch`,
  57. c.`remark`,
  58. c.`create_by`,
  59. c.`create_time`,
  60. c.`modify_by`,
  61. c.`modify_time`,
  62. c.`audit_by`,
  63. c.`audit_time`,
  64. r.product,
  65. r.specification
  66. from mall_stock_change c
  67. left join mall_stock_change_record r
  68. on c.id =r.parent_id
  69. WHERE 1=1
  70. <if test="name != null and name.trim() != ''">
  71. AND c.name LIKE concat('%',#{name},'%')
  72. </if>
  73. <if test="orderId != null and orderId.trim() != ''">
  74. AND c.id = #{orderId}
  75. </if>
  76. <if test="type != null and type.trim() != ''">
  77. AND c.type = #{type}
  78. </if>
  79. <if test="time != null and time.trim() != ''">
  80. AND c.time &gt; #{time}
  81. </if>
  82. <if test="audit != null and audit.trim() != ''">
  83. AND c.audit = #{audit}
  84. </if>
  85. <if test="storeId != null and storeId.trim() != ''">
  86. AND c.store_id = #{storeId}
  87. </if>
  88. <choose>
  89. <when test="sidx != null and sidx.trim() != ''">
  90. order by ${sidx} ${order}
  91. </when>
  92. <otherwise>
  93. order by c.id desc
  94. </otherwise>
  95. </choose>
  96. <if test="offset != null and limit != null">
  97. limit #{offset}, #{limit}
  98. </if>
  99. </select>
  100. <select id="queryTotal" resultType="int">
  101. select count(*) from mall_stock_change
  102. WHERE 1=1
  103. <if test="name != null and name.trim() != ''">
  104. AND name LIKE concat('%',#{name},'%')
  105. </if>
  106. </select>
  107. <select id="queryListByIds" resultType="com.kmall.admin.entity.haikong.StockChangeEntity">
  108. select * from mall_stock_change
  109. where id in
  110. <foreach item="id" collection="array" open="(" separator="," close=")">
  111. #{id}
  112. </foreach>
  113. </select>
  114. <insert id="save" parameterType="com.kmall.admin.entity.haikong.StockChangeEntity">
  115. insert into mall_stock_change(
  116. `id`,
  117. `type`,
  118. `time`,
  119. `merch_sn`,
  120. `merch`,
  121. `store_id`,
  122. `store`,
  123. `third_merch_sn`,
  124. `audit`,
  125. `third_merch`,
  126. `remark`,
  127. `create_by`,
  128. `create_time`,
  129. `modify_by`,
  130. `modify_time`,
  131. `audit_by`,
  132. `audit_time`)
  133. values(
  134. #{id},
  135. #{type},
  136. #{time},
  137. #{merchSn},
  138. #{merch},
  139. #{storeId},
  140. #{store},
  141. #{thirdMerchSn},
  142. #{audit},
  143. #{thirdMerch},
  144. #{remark},
  145. #{createBy},
  146. #{createTime},
  147. #{modifyBy},
  148. #{modifyTime},
  149. #{auditBy},
  150. #{auditTime})
  151. </insert>
  152. <update id="update" parameterType="com.kmall.admin.entity.haikong.StockChangeEntity">
  153. update mall_stock_change
  154. <set>
  155. <if test="type != null">`type` = #{type}, </if>
  156. <if test="time != null">`time` = #{time}, </if>
  157. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  158. <if test="merch != null">`merch` = #{merch}, </if>
  159. <if test="storeId != null">`store_id` = #{storeId}, </if>
  160. <if test="store != null">`store` = #{store}, </if>
  161. <if test="thirdMerchSn != null">`third_merch_sn` = #{thirdMerchSn}, </if>
  162. <if test="audit != null">`audit` = #{audit}, </if>
  163. <if test="thirdMerch != null">`third_merch` = #{thirdMerch}, </if>
  164. <if test="remark != null">`remark` = #{remark}, </if>
  165. <if test="createBy != null">`create_by` = #{createBy}, </if>
  166. <if test="createTime != null">`create_time` = #{createTime}, </if>
  167. <if test="modifyBy != null">`modify_by` = #{modifyBy}, </if>
  168. <if test="modifyTime != null">`modify_time` = #{modifyTime}, </if>
  169. <if test="auditBy != null">`audit_by` = #{auditBy}, </if>
  170. <if test="auditTime != null">`audit_time` = #{auditTime}</if>
  171. </set>
  172. where id = #{id}
  173. </update>
  174. <update id="updateAuditStatus" >
  175. update mall_stock_change set audit = #{map.type},audit_by =#{map.auditBy},audit_time=#{map.auditTime}
  176. where id in
  177. <foreach collection="ids" item="ids" open="(" separator="," close=")">
  178. #{ids}
  179. </foreach>
  180. </update>
  181. <delete id="delete">
  182. delete from mall_stock_change where id = #{value}
  183. </delete>
  184. <delete id="deleteBatch">
  185. delete from mall_stock_change where id in
  186. <foreach item="id" collection="array" open="(" separator="," close=")">
  187. #{id}
  188. </foreach>
  189. </delete>
  190. </mapper>