SupplierDao.xml 3.1 KB

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