Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

166 linhas
6.8 KiB

  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.iformall.mapper.WxMerchantMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxMerchant">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="img_url" jdbcType="VARCHAR" property="imgUrl"/>
  8. <result column="name" jdbcType="VARCHAR" property="name"/>
  9. <result column="link_phone" jdbcType="VARCHAR" property="linkPhone"/>
  10. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  11. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  12. <result column="car_vendor_type" jdbcType="INTEGER" property="carVendorType"/>
  13. <result column="car_params" jdbcType="VARCHAR" property="carParams"/>
  14. <result column="status" jdbcType="INTEGER" property="status"/>
  15. <result column="link_person" jdbcType="VARCHAR" property="linkPerson"/>
  16. <result column="business_id" jdbcType="INTEGER" property="businessId"/>
  17. <result column="shop_type" jdbcType="INTEGER" property="shopType"/>
  18. <result column="brand" jdbcType="VARCHAR" property="brand"/>
  19. <result column="vip_discount_rate1" jdbcType="SMALLINT" property="vipDiscountRate1"/>
  20. <result column="vip_discount_rate2" jdbcType="SMALLINT" property="vipDiscountRate2"/>
  21. <result column="vip_discount_rate3" jdbcType="SMALLINT" property="vipDiscountRate3"/>
  22. <result column="type" jdbcType="SMALLINT" property="type"/>
  23. </resultMap>
  24. <sql id="allColumns">
  25. `id`,`tenant_id`,`img_url`,`name`,`link_phone`,`create_date`,`update_date`,`car_vendor_type`,`car_params`,`status`,`link_person`,
  26. `business_id`,`shop_type`,`brand`,`vip_discount_rate1`,`vip_discount_rate2`,`vip_discount_rate3`,`type`
  27. </sql>
  28. <sql id="dynamicWhereConditions">
  29. where 1 = 1
  30. <if test=" null != id ">
  31. and `id` = #{id}
  32. </if>
  33. <if test=" null != tenantId ">
  34. and `tenant_id` = #{tenantId}
  35. </if>
  36. <if test=" null != imgUrl ">
  37. and `img_url` like concat('%', #{imgUrl},'%')
  38. </if>
  39. <if test=" null != name ">
  40. and `name` like concat('%', #{name},'%')
  41. </if>
  42. <if test=" null != linkPhone ">
  43. and `link_phone` like concat('%', #{linkPhone},'%')
  44. </if>
  45. <if test=" null != createDate ">
  46. and `create_date` = #{createDate}
  47. </if>
  48. <if test=" null != updateDate ">
  49. and `update_date` = #{updateDate}
  50. </if>
  51. <if test=" null != carVendorType ">
  52. and `car_vendor_type` = #{carVendorType}
  53. </if>
  54. <if test=" null != businessId ">
  55. and `business_id` = #{businessId}
  56. </if>
  57. <if test=" null != carParams ">
  58. and `car_params` like concat('%', #{carParams},'%')
  59. </if>
  60. <if test=" null != status ">
  61. and `status` = #{status}
  62. </if>
  63. <if test=" null != linkPerson ">
  64. and `link_person` = #{linkPerson}
  65. </if>
  66. <if test=" null != type ">
  67. and `type` = #{type}
  68. </if>
  69. <if test=" null != ids ">
  70. and id in
  71. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  72. #{idItem}
  73. </foreach>
  74. </if>
  75. <if test=" null != sortColumns">order by ${sortColumns}</if>
  76. </sql>
  77. <select id="findList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
  78. select
  79. <include refid="allColumns"/>
  80. from wx_merchant
  81. <include refid="dynamicWhereConditions"/>
  82. </select>
  83. <sql id="allMerchantDiscountVoColumns">
  84. m.id,
  85. m.img_url,m.name,m.link_phone,m.status,
  86. s.addr,s.shop_number,s.baidu_poi,
  87. mb.building_name,mf.floor_name,
  88. m.vip_discount_rate1, m.vip_discount_rate2, m.vip_discount_rate3
  89. </sql>
  90. <resultMap id="MerchantDiscountVoResultMap" type="com.iformall.domain.vo.WxMerchantVo">
  91. <id column="id" jdbcType="BIGINT" property="id"/>
  92. <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl"/>
  93. <result column="name" jdbcType="VARCHAR" property="merchantName"/>
  94. <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/>
  95. <result column="status" jdbcType="VARCHAR" property="merchantStatus"/>
  96. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  97. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  98. <result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
  99. <result column="floor_name" jdbcType="VARCHAR" property="floorName"/>
  100. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  101. <result column="vip_discount_rate1" jdbcType="SMALLINT" property="vipDiscountRate1"/>
  102. <result column="vip_discount_rate2" jdbcType="SMALLINT" property="vipDiscountRate2"/>
  103. <result column="vip_discount_rate3" jdbcType="SMALLINT" property="vipDiscountRate3"/>
  104. </resultMap>
  105. <select id="findDiscountList" parameterType="java.util.Map" resultMap="MerchantDiscountVoResultMap">
  106. select
  107. <include refid="allMerchantDiscountVoColumns"/>
  108. FROM wx_merchant m
  109. left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0
  110. left join wx_shop s on ms.shop_id = s.id
  111. left join wx_mall_building mb on s.building = mb.id
  112. left join wx_mall_floor mf on s.floor = mf.id
  113. <where>
  114. <if test=" null != tenantId ">
  115. and m.`tenant_id` = #{tenantId}
  116. </if>
  117. <if test=" null != status ">
  118. and m.`status` = #{status}
  119. </if>
  120. and ( m.`vip_discount_rate1` > 0 or m.`vip_discount_rate2` > 0 or m.`vip_discount_rate3` > 0)
  121. </where>
  122. </select>
  123. <select id="getMerchantByCode" parameterType="java.util.Map" resultMap="MerchantDiscountVoResultMap">
  124. select
  125. <include refid="allMerchantDiscountVoColumns"/>
  126. FROM wx_merchant m
  127. left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0
  128. left join wx_shop s on ms.shop_id = s.id
  129. left join wx_mall_building mb on s.building = mb.id
  130. left join wx_mall_floor mf on s.floor = mf.id
  131. <where>
  132. <if test=" null != tenantId ">
  133. and m.`tenant_id` = #{tenantId}
  134. </if>
  135. <if test=" null != status ">
  136. and m.`status` = #{status}
  137. </if>
  138. <if test=" null != merchantCode ">
  139. and md5(m.`id`) = #{merchantCode}
  140. </if>
  141. </where>
  142. </select>
  143. </mapper>