GoodsLabelHeadDao.xml 4.5 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.GoodsLabelHeadDao">
  4. <resultMap type="com.kmall.admin.entity.GoodsLabelHeadEntity" id="goodsLabelHeadMap">
  5. <result property="id" column="id"/>
  6. <result property="merchSn" column="merch_sn"/>
  7. <result property="storeId" column="store_id"/>
  8. <result property="labelHeadName" column="label_head_name"/>
  9. <result property="labelHeadUrl" column="label_head_url"/>
  10. <result property="sortOrder" column="sort_order"/>
  11. <result property="isValid" column="is_valid"/>
  12. <result property="createrSn" column="creater_sn"/>
  13. <result property="createTime" column="create_time"/>
  14. <result property="moderSn" column="moder_sn"/>
  15. <result property="modTime" column="mod_time"/>
  16. <result property="tstm" column="tstm"/>
  17. </resultMap>
  18. <select id="queryObject" resultType="com.kmall.admin.entity.GoodsLabelHeadEntity">
  19. select
  20. `id`,
  21. `merch_sn`,
  22. `store_id`,
  23. `label_head_name`,
  24. `label_head_url`,
  25. `sort_order`,
  26. `is_valid`,
  27. `creater_sn`,
  28. `create_time`,
  29. `moder_sn`,
  30. `mod_time`,
  31. `tstm`
  32. from mall_goods_label_head
  33. where id = #{id}
  34. </select>
  35. <select id="queryList" resultType="com.kmall.admin.entity.GoodsLabelHeadEntity">
  36. select
  37. `id`,
  38. `merch_sn`,
  39. `store_id`,
  40. `label_head_name`,
  41. `label_head_url`,
  42. `sort_order`,
  43. `is_valid`,
  44. `creater_sn`,
  45. `create_time`,
  46. `moder_sn`,
  47. `mod_time`,
  48. `tstm`
  49. from mall_goods_label_head
  50. WHERE 1=1
  51. and is_valid='0'
  52. <if test="merchSn != null and merchSn.trim() != ''">
  53. AND merch_sn=#{merchSn}
  54. </if>
  55. <if test="merchSn != null and merchSn.trim() != '' and storeId != null and storeId.trim() != ''">
  56. AND store_id=#{storeId} AND store_id IS NULL AND merch_sn=#{merchSn}
  57. </if>
  58. <if test="name != null and name.trim() != ''" >
  59. AND label_head_name = #{name}
  60. </if>
  61. <choose>
  62. <when test="sidx != null and sidx.trim() != ''">
  63. order by ${sidx} ${order}
  64. </when>
  65. <otherwise>
  66. order by sort_order desc
  67. </otherwise>
  68. </choose>
  69. <if test="offset != null and limit != null">
  70. limit #{offset}, #{limit}
  71. </if>
  72. </select>
  73. <select id="queryTotal" resultType="int">
  74. select count(*) from mall_goods_label_head
  75. WHERE 1=1
  76. and is_valid='0'
  77. <if test="merchSn != null and merchSn.trim() != ''">
  78. AND merch_sn=#{merchSn}
  79. </if>
  80. <if test="merchSn != null and merchSn.trim() != '' and storeId != null and storeId.trim() != ''">
  81. AND store_id=#{storeId} AND store_id IS NULL AND merch_sn=#{merchSn}
  82. </if>
  83. <if test="name != null and name.trim() != ''" >
  84. AND label_head_name = #{name}
  85. </if>
  86. </select>
  87. <insert id="save" parameterType="com.kmall.admin.entity.GoodsLabelHeadEntity" useGeneratedKeys="true" keyProperty="id">
  88. insert into mall_goods_label_head(
  89. `merch_sn`,
  90. `store_id`,
  91. `label_head_name`,
  92. `label_head_url`,
  93. `sort_order`,
  94. `is_valid`,
  95. `creater_sn`,
  96. `create_time`,
  97. `moder_sn`,
  98. `mod_time`,
  99. `tstm`)
  100. values(
  101. #{merchSn},
  102. #{storeId},
  103. #{labelHeadName},
  104. #{labelHeadUrl},
  105. #{sortOrder},
  106. #{isValid},
  107. #{createrSn},
  108. #{createTime},
  109. #{moderSn},
  110. #{modTime},
  111. #{tstm})
  112. </insert>
  113. <update id="update" parameterType="com.kmall.admin.entity.GoodsLabelHeadEntity">
  114. update mall_goods_label_head
  115. <set>
  116. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  117. <if test="storeId != null">`store_id` = #{storeId}, </if>
  118. <if test="labelHeadName != null">`label_head_name` = #{labelHeadName}, </if>
  119. <if test="labelHeadUrl != null">`label_head_url` = #{labelHeadUrl}, </if>
  120. <if test="sortOrder != null">`sort_order` = #{sortOrder}, </if>
  121. <if test="isValid != null">`is_valid` = #{isValid}, </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_goods_label_head where id = #{value}
  132. </delete>
  133. <delete id="deleteBatch">
  134. delete from mall_goods_label_head where id in
  135. <foreach item="id" collection="array" open="(" separator="," close=")">
  136. #{id}
  137. </foreach>
  138. </delete>
  139. </mapper>