MerchDao.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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.MerchDao">
  4. <resultMap type="com.kmall.admin.entity.MerchEntity" id="merchMap">
  5. <result property="id" column="id"/>
  6. <result property="merchSn" column="merch_sn"/>
  7. <result property="merchName" column="merch_name"/>
  8. <result property="merchShortName" column="merch_short_name"/>
  9. <result property="merchImg" column="merch_img"/>
  10. <result property="sortOrder" column="sort_order"/>
  11. <result property="isShow" column="is_show"/>
  12. <result property="remark" column="remark"/>
  13. <result property="createrSn" column="creater_sn"/>
  14. <result property="createTime" column="create_time"/>
  15. <result property="moderSn" column="moder_sn"/>
  16. <result property="modTime" column="mod_time"/>
  17. <result property="tstm" column="tstm"/>
  18. </resultMap>
  19. <select id="queryObject" resultType="com.kmall.admin.entity.MerchEntity">
  20. select
  21. `id`,
  22. `merch_sn`,
  23. `merch_name`,
  24. `merch_short_name`,
  25. `merch_img`,
  26. `sort_order`,
  27. `is_show`,
  28. `remark`,
  29. `creater_sn`,
  30. `create_time`,
  31. `moder_sn`,
  32. `mod_time`,
  33. `tstm`,
  34. `is_show` as `show`
  35. from mall_merch
  36. where id = #{id}
  37. </select>
  38. <select id="findByMerchSn" resultType="com.kmall.admin.entity.MerchEntity">
  39. select
  40. `id`,
  41. `merch_sn`,
  42. `merch_name`,
  43. `merch_short_name`,
  44. `merch_img`,
  45. `sort_order`,
  46. `is_show`,
  47. `remark`,
  48. `creater_sn`,
  49. `create_time`,
  50. `moder_sn`,
  51. `mod_time`,
  52. `tstm`,
  53. `is_show` as `show`
  54. from mall_merch
  55. where merch_sn = #{merchSn}
  56. </select>
  57. <select id="queryList" resultType="com.kmall.admin.entity.MerchEntity">
  58. select
  59. `id`,
  60. `merch_sn`,
  61. `merch_name`,
  62. `merch_short_name`,
  63. `merch_img`,
  64. `sort_order`,
  65. `is_show`,
  66. `remark`,
  67. `creater_sn`,
  68. `create_time`,
  69. `moder_sn`,
  70. `mod_time`,
  71. `tstm`,
  72. `is_show` as `show`
  73. from mall_merch
  74. WHERE 1=1
  75. <if test="merchName != null and merchName.trim() != ''">
  76. AND merch_name LIKE concat('%',#{merchName},'%')
  77. </if>
  78. <if test="merchSn != null and merchSn.trim() != ''">
  79. AND merch_sn LIKE concat('%',#{merchSn},'%')
  80. </if>
  81. <choose>
  82. <when test="sidx != null and sidx.trim() != ''">
  83. order by ${sidx} ${order}
  84. </when>
  85. <otherwise>
  86. order by id desc
  87. </otherwise>
  88. </choose>
  89. <if test="offset != null and limit != null">
  90. limit #{offset}, #{limit}
  91. </if>
  92. </select>
  93. <select id="queryTotal" resultType="int">
  94. select count(*) from mall_merch
  95. WHERE 1=1
  96. <if test="merchName != null and merchName.trim() != ''">
  97. AND merch_name LIKE concat('%',#{merchName},'%')
  98. </if>
  99. <if test="merchSn != null and merchSn.trim() != ''">
  100. AND merch_sn LIKE concat('%',#{merchSn},'%')
  101. </if>
  102. </select>
  103. <insert id="save" parameterType="com.kmall.admin.entity.MerchEntity" useGeneratedKeys="true" keyProperty="id">
  104. insert into mall_merch(
  105. `merch_sn`,
  106. `merch_name`,
  107. `merch_short_name`,
  108. `merch_img`,
  109. `sort_order`,
  110. `is_show`,
  111. `remark`,
  112. `creater_sn`,
  113. `create_time`,
  114. `moder_sn`,
  115. `mod_time`,
  116. `tstm`)
  117. values(
  118. #{merchSn},
  119. #{merchName},
  120. #{merchShortName},
  121. #{merchImg},
  122. #{sortOrder},
  123. #{isShow},
  124. #{remark},
  125. #{createrSn},
  126. #{createTime},
  127. #{moderSn},
  128. #{modTime},
  129. #{tstm})
  130. </insert>
  131. <update id="update" parameterType="com.kmall.admin.entity.MerchEntity">
  132. update mall_merch
  133. <set>
  134. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  135. <if test="merchName != null">`merch_name` = #{merchName}, </if>
  136. <if test="merchShortName != null">`merch_short_name` = #{merchShortName}, </if>
  137. <if test="merchImg != null">`merch_img` = #{merchImg}, </if>
  138. <if test="sortOrder != null">`sort_order` = #{sortOrder}, </if>
  139. <if test="isShow != null">`is_show` = #{isShow}, </if>
  140. <if test="remark != null">`remark` = #{remark}, </if>
  141. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  142. <if test="createTime != null">`create_time` = #{createTime}, </if>
  143. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  144. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  145. <if test="tstm != null">`tstm` = #{tstm}</if>
  146. </set>
  147. where id = #{id}
  148. </update>
  149. <delete id="delete">
  150. delete from mall_merch where id = #{value}
  151. </delete>
  152. <delete id="deleteBatch">
  153. delete from mall_merch where id in
  154. <foreach item="id" collection="array" open="(" separator="," close=")">
  155. #{id}
  156. </foreach>
  157. </delete>
  158. </mapper>