Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

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