1
0

SupplierDao.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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.SupplierDao">
  4. <resultMap type="com.kmall.admin.entity.SupplierEntity" id="supplierMap">
  5. <result property="id" column="id"/>
  6. <result property="levelMerchSn" column="level_merch_sn"/>
  7. <result property="levelMerchFlag" column="level_merch_flag"/>
  8. <result property="childSupplierName" column="child_supplier_name"/>
  9. <result property="childSupplierFlag" column="child_supplier_flag"/>
  10. <result property="sortOrder" column="sort_order"/>
  11. <result property="isShow" column="is_show"/>
  12. <result property="thirdPartyMerchCode" column="third_party_merch_code"/>
  13. </resultMap>
  14. <select id="queryObject" resultType="com.kmall.admin.entity.SupplierEntity">
  15. select
  16. `id`,
  17. `level_merch_sn`,
  18. `level_merch_flag`,
  19. `child_supplier_name`,
  20. `child_supplier_flag`,
  21. `sort_order`,
  22. `is_show`,
  23. third_party_merch_code
  24. from mall_supplier
  25. where id = #{id}
  26. </select>
  27. <select id="queryObjectByName" resultType="com.kmall.admin.entity.SupplierEntity">
  28. select
  29. `id`,
  30. `level_merch_sn`,
  31. `level_merch_flag`,
  32. `child_supplier_name`,
  33. `child_supplier_flag`,
  34. `sort_order`,
  35. `is_show`,
  36. third_party_merch_code
  37. from mall_supplier
  38. where child_supplier_name = #{supplierName}
  39. <if test="merchSn != null and merchSn.trim() != ''">
  40. AND level_merch_sn = #{merchSn}
  41. </if>
  42. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  43. AND third_party_merch_code = #{thirdPartyMerchCode}
  44. </if>
  45. </select>
  46. <select id="queryList" resultType="com.kmall.admin.entity.SupplierEntity">
  47. select
  48. s.`id`,
  49. s.`level_merch_sn`,
  50. s.`level_merch_flag`,
  51. s.`child_supplier_name`,
  52. s.`child_supplier_flag`,
  53. s.`sort_order`,
  54. s.`is_show`,s.third_party_merch_code
  55. from mall_supplier s left join third_merchant_biz t on s.third_party_merch_code = t.third_party_merch_code
  56. WHERE 1=1
  57. <if test="name != null and name.trim() != ''">
  58. AND s.child_supplier_name like concat('%',#{name},'%')
  59. </if>
  60. <if test="merchSn != null and merchSn.trim() != ''">
  61. AND s.level_merch_sn = #{merchSn}
  62. </if>
  63. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  64. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  65. </if>
  66. <if test="thirdMerchSn != null and thirdMerchSn.trim() != ''">
  67. AND t.third_merch_sn = #{thirdMerchSn}
  68. </if>
  69. <if test="supplierId != null and supplierId != ''">
  70. AND s.id = #{supplierId}
  71. </if>
  72. <choose>
  73. <when test="sidx != null and sidx.trim() != ''">
  74. order by ${sidx} ${order}
  75. </when>
  76. <otherwise>
  77. order by s.id desc
  78. </otherwise>
  79. </choose>
  80. <if test="offset != null and limit != null">
  81. limit #{offset}, #{limit}
  82. </if>
  83. </select>
  84. <select id="queryTotal" resultType="int">
  85. select count(*) from mall_supplier
  86. WHERE 1=1
  87. <if test="name != null and name.trim() != ''">
  88. AND child_supplier_name like concat('%',#{name},'%')
  89. </if>
  90. <if test="merchSn != null and merchSn.trim() != ''">
  91. AND level_merch_sn = #{merchSn}
  92. </if>
  93. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  94. AND third_party_merch_code = #{thirdPartyMerchCode}
  95. </if>
  96. </select>
  97. <insert id="save" parameterType="com.kmall.admin.entity.SupplierEntity">
  98. insert into mall_supplier(
  99. `level_merch_sn`,
  100. `level_merch_flag`,
  101. `child_supplier_name`,
  102. `child_supplier_flag`,
  103. `sort_order`,
  104. `is_show`,third_party_merch_code)
  105. values(
  106. #{levelMerchSn},
  107. #{levelMerchFlag},
  108. #{childSupplierName},
  109. #{childSupplierFlag},
  110. #{sortOrder},
  111. #{isShow},#{thirdPartyMerchCode})
  112. </insert>
  113. <update id="update" parameterType="com.kmall.admin.entity.SupplierEntity">
  114. update mall_supplier
  115. <set>
  116. <if test="levelMerchSn != null">`level_merch_sn` = #{levelMerchSn}, </if>
  117. <if test="levelMerchFlag != null">`level_merch_flag` = #{levelMerchFlag}, </if>
  118. <if test="childSupplierName != null">`child_supplier_name` = #{childSupplierName}, </if>
  119. <if test="childSupplierFlag != null">`child_supplier_flag` = #{childSupplierFlag}, </if>
  120. <if test="sortOrder != null">`sort_order` = #{sortOrder}, </if>
  121. <if test="isShow != null">`is_show` = #{isShow},</if>
  122. <if test="thirdPartyMerchCode != null">`third_party_merch_code` = #{thirdPartyMerchCode}</if>
  123. </set>
  124. where id = #{id}
  125. </update>
  126. <delete id="delete">
  127. delete from mall_supplier where id = #{value}
  128. </delete>
  129. <delete id="deleteBatch">
  130. delete from mall_supplier where id in
  131. <foreach item="id" collection="array" open="(" separator="," close=")">
  132. #{id}
  133. </foreach>
  134. </delete>
  135. </mapper>