ApiThirdMerchantBizMapper.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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.ApiThirdMerchantBizMapper">
  4. <resultMap type="com.kmall.api.entity.ThirdMerchantBizVo" id="thirdMerchantBizMap">
  5. <result property="thirdMerchSn" column="third_merch_sn"/>
  6. <result property="merchSn" column="merch_sn"/>
  7. <result property="thirdPartyMerchCode" column="third_party_merch_code"/>
  8. <result property="thirdPartyMerchName" column="third_party_merch_name"/>
  9. <result property="isStockShare" column="is_stock_share"/>
  10. <result property="isStoreUserShare" column="is_store_user_share"/>
  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. <result property="isMapShow" column="is_map_show"/>
  18. </resultMap>
  19. <select id="queryObject" resultType="com.kmall.api.entity.ThirdMerchantBizVo">
  20. select
  21. `third_merch_sn`,
  22. `merch_sn`,
  23. `third_party_merch_code`,
  24. `third_party_merch_name`,
  25. `is_valid`,
  26. is_stock_share,
  27. is_store_user_share,
  28. is_map_show,
  29. `creater_sn`,
  30. `create_time`,
  31. `moder_sn`,
  32. `mod_time`,
  33. `tstm`
  34. from third_merchant_biz
  35. where third_merch_sn = #{id}
  36. </select>
  37. <select id="findByMerchSn" resultType="com.kmall.api.entity.ThirdMerchantBizVo">
  38. select
  39. `third_merch_sn`,
  40. `merch_sn`,
  41. `third_party_merch_code`,
  42. `third_party_merch_name`,
  43. `is_valid`,
  44. is_stock_share,
  45. is_store_user_share,
  46. is_map_show,
  47. `creater_sn`,
  48. `create_time`,
  49. `moder_sn`,
  50. `mod_time`,
  51. `tstm`
  52. from third_merchant_biz
  53. where merch_sn = #{value}
  54. </select>
  55. <select id="getThirdMerchangByCode" resultType="com.kmall.api.entity.ThirdMerchantBizVo">
  56. select
  57. `third_merch_sn`,
  58. `merch_sn`,
  59. `third_party_merch_code`,
  60. `third_party_merch_name`,
  61. `is_valid`,
  62. is_stock_share,
  63. is_store_user_share,
  64. is_map_show,
  65. `creater_sn`,
  66. `create_time`,
  67. `moder_sn`,
  68. `mod_time`,
  69. `tstm`
  70. from third_merchant_biz
  71. where third_party_merch_code = #{thirdMerchantCode}
  72. </select>
  73. <select id="queryDataByStoreId" resultType="com.kmall.api.entity.ThirdMerchantBizVo">
  74. select
  75. b.`third_merch_sn`,
  76. b.`merch_sn`,
  77. b.`third_party_merch_code`,
  78. b.`third_party_merch_name`,
  79. b.`is_valid`,
  80. b.is_stock_share,
  81. b.is_store_user_share,
  82. b.is_map_show
  83. from third_merchant_biz b inner join mall_store s on s.third_party_merch_code=b.third_party_merch_code
  84. where s.id = #{storeId}
  85. </select>
  86. <select id="queryList" resultType="com.kmall.api.entity.ThirdMerchantBizVo">
  87. select
  88. `third_merch_sn`,
  89. `merch_sn`,
  90. `third_party_merch_code`,
  91. `third_party_merch_name`,
  92. `is_valid`,
  93. is_stock_share,
  94. is_store_user_share,
  95. is_map_show,
  96. `creater_sn`,
  97. `create_time`,
  98. `moder_sn`,
  99. `mod_time`,
  100. `tstm`
  101. from third_merchant_biz
  102. WHERE 1=1
  103. <if test="name != null and name.trim() != ''">
  104. AND name LIKE concat('%',#{name},'%')
  105. </if>
  106. <if test="merchSn != null and merchSn.trim() != ''">
  107. and merch_sn = #{merchSn}
  108. </if>
  109. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  110. and third_party_merch_code = #{thirdPartyMerchCode}
  111. </if>
  112. <choose>
  113. <when test="sidx != null and sidx.trim() != ''">
  114. order by ${sidx} ${order}
  115. </when>
  116. <otherwise>
  117. order by third_merch_sn desc
  118. </otherwise>
  119. </choose>
  120. <if test="offset != null and limit != null">
  121. limit #{offset}, #{limit}
  122. </if>
  123. </select>
  124. <select id="queryTotal" resultType="int">
  125. select count(*) from third_merchant_biz
  126. WHERE 1=1
  127. <if test="name != null and name.trim() != ''">
  128. AND name LIKE concat('%',#{name},'%')
  129. </if>
  130. <if test="merchSn != null and merchSn.trim() != ''">
  131. and merch_sn = #{merchSn}
  132. </if>
  133. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  134. and third_party_merch_code = #{thirdPartyMerchCode}
  135. </if>
  136. </select>
  137. <insert id="save" parameterType="com.kmall.api.entity.ThirdMerchantBizVo" useGeneratedKeys="true" keyProperty="thirdMerchSn">
  138. insert into third_merchant_biz(
  139. `merch_sn`,
  140. `third_party_merch_code`,
  141. `third_party_merch_name`,
  142. `is_valid`,
  143. is_stock_share,
  144. is_store_user_share,
  145. `creater_sn`,
  146. `create_time`,
  147. `moder_sn`,
  148. `mod_time`,
  149. `tstm`)
  150. values(
  151. #{merchSn},
  152. #{thirdPartyMerchCode},
  153. #{thirdPartyMerchName},
  154. #{isValid},
  155. #{isStockShare},
  156. #{isStoreUserShare},
  157. #{createrSn},
  158. #{createTime},
  159. #{moderSn},
  160. #{modTime},
  161. #{tstm})
  162. </insert>
  163. <update id="update" parameterType="com.kmall.api.entity.ThirdMerchantBizVo">
  164. update third_merchant_biz
  165. <set>
  166. <if test="merchSn != null">`merch_sn` = #{merchSn},</if>
  167. <if test="thirdPartyMerchCode != null">`third_party_merch_code` = #{thirdPartyMerchCode}, </if>
  168. <if test="thirdPartyMerchName != null">`third_party_merch_name` = #{thirdPartyMerchName}, </if>
  169. <if test="isValid != null">`is_valid` = #{isValid}, </if>
  170. <if test="isStockShare != null">`is_stock_share` = #{isStockShare}, </if>
  171. <if test="isStoreUserShare != null">`is_store_user_share` = #{isStoreUserShare}, </if>
  172. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  173. <if test="createTime != null">`create_time` = #{createTime}, </if>
  174. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  175. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  176. <if test="tstm != null">`tstm` = #{tstm}</if>
  177. </set>
  178. where third_merch_sn = #{thirdMerchSn}
  179. </update>
  180. <delete id="delete">
  181. delete from third_merchant_biz where third_merch_sn = #{value}
  182. </delete>
  183. <delete id="deleteBatch">
  184. delete from third_merchant_biz where third_merch_sn in
  185. <foreach item="thirdMerchSn" collection="array" open="(" separator="," close=")">
  186. #{thirdMerchSn}
  187. </foreach>
  188. </delete>
  189. </mapper>