BrandDao.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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.BrandDao">
  4. <resultMap type="com.kmall.admin.entity.BrandEntity" id="brandMap">
  5. <result property="id" column="id"/>
  6. <result property="name" column="name"/>
  7. <result property="listPicUrl" column="list_pic_url"/>
  8. <result property="simpleDesc" column="simple_desc"/>
  9. <result property="picUrl" column="pic_url"/>
  10. <result property="sortOrder" column="sort_order"/>
  11. <result property="isShow" column="is_show"/>
  12. <result property="floorPrice" column="floor_price"/>
  13. <result property="appListPicUrl" column="app_list_pic_url"/>
  14. <result property="isNew" column="is_new"/>
  15. <result property="newPicUrl" column="new_pic_url"/>
  16. <result property="newSortOrder" column="new_sort_order"/>
  17. </resultMap>
  18. <select id="queryObject" resultType="com.kmall.admin.entity.BrandEntity">
  19. select
  20. `id`,
  21. `name`,
  22. `list_pic_url`,
  23. `simple_desc`,
  24. `pic_url`,
  25. `sort_order`,
  26. `is_show`,
  27. `floor_price`,
  28. `app_list_pic_url`,
  29. `is_new`,
  30. `new_pic_url`,
  31. `new_sort_order`
  32. from mall_brand
  33. where id = #{id}
  34. </select>
  35. <select id="queryList" resultType="com.kmall.admin.entity.BrandEntity">
  36. select
  37. `id`,
  38. `name`,
  39. `list_pic_url`,
  40. `simple_desc`,
  41. `pic_url`,
  42. `sort_order`,
  43. `is_show`,
  44. `floor_price`,
  45. `app_list_pic_url`,
  46. `is_new`,
  47. `new_pic_url`,
  48. `new_sort_order`
  49. from mall_brand
  50. WHERE 1=1
  51. <if test="name != null and name.trim() != ''">
  52. AND name LIKE concat('%',#{name},'%')
  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_brand
  68. WHERE 1=1
  69. <if test="name != null and name.trim() != ''">
  70. AND name LIKE concat('%',#{name},'%')
  71. </if>
  72. </select>
  73. <insert id="save" parameterType="com.kmall.admin.entity.BrandEntity" useGeneratedKeys="true" keyProperty="id">
  74. insert into mall_brand(
  75. `name`,
  76. `list_pic_url`,
  77. `simple_desc`,
  78. `pic_url`,
  79. `sort_order`,
  80. `is_show`,
  81. `floor_price`,
  82. `app_list_pic_url`,
  83. `is_new`,
  84. `new_pic_url`,
  85. `new_sort_order`)
  86. values(
  87. #{name},
  88. #{listPicUrl},
  89. #{simpleDesc},
  90. #{picUrl},
  91. #{sortOrder},
  92. #{isShow},
  93. #{floorPrice},
  94. #{appListPicUrl},
  95. #{isNew},
  96. #{newPicUrl},
  97. #{newSortOrder})
  98. </insert>
  99. <update id="update" parameterType="com.kmall.admin.entity.BrandEntity">
  100. update mall_brand
  101. <set>
  102. <if test="name != null">`name` = #{name},</if>
  103. <if test="listPicUrl != null">`list_pic_url` = #{listPicUrl},</if>
  104. <if test="simpleDesc != null">`simple_desc` = #{simpleDesc},</if>
  105. <if test="picUrl != null">`pic_url` = #{picUrl},</if>
  106. <if test="sortOrder != null">`sort_order` = #{sortOrder},</if>
  107. <if test="isShow != null">`is_show` = #{isShow},</if>
  108. <if test="floorPrice != null">`floor_price` = #{floorPrice},</if>
  109. <if test="appListPicUrl != null">`app_list_pic_url` = #{appListPicUrl},</if>
  110. <if test="isNew != null">`is_new` = #{isNew},</if>
  111. <if test="newPicUrl != null">`new_pic_url` = #{newPicUrl},</if>
  112. <if test="newSortOrder != null">`new_sort_order` = #{newSortOrder}</if>
  113. </set>
  114. where id = #{id}
  115. </update>
  116. <delete id="delete">
  117. delete from mall_brand where id = #{value}
  118. </delete>
  119. <delete id="deleteBatch">
  120. delete from mall_brand where id in
  121. <foreach item="id" collection="array" open="(" separator="," close=")">
  122. #{id}
  123. </foreach>
  124. </delete>
  125. </mapper>