1
0

HelpIssueDao.xml 3.7 KB

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