BrandDao.xml 5.4 KB

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