SupplierDao.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. `id`,
  49. `level_merch_sn`,
  50. `level_merch_flag`,
  51. `child_supplier_name`,
  52. `child_supplier_flag`,
  53. `sort_order`,
  54. `is_show`,third_party_merch_code
  55. from mall_supplier
  56. WHERE 1=1
  57. <if test="name != null and name.trim() != ''">
  58. AND child_supplier_name like concat('%',#{name},'%')
  59. </if>
  60. <if test="merchSn != null and merchSn.trim() != ''">
  61. AND level_merch_sn = #{merchSn}
  62. </if>
  63. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  64. AND third_party_merch_code = #{thirdPartyMerchCode}
  65. </if>
  66. <choose>
  67. <when test="sidx != null and sidx.trim() != ''">
  68. order by ${sidx} ${order}
  69. </when>
  70. <otherwise>
  71. order by id desc
  72. </otherwise>
  73. </choose>
  74. <if test="offset != null and limit != null">
  75. limit #{offset}, #{limit}
  76. </if>
  77. </select>
  78. <select id="queryTotal" resultType="int">
  79. select count(*) from mall_supplier
  80. WHERE 1=1
  81. <if test="name != null and name.trim() != ''">
  82. AND child_supplier_name like concat('%',#{name},'%')
  83. </if>
  84. <if test="merchSn != null and merchSn.trim() != ''">
  85. AND level_merch_sn = #{merchSn}
  86. </if>
  87. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  88. AND third_party_merch_code = #{thirdPartyMerchCode}
  89. </if>
  90. </select>
  91. <insert id="save" parameterType="com.kmall.admin.entity.SupplierEntity">
  92. insert into mall_supplier(
  93. `level_merch_sn`,
  94. `level_merch_flag`,
  95. `child_supplier_name`,
  96. `child_supplier_flag`,
  97. `sort_order`,
  98. `is_show`,third_party_merch_code)
  99. values(
  100. #{levelMerchSn},
  101. #{levelMerchFlag},
  102. #{childSupplierName},
  103. #{childSupplierFlag},
  104. #{sortOrder},
  105. #{isShow},#{thirdPartyMerchCode})
  106. </insert>
  107. <update id="update" parameterType="com.kmall.admin.entity.SupplierEntity">
  108. update mall_supplier
  109. <set>
  110. <if test="levelMerchSn != null">`level_merch_sn` = #{levelMerchSn}, </if>
  111. <if test="levelMerchFlag != null">`level_merch_flag` = #{levelMerchFlag}, </if>
  112. <if test="childSupplierName != null">`child_supplier_name` = #{childSupplierName}, </if>
  113. <if test="childSupplierFlag != null">`child_supplier_flag` = #{childSupplierFlag}, </if>
  114. <if test="sortOrder != null">`sort_order` = #{sortOrder}, </if>
  115. <if test="isShow != null">`is_show` = #{isShow},</if>
  116. <if test="thirdPartyMerchCode != null">`third_party_merch_code` = #{thirdPartyMerchCode}</if>
  117. </set>
  118. where id = #{id}
  119. </update>
  120. <delete id="delete">
  121. delete from mall_supplier where id = #{value}
  122. </delete>
  123. <delete id="deleteBatch">
  124. delete from mall_supplier where id in
  125. <foreach item="id" collection="array" open="(" separator="," close=")">
  126. #{id}
  127. </foreach>
  128. </delete>
  129. </mapper>