MerchDao.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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="queryList" 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 1=1
  56. <if test="merchName != null and merchName.trim() != ''">
  57. AND merch_name LIKE concat('%',#{merchName},'%')
  58. </if>
  59. <if test="merchSn != null and merchSn.trim() != ''">
  60. AND merch_sn LIKE concat('%',#{merchSn},'%')
  61. </if>
  62. <choose>
  63. <when test="sidx != null and sidx.trim() != ''">
  64. order by ${sidx} ${order}
  65. </when>
  66. <otherwise>
  67. order by id desc
  68. </otherwise>
  69. </choose>
  70. <if test="offset != null and limit != null">
  71. limit #{offset}, #{limit}
  72. </if>
  73. </select>
  74. <select id="queryTotal" resultType="int">
  75. select count(*) from mall_merch
  76. WHERE 1=1
  77. <if test="merchName != null and merchName.trim() != ''">
  78. AND merch_name LIKE concat('%',#{merchName},'%')
  79. </if>
  80. <if test="merchSn != null and merchSn.trim() != ''">
  81. AND merch_sn LIKE concat('%',#{merchSn},'%')
  82. </if>
  83. </select>
  84. <insert id="save" parameterType="com.kmall.admin.entity.MerchEntity" useGeneratedKeys="true" keyProperty="id">
  85. insert into mall_merch(
  86. `merch_sn`,
  87. `merch_name`,
  88. `merch_short_name`,
  89. `merch_img`,
  90. `sort_order`,
  91. `is_show`,
  92. `remark`,
  93. `creater_sn`,
  94. `create_time`,
  95. `moder_sn`,
  96. `mod_time`,
  97. `tstm`)
  98. values(
  99. #{merchSn},
  100. #{merchName},
  101. #{merchShortName},
  102. #{merchImg},
  103. #{sortOrder},
  104. #{isShow},
  105. #{remark},
  106. #{createrSn},
  107. #{createTime},
  108. #{moderSn},
  109. #{modTime},
  110. #{tstm})
  111. </insert>
  112. <update id="update" parameterType="com.kmall.admin.entity.MerchEntity">
  113. update mall_merch
  114. <set>
  115. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  116. <if test="merchName != null">`merch_name` = #{merchName}, </if>
  117. <if test="merchShortName != null">`merch_short_name` = #{merchShortName}, </if>
  118. <if test="merchImg != null">`merch_img` = #{merchImg}, </if>
  119. <if test="sortOrder != null">`sort_order` = #{sortOrder}, </if>
  120. <if test="isShow != null">`is_show` = #{isShow}, </if>
  121. <if test="remark != null">`remark` = #{remark}, </if>
  122. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  123. <if test="createTime != null">`create_time` = #{createTime}, </if>
  124. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  125. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  126. <if test="tstm != null">`tstm` = #{tstm}</if>
  127. </set>
  128. where id = #{id}
  129. </update>
  130. <delete id="delete">
  131. delete from mall_merch where id = #{value}
  132. </delete>
  133. <delete id="deleteBatch">
  134. delete from mall_merch where id in
  135. <foreach item="id" collection="array" open="(" separator="," close=")">
  136. #{id}
  137. </foreach>
  138. </delete>
  139. </mapper>