BrandDao.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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="storeId" column="store_id"/>
  8. <result property="merchSn" column="merch_sn"/>
  9. <result property="listPicUrl" column="list_pic_url"/>
  10. <result property="simpleDesc" column="simple_desc"/>
  11. <result property="picUrl" column="pic_url"/>
  12. <result property="sortOrder" column="sort_order"/>
  13. <result property="isShow" column="is_show"/>
  14. <result property="floorPrice" column="floor_price"/>
  15. <result property="appListPicUrl" column="app_list_pic_url"/>
  16. <result property="isNew" column="is_new"/>
  17. <result property="newPicUrl" column="new_pic_url"/>
  18. <result property="newSortOrder" column="new_sort_order"/>
  19. </resultMap>
  20. <select id="queryObject" resultType="com.kmall.admin.entity.BrandEntity">
  21. select
  22. `id`,
  23. `name`,
  24. `store_id`,
  25. `merch_sn`,
  26. `list_pic_url`,
  27. `simple_desc`,
  28. `pic_url`,
  29. `sort_order`,
  30. `is_show`,
  31. `floor_price`,
  32. `app_list_pic_url`,
  33. `is_new`,
  34. `new_pic_url`,
  35. `new_sort_order`
  36. from mall_brand
  37. where id = #{id}
  38. </select>
  39. <select id="queryObjectByName" resultType="com.kmall.admin.entity.BrandEntity">
  40. select
  41. `id`,
  42. `name`,
  43. `store_id`,
  44. `merch_sn`,
  45. `list_pic_url`,
  46. `simple_desc`,
  47. `pic_url`,
  48. `sort_order`,
  49. `is_show`,
  50. `floor_price`,
  51. `app_list_pic_url`,
  52. `is_new`,
  53. `new_pic_url`,
  54. `new_sort_order`
  55. from mall_brand
  56. where `name` = #{brandName}
  57. <if test="merchSn != null and merchSn.trim() != ''">
  58. AND merch_sn = #{merchSn}
  59. </if>
  60. </select>
  61. <select id="queryList" resultType="com.kmall.admin.entity.BrandEntity">
  62. select
  63. `id`,
  64. `name`,
  65. `store_id`,
  66. `merch_sn`,
  67. `list_pic_url`,
  68. `simple_desc`,
  69. `pic_url`,
  70. `sort_order`,
  71. `is_show`,
  72. `floor_price`,
  73. `app_list_pic_url`,
  74. `is_new`,
  75. `new_pic_url`,
  76. `new_sort_order`
  77. from mall_brand
  78. WHERE 1=1
  79. <if test="storeId != null and storeId != ''">
  80. AND store_id = #{storeId}
  81. </if>
  82. <if test="merchSn != null and merchSn.trim() != ''">
  83. AND merch_sn = #{merchSn}
  84. </if>
  85. <if test="name != null and name.trim() != ''">
  86. AND name LIKE concat('%',#{name},'%')
  87. </if>
  88. <choose>
  89. <when test="sidx != null and sidx.trim() != ''">
  90. order by ${sidx} ${order}
  91. </when>
  92. <otherwise>
  93. order by id desc
  94. </otherwise>
  95. </choose>
  96. <if test="offset != null and limit != null">
  97. limit #{offset}, #{limit}
  98. </if>
  99. </select>
  100. <select id="queryTotal" resultType="int">
  101. select count(*) from mall_brand
  102. WHERE 1=1
  103. <if test="storeId != null and storeId != ''">
  104. AND store_id = #{storeId}
  105. </if>
  106. <if test="merchSn != null and merchSn.trim() != ''">
  107. AND merch_sn = #{merchSn}
  108. </if>
  109. <if test="name != null and name.trim() != ''">
  110. AND name LIKE concat('%',#{name},'%')
  111. </if>
  112. </select>
  113. <insert id="save" parameterType="com.kmall.admin.entity.BrandEntity" useGeneratedKeys="true" keyProperty="id">
  114. insert into mall_brand(
  115. `name`,
  116. `store_id`,
  117. `merch_sn`,
  118. `list_pic_url`,
  119. `simple_desc`,
  120. `pic_url`,
  121. `sort_order`,
  122. `is_show`,
  123. `floor_price`,
  124. `app_list_pic_url`,
  125. `is_new`,
  126. `new_pic_url`,
  127. `new_sort_order`)
  128. values(
  129. #{name},
  130. #{storeId},
  131. #{merchSn},
  132. #{listPicUrl},
  133. #{simpleDesc},
  134. #{picUrl},
  135. #{sortOrder},
  136. #{isShow},
  137. #{floorPrice},
  138. #{appListPicUrl},
  139. #{isNew},
  140. #{newPicUrl},
  141. #{newSortOrder})
  142. </insert>
  143. <update id="update" parameterType="com.kmall.admin.entity.BrandEntity">
  144. update mall_brand
  145. <set>
  146. <if test="name != null">`name` = #{name},</if>
  147. <if test="storeId != null">`store_id` = #{storeId}, </if>
  148. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  149. <if test="listPicUrl != null">`list_pic_url` = #{listPicUrl},</if>
  150. <if test="simpleDesc != null">`simple_desc` = #{simpleDesc},</if>
  151. <if test="picUrl != null">`pic_url` = #{picUrl},</if>
  152. <if test="sortOrder != null">`sort_order` = #{sortOrder},</if>
  153. <if test="isShow != null">`is_show` = #{isShow},</if>
  154. <if test="floorPrice != null">`floor_price` = #{floorPrice},</if>
  155. <if test="appListPicUrl != null">`app_list_pic_url` = #{appListPicUrl},</if>
  156. <if test="isNew != null">`is_new` = #{isNew},</if>
  157. <if test="newPicUrl != null">`new_pic_url` = #{newPicUrl},</if>
  158. <if test="newSortOrder != null">`new_sort_order` = #{newSortOrder}</if>
  159. </set>
  160. where id = #{id}
  161. </update>
  162. <delete id="delete">
  163. delete from mall_brand where id = #{value}
  164. </delete>
  165. <delete id="deleteBatch">
  166. delete from mall_brand where id in
  167. <foreach item="id" collection="array" open="(" separator="," close=")">
  168. #{id}
  169. </foreach>
  170. </delete>
  171. </mapper>