ApiStoreTopicMapper.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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.api.dao.mk.ApiStoreTopicMapper">
  4. <resultMap type="com.kmall.api.entity.mk.StoreTopicVo" id="storeTopicMap">
  5. <result property="id" column="id"/>
  6. <result property="title" column="title"/>
  7. <result property="content" column="content"/>
  8. <result property="itemPicUrl" column="item_pic_url"/>
  9. <result property="subtitle" column="subtitle"/>
  10. <result property="promTypeId" column="prom_type_id"/>
  11. <result property="topicPrice" column="topic_price"/>
  12. <result property="storeId" column="store_id"/>
  13. <result property="thirdMerchSn" column="third_merch_sn"/>
  14. <result property="isValid" column="is_valid"/>
  15. <result property="note" column="note"/>
  16. <result property="createrSn" column="creater_sn"/>
  17. <result property="createTime" column="create_time"/>
  18. <result property="moderSn" column="moder_sn"/>
  19. <result property="modTime" column="mod_time"/>
  20. <result property="tstm" column="tstm"/>
  21. </resultMap>
  22. <select id="queryObject" resultType="com.kmall.api.entity.mk.StoreTopicVo">
  23. select
  24. `id`,
  25. `title`,
  26. `content`,
  27. `item_pic_url`,
  28. `subtitle`,
  29. `prom_type_id`,
  30. `topic_price`,
  31. `store_id`,
  32. `third_merch_sn`,
  33. `is_valid`,
  34. `note`,
  35. `creater_sn`,
  36. `create_time`,
  37. `moder_sn`,
  38. `mod_time`,
  39. `tstm`
  40. from mall_store_topic
  41. where id = #{id}
  42. </select>
  43. <select id="queryList" resultType="com.kmall.api.entity.mk.StoreTopicVo">
  44. select
  45. d.`id`,
  46. d.`title`,
  47. d.`content`,
  48. d.`item_pic_url`,
  49. d.`subtitle`,
  50. d.`prom_type_id`,
  51. d.`topic_price`,
  52. d.`store_id`,
  53. d.`third_merch_sn`,
  54. d.`is_valid`,
  55. d.`note`,
  56. d.`creater_sn`,
  57. d.`create_time`,
  58. d.`moder_sn`,
  59. d.`mod_time`,
  60. d.`tstm`
  61. from mall_store_topic d left join third_merchant_biz t on d.third_merch_sn = t.third_merch_sn
  62. WHERE 1=1
  63. <if test="name != null and name.trim() != ''">
  64. AND title LIKE concat('%',#{name},'%')
  65. </if>
  66. <if test="storeId != null and storeId != ''">
  67. and d.store_id = #{storeId}
  68. </if>
  69. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  70. and d.third_merch_sn = #{thirdMerchSn}
  71. </if>
  72. <if test="merchSn != null and merchSn != ''">
  73. and t.merch_sn = #{merchSn}
  74. </if>
  75. <choose>
  76. <when test="sidx != null and sidx.trim() != ''">
  77. order by ${sidx} ${order}
  78. </when>
  79. <otherwise>
  80. order by d.id desc
  81. </otherwise>
  82. </choose>
  83. <if test="offset != null and limit != null">
  84. limit #{offset}, #{limit}
  85. </if>
  86. </select>
  87. <select id="queryTotal" resultType="int">
  88. select count(*)
  89. from mall_store_topic d left join third_merchant_biz t on d.third_merch_sn = t.third_merch_sn
  90. WHERE 1=1
  91. <if test="name != null and name.trim() != ''">
  92. AND title LIKE concat('%',#{name},'%')
  93. </if>
  94. <if test="storeId != null and storeId != ''">
  95. and d.store_id = #{storeId}
  96. </if>
  97. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  98. and d.third_merch_sn = #{thirdMerchSn}
  99. </if>
  100. <if test="merchSn != null and merchSn != ''">
  101. and t.merch_sn = #{merchSn}
  102. </if>
  103. </select>
  104. </mapper>