SupplierDao.xml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. </resultMap>
  13. <select id="queryObject" resultType="com.kmall.admin.entity.SupplierEntity">
  14. select
  15. `id`,
  16. `level_merch_sn`,
  17. `level_merch_flag`,
  18. `child_supplier_name`,
  19. `child_supplier_flag`,
  20. `sort_order`,
  21. `is_show`
  22. from mall_supplier
  23. where id = #{id}
  24. </select>
  25. <select id="queryObjectByName" resultType="com.kmall.admin.entity.SupplierEntity">
  26. select
  27. `id`,
  28. `level_merch_sn`,
  29. `level_merch_flag`,
  30. `child_supplier_name`,
  31. `child_supplier_flag`,
  32. `sort_order`,
  33. `is_show`
  34. from mall_supplier
  35. where child_supplier_name = #{supplierName}
  36. <if test="merchSn != null and merchSn.trim() != ''">
  37. AND level_merch_sn = #{merchSn}
  38. </if>
  39. </select>
  40. <select id="queryList" resultType="com.kmall.admin.entity.SupplierEntity">
  41. select
  42. `id`,
  43. `level_merch_sn`,
  44. `level_merch_flag`,
  45. `child_supplier_name`,
  46. `child_supplier_flag`,
  47. `sort_order`,
  48. `is_show`
  49. from mall_supplier
  50. WHERE 1=1
  51. <if test="merchSn != null and merchSn.trim() != ''">
  52. AND level_merch_sn = #{merchSn}
  53. </if>
  54. <choose>
  55. <when test="sidx != null and sidx.trim() != ''">
  56. order by ${sidx} ${order}
  57. </when>
  58. <otherwise>
  59. order by id desc
  60. </otherwise>
  61. </choose>
  62. <if test="offset != null and limit != null">
  63. limit #{offset}, #{limit}
  64. </if>
  65. </select>
  66. <select id="queryTotal" resultType="int">
  67. select count(*) from mall_supplier
  68. WHERE 1=1
  69. <if test="merchSn != null and merchSn.trim() != ''">
  70. AND level_merch_sn = #{merchSn}
  71. </if>
  72. </select>
  73. <insert id="save" parameterType="com.kmall.admin.entity.SupplierEntity">
  74. insert into mall_supplier(
  75. `level_merch_sn`,
  76. `level_merch_flag`,
  77. `child_supplier_name`,
  78. `child_supplier_flag`,
  79. `sort_order`,
  80. `is_show`)
  81. values(
  82. #{levelMerchSn},
  83. #{levelMerchFlag},
  84. #{childSupplierName},
  85. #{childSupplierFlag},
  86. #{sortOrder},
  87. #{isShow})
  88. </insert>
  89. <update id="update" parameterType="com.kmall.admin.entity.SupplierEntity">
  90. update mall_supplier
  91. <set>
  92. <if test="levelMerchSn != null">`level_merch_sn` = #{levelMerchSn}, </if>
  93. <if test="levelMerchFlag != null">`level_merch_flag` = #{levelMerchFlag}, </if>
  94. <if test="childSupplierName != null">`child_supplier_name` = #{childSupplierName}, </if>
  95. <if test="childSupplierFlag != null">`child_supplier_flag` = #{childSupplierFlag}, </if>
  96. <if test="sortOrder != null">`sort_order` = #{sortOrder}, </if>
  97. <if test="isShow != null">`is_show` = #{isShow}</if>
  98. </set>
  99. where id = #{id}
  100. </update>
  101. <delete id="delete">
  102. delete from mall_supplier where id = #{value}
  103. </delete>
  104. <delete id="deleteBatch">
  105. delete from mall_supplier where id in
  106. <foreach item="id" collection="array" open="(" separator="," close=")">
  107. #{id}
  108. </foreach>
  109. </delete>
  110. </mapper>