后台服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
4.7 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.WxMerchantShopMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxMerchantShop">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
  8. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  9. <result column="shop_id" jdbcType="BIGINT" property="shopId" />
  10. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  11. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  12. <result column="is_del" jdbcType="SMALLINT" property="isDel" />
  13. </resultMap>
  14. <sql id="allColumns">
  15. `id`,`tenant_id`,`parent_tenant_id`,`merchant_id`,`shop_id`,`create_date`,`update_date`,`is_del`
  16. </sql>
  17. <sql id="dynamicWhereConditions">
  18. where 1 = 1
  19. <if test=" null != id ">
  20. and `id` = #{id}
  21. </if>
  22. <if test=" null != tenantId and '' != tenantId">
  23. and `tenant_id` = #{tenantId}
  24. </if>
  25. <if test=" null != parentTenantId and '' != parentTenantId">
  26. and `parent_tenant_id` = #{parentTenantId}
  27. </if>
  28. <if test=" null != merchantId ">
  29. and `merchant_id` = #{merchantId}
  30. </if>
  31. <if test=" null != shopId ">
  32. and `shop_id` = #{shopId}
  33. </if>
  34. <if test=" null != createDate ">
  35. and `create_date` = #{createDate}
  36. </if>
  37. <if test=" null != updateDate ">
  38. and `update_date` = #{updateDate}
  39. </if>
  40. <if test=" null != isDel ">
  41. and `is_del` = #{isDel}
  42. </if>
  43. <if test=" null != ids ">
  44. and id in
  45. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  46. #{idItem}
  47. </foreach>
  48. </if>
  49. <if test=" null != shopIdList ">
  50. and shop_id in
  51. <foreach collection="shopIdList" index="index" item="shopIdItem" open="(" separator="," close=")">
  52. #{shopIdItem}
  53. </foreach>
  54. </if>
  55. <if test=" null != merchantIds ">
  56. and merchant_id in
  57. <foreach collection="merchantIds" index="index" item="merchantIdItem" open="(" separator="," close=")">
  58. #{merchantIdItem}
  59. </foreach>
  60. </if>
  61. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  62. </sql>
  63. <select id="findList" parameterType="com.iformall.domain.po.WxMerchantShop" resultMap="BaseResultMap">
  64. select
  65. <include refid="allColumns"/>
  66. from wx_merchant_shop
  67. <include refid="dynamicWhereConditions" />
  68. </select>
  69. <select id="findMerchantIdList" parameterType="com.iformall.domain.po.WxMerchantShop" resultType="Long">
  70. select distinct merchant_id
  71. from wx_merchant_shop
  72. <include refid="dynamicWhereConditions" />
  73. </select>
  74. <select id="findShopIds" parameterType="Long" resultType="Long">
  75. select shop_id from wx_merchant_shop where is_del = 0
  76. <if test=" null != merchantIds ">
  77. and merchant_id in
  78. <foreach collection="merchantIds" index="index" item="merchantIdItem" open="(" separator="," close=")">
  79. #{merchantIdItem}
  80. </foreach>
  81. </if>
  82. </select>
  83. <update id = "delShops" parameterType="java.util.Map">
  84. update wx_merchant_shop set is_del = 1 where merchant_id = #{merchantId}
  85. and shop_id in
  86. <foreach collection="shopList" index="index" item="shopItem" open="(" separator="," close=")">
  87. #{shopItem}
  88. </foreach>
  89. </update>
  90. <delete id="realDelByMerchantId" parameterType="java.util.Map">
  91. delete from wx_merchant_shop where merchant_id = #{merchantId} and shop_id in
  92. <foreach collection="shopList" index="index" item="shopItem" open="(" separator="," close=")">
  93. #{shopItem}
  94. </foreach>
  95. </delete>
  96. <select id="rentRateHistory" resultType="hashmap" parameterType="hashmap">
  97. select
  98. <if test="1 == dateType">
  99. DATE_FORMAT(w.create_date,'%Y/%m/%d') xTime
  100. </if>
  101. <if test="2 == dateType">
  102. DATE_FORMAT(w.create_date,'%Y/%m') xTime
  103. </if>
  104. ,count(distinct w.shop_id) xCount
  105. from wx_merchant_shop w
  106. where w.is_del=0
  107. <if test=" null != tenantId and '' != tenantId">
  108. and w.`tenant_id` = #{tenantId}
  109. </if>
  110. <if test=" null != parentTenantId and '' != parentTenantId">
  111. and w.`parent_tenant_id` = #{parentTenantId}
  112. </if>
  113. <if test=" null != shopIds ">
  114. and w.shop_id in
  115. <foreach collection="shopIds" index="index" item="shopIdItem" open="(" separator="," close=")">
  116. #{shopIdItem}
  117. </foreach>
  118. </if>
  119. group by xTime
  120. order by xTime
  121. </select>
  122. </mapper>