1
0

FeedbackDao.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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.FeedbackDao">
  4. <resultMap type="com.kmall.admin.entity.FeedbackEntity" id="feedbackMap">
  5. <result property="msgId" column="msg_id"/>
  6. <result property="userId" column="user_id"/>
  7. <result property="userName" column="user_name"/>
  8. <result property="mobile" column="mobile"/>
  9. <result property="feedType" column="feed_Type"/>
  10. <result property="content" column="content"/>
  11. <result property="status" column="status"/>
  12. <result property="addTime" column="add_time"/>
  13. <result property="merchSn" column="merch_sn"/>
  14. <result property="storeId" column="store_id"/>
  15. <result property="storeName" column="store_name"/>
  16. </resultMap>
  17. <select id="queryObject" resultType="com.kmall.admin.entity.FeedbackEntity">
  18. select
  19. `msg_id`,
  20. `user_id`,
  21. `merch_sn`,
  22. `store_id`,
  23. `user_name`,
  24. `mobile`,
  25. `feed_Type`,
  26. `content`,
  27. `status`,
  28. `add_time`
  29. from mall_feedback
  30. where msg_id = #{id}
  31. </select>
  32. <select id="queryList" resultType="com.kmall.admin.entity.FeedbackEntity">
  33. select
  34. msg_id,
  35. user_id,
  36. f.merch_sn,
  37. f.store_id,
  38. user_name,
  39. `mobile`,
  40. `feed_Type`,
  41. `content`,
  42. `status`,
  43. `add_time`,
  44. s.store_name
  45. from mall_feedback f left join mall_store s on f.store_id = s.id
  46. WHERE 1=1
  47. <if test="userName != null and userName.trim() != ''">
  48. AND user_name LIKE concat('%',#{userName},'%')
  49. </if>
  50. <if test="storeId != null and storeId != '' ">
  51. AND f.store_id = #{storeId}
  52. </if>
  53. <if test="merchSn != null and merchSn.trim() != '' ">
  54. AND f.merch_sn = #{merchSn}
  55. </if>
  56. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  57. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  58. </if>
  59. <choose>
  60. <when test="sidx != null and sidx.trim() != ''">
  61. order by ${sidx} ${order}
  62. </when>
  63. <otherwise>
  64. order by msg_id desc
  65. </otherwise>
  66. </choose>
  67. <if test="offset != null and limit != null">
  68. limit #{offset}, #{limit}
  69. </if>
  70. </select>
  71. <select id="queryTotal" resultType="int">
  72. select count(*) from mall_feedback f left join mall_store s on f.store_id = s.id
  73. WHERE 1=1
  74. <if test="userName != null and userName.trim() != ''">
  75. AND f.user_name LIKE concat('%',#{userName},'%')
  76. </if>
  77. <if test="storeId != null and storeId != '' ">
  78. AND f.store_id = #{storeId}
  79. </if>
  80. <if test="merchSn != null and merchSn.trim() != '' ">
  81. AND f.merch_sn = #{merchSn}
  82. </if>
  83. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  84. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  85. </if>
  86. </select>
  87. <insert id="save" parameterType="com.kmall.admin.entity.FeedbackEntity" useGeneratedKeys="true" keyProperty="msgId">
  88. insert into mall_feedback(
  89. `user_id`,
  90. `user_name`,
  91. `mobile`,
  92. `feed_Type`,
  93. `content`,
  94. `status`,
  95. `add_time`)
  96. values(
  97. #{userId},
  98. #{userName},
  99. #{mobile},
  100. #{feedType},
  101. #{content},
  102. #{status},
  103. #{addTime})
  104. </insert>
  105. <update id="update" parameterType="com.kmall.admin.entity.FeedbackEntity">
  106. update mall_feedback
  107. <set>
  108. <if test="userId != null">`user_id` = #{userId}, </if>
  109. <if test="userName != null">`user_name` = #{userName}, </if>
  110. <if test="mobile != null">`mobile` = #{mobile}, </if>
  111. <if test="feedType != null">`feed_Type` = #{feedType}, </if>
  112. <if test="content != null">`content` = #{content}, </if>
  113. <if test="status != null">`status` = #{status}, </if>
  114. <if test="addTime != null">`add_time` = #{addTime}</if>
  115. </set>
  116. where msg_id = #{msgId}
  117. </update>
  118. <delete id="delete">
  119. delete from mall_feedback where msg_id = #{value}
  120. </delete>
  121. <delete id="deleteBatch">
  122. delete from mall_feedback where msg_id in
  123. <foreach item="msgId" collection="array" open="(" separator="," close=")">
  124. #{msgId}
  125. </foreach>
  126. </delete>
  127. </mapper>