BrandDao.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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="queryObjectByName" 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 `name` = #{brandName}
  51. </select>
  52. <select id="queryList" resultType="com.kmall.admin.entity.BrandEntity">
  53. select
  54. `id`,
  55. `name`,
  56. `list_pic_url`,
  57. `simple_desc`,
  58. `pic_url`,
  59. `sort_order`,
  60. `is_show`,
  61. `floor_price`,
  62. `app_list_pic_url`,
  63. `is_new`,
  64. `new_pic_url`,
  65. `new_sort_order`
  66. from mall_brand
  67. WHERE 1=1
  68. <if test="name != null and name.trim() != ''">
  69. AND name LIKE concat('%',#{name},'%')
  70. </if>
  71. <choose>
  72. <when test="sidx != null and sidx.trim() != ''">
  73. order by ${sidx} ${order}
  74. </when>
  75. <otherwise>
  76. order by id desc
  77. </otherwise>
  78. </choose>
  79. <if test="offset != null and limit != null">
  80. limit #{offset}, #{limit}
  81. </if>
  82. </select>
  83. <select id="queryTotal" resultType="int">
  84. select count(*) from mall_brand
  85. WHERE 1=1
  86. <if test="name != null and name.trim() != ''">
  87. AND name LIKE concat('%',#{name},'%')
  88. </if>
  89. </select>
  90. <insert id="save" parameterType="com.kmall.admin.entity.BrandEntity" useGeneratedKeys="true" keyProperty="id">
  91. insert into mall_brand(
  92. `name`,
  93. `list_pic_url`,
  94. `simple_desc`,
  95. `pic_url`,
  96. `sort_order`,
  97. `is_show`,
  98. `floor_price`,
  99. `app_list_pic_url`,
  100. `is_new`,
  101. `new_pic_url`,
  102. `new_sort_order`)
  103. values(
  104. #{name},
  105. #{listPicUrl},
  106. #{simpleDesc},
  107. #{picUrl},
  108. #{sortOrder},
  109. #{isShow},
  110. #{floorPrice},
  111. #{appListPicUrl},
  112. #{isNew},
  113. #{newPicUrl},
  114. #{newSortOrder})
  115. </insert>
  116. <update id="update" parameterType="com.kmall.admin.entity.BrandEntity">
  117. update mall_brand
  118. <set>
  119. <if test="name != null">`name` = #{name},</if>
  120. <if test="listPicUrl != null">`list_pic_url` = #{listPicUrl},</if>
  121. <if test="simpleDesc != null">`simple_desc` = #{simpleDesc},</if>
  122. <if test="picUrl != null">`pic_url` = #{picUrl},</if>
  123. <if test="sortOrder != null">`sort_order` = #{sortOrder},</if>
  124. <if test="isShow != null">`is_show` = #{isShow},</if>
  125. <if test="floorPrice != null">`floor_price` = #{floorPrice},</if>
  126. <if test="appListPicUrl != null">`app_list_pic_url` = #{appListPicUrl},</if>
  127. <if test="isNew != null">`is_new` = #{isNew},</if>
  128. <if test="newPicUrl != null">`new_pic_url` = #{newPicUrl},</if>
  129. <if test="newSortOrder != null">`new_sort_order` = #{newSortOrder}</if>
  130. </set>
  131. where id = #{id}
  132. </update>
  133. <delete id="delete">
  134. delete from mall_brand where id = #{value}
  135. </delete>
  136. <delete id="deleteBatch">
  137. delete from mall_brand where id in
  138. <foreach item="id" collection="array" open="(" separator="," close=")">
  139. #{id}
  140. </foreach>
  141. </delete>
  142. </mapper>