GoodsBatchDao.xml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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.GoodsBatchDao">
  4. <resultMap type="com.kmall.admin.entity.GoodsBatchEntity" id="goodsBatchMap">
  5. <result property="id" column="id"/>
  6. <result property="batchSn" column="batch_sn"/>
  7. <result property="sku" column="sku"/>
  8. <result property="batchExpireDate" column="batch_expire_date"/>
  9. <result property="createrSn" column="creater_sn"/>
  10. <result property="createTime" column="create_time"/>
  11. <result property="moderSn" column="moder_sn"/>
  12. <result property="modTime" column="mod_time"/>
  13. <result property="tstm" column="tstm"/>
  14. </resultMap>
  15. <select id="queryObject" resultType="com.kmall.admin.entity.GoodsBatchEntity">
  16. select
  17. `id`,
  18. `batch_sn`,
  19. `sku`,
  20. `batch_expire_date`,
  21. `creater_sn`,
  22. `create_time`,
  23. `moder_sn`,
  24. `mod_time`,
  25. `tstm`
  26. from mall_goods_batch
  27. where id = #{id}
  28. </select>
  29. <select id="queryList" resultType="com.kmall.admin.entity.GoodsBatchEntity">
  30. select
  31. `id`,
  32. `batch_sn`,
  33. `sku`,
  34. `batch_expire_date`,
  35. `creater_sn`,
  36. `create_time`,
  37. `moder_sn`,
  38. `mod_time`,
  39. `tstm`
  40. from mall_goods_batch
  41. WHERE 1=1
  42. <if test="batchSn != null and batchSn.trim() != ''">
  43. AND batch_sn LIKE concat('%',#{batchSn},'%')
  44. </if>
  45. <if test="sku != null and sku.trim() != ''">
  46. AND sku LIKE concat('%',#{sku},'%')
  47. </if>
  48. <choose>
  49. <when test="sidx != null and sidx.trim() != ''">
  50. order by ${sidx} ${order}
  51. </when>
  52. <otherwise>
  53. order by id desc
  54. </otherwise>
  55. </choose>
  56. <if test="offset != null and limit != null">
  57. limit #{offset}, #{limit}
  58. </if>
  59. </select>
  60. <select id="queryTotal" resultType="int">
  61. select count(*) from mall_goods_batch
  62. WHERE 1=1
  63. <if test="batchSn != null and batchSn.trim() != ''">
  64. AND batch_sn LIKE concat('%',#{batchSn},'%')
  65. </if>
  66. <if test="sku != null and sku.trim() != ''">
  67. AND sku LIKE concat('%',#{sku},'%')
  68. </if>
  69. </select>
  70. <select id="queryListBySku" resultType="com.kmall.admin.entity.GoodsBatchEntity">
  71. select * from mall_goods_batch where sku=#{sku}
  72. </select>
  73. <insert id="save" parameterType="com.kmall.admin.entity.GoodsBatchEntity">
  74. insert into mall_goods_batch(
  75. `id`,
  76. `batch_sn`,
  77. `sku`,
  78. `batch_expire_date`,
  79. `creater_sn`,
  80. `create_time`,
  81. `moder_sn`,
  82. `mod_time`,
  83. `tstm`)
  84. values(
  85. #{id},
  86. #{batchSn},
  87. #{sku},
  88. #{batchExpireDate},
  89. #{createrSn},
  90. #{createTime},
  91. #{moderSn},
  92. #{modTime},
  93. #{tstm})
  94. </insert>
  95. <update id="update" parameterType="com.kmall.admin.entity.GoodsBatchEntity">
  96. update mall_goods_batch
  97. <set>
  98. <if test="batchSn != null">`batch_sn` = #{batchSn}, </if>
  99. <if test="sku != null">`sku` = #{sku}, </if>
  100. <if test="batchExpireDate != null">`batch_expire_date` = #{batchExpireDate}, </if>
  101. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  102. <if test="createTime != null">`create_time` = #{createTime}, </if>
  103. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  104. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  105. <if test="tstm != null">`tstm` = #{tstm}</if>
  106. </set>
  107. where id = #{id}
  108. </update>
  109. <delete id="delete">
  110. delete from mall_goods_batch where id = #{value}
  111. </delete>
  112. <delete id="deleteBatch">
  113. delete from mall_goods_batch where id in
  114. <foreach item="id" collection="array" open="(" separator="," close=")">
  115. #{id}
  116. </foreach>
  117. </delete>
  118. </mapper>