Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

162 строки
5.3 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.KwMerchantMeterMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.KwMerchantMeter">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="meter_id" jdbcType="BIGINT" property="meterId"/>
  8. <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
  9. <result column="status" jdbcType="INTEGER" property="status"/>
  10. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  11. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  12. </resultMap>
  13. <sql id="allColumns">
  14. `id`,`tenant_id`,`meter_id`,`merchant_id`,`status`,`create_time`,`update_time`
  15. </sql>
  16. <sql id="dynamicWhereConditions">
  17. where 1 = 1
  18. <if test=" null != id ">
  19. and `id` = #{id}
  20. </if>
  21. <if test=" null != tenantId ">
  22. and `tenant_id` = #{tenantId}
  23. </if>
  24. <if test=" null != merchantId ">
  25. and `merchant_id` = #{merchantId}
  26. </if>
  27. <if test=" null != meterId ">
  28. and `meter_id` = #{meterId}
  29. </if>
  30. <if test=" null != status ">
  31. and `status` = #{status}
  32. </if>
  33. <if test=" null != ids ">
  34. and id in
  35. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  36. #{idItem}
  37. </foreach>
  38. </if>
  39. <if test=" null != sortColumns">order by ${sortColumns}</if>
  40. </sql>
  41. <select id="findList" parameterType="com.iformall.domain.po.KwMerchantMeter" resultMap="BaseResultMap">
  42. select
  43. <include refid="allColumns"/>
  44. from kw_merchant_meter
  45. <include refid="dynamicWhereConditions"/>
  46. </select>
  47. <resultMap id="MeterBaseResultMap" type="com.iformall.domain.po.KwMeter">
  48. <id column="id" jdbcType="BIGINT" property="id"/>
  49. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  50. <result column="address" jdbcType="BIGINT" property="address"/>
  51. <result column="brand" jdbcType="VARCHAR" property="brand"/>
  52. <result column="place" jdbcType="VARCHAR" property="place"/>
  53. <result column="model" jdbcType="VARCHAR" property="model"/>
  54. <result column="protocol" jdbcType="INTEGER" property="protocol"/>
  55. <result column="bandrate" jdbcType="INTEGER" property="bandrate"/>
  56. <result column="last_online_time" jdbcType="TIMESTAMP" property="lastOnlineTime"/>
  57. <result column="online_status" jdbcType="INTEGER" property="onlineStatus"/>
  58. <result column="config" jdbcType="VARCHAR" property="config"/>
  59. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  60. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  61. <result column="box_id" jdbcType="BIGINT" property="boxId"/>
  62. <result column="status" jdbcType="INTEGER" property="status"/>
  63. <result column="bind_status" jdbcType="INTEGER" property="bindStatus"/>
  64. </resultMap>
  65. <select id="findMeterList" parameterType="java.util.Map" resultMap="MeterBaseResultMap">
  66. select m.* from kw_merchant_meter mm
  67. left join kw_meter m on mm.`meter_id` = m.id
  68. where mm.`status` = 0 and m.`bind_status` = 0
  69. <if test=" null != merchantId ">
  70. and mm.`merchant_id` = #{merchantId}
  71. </if>
  72. </select>
  73. <resultMap id="BaseResultMapVo" type="com.iformall.domain.vo.KwMerchantMeterVo">
  74. <id column="id" jdbcType="BIGINT" property="id"/>
  75. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  76. <result column="status" jdbcType="INTEGER" property="status"/>
  77. <result column="name" jdbcType="VARCHAR" property="merchantName"/>
  78. <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/>
  79. <collection column="{merchantId=id}" property="shopVoList"
  80. ofType="com.iformall.domain.vo.WxShopVo"
  81. javaType="java.util.List"
  82. select="com.iformall.mapper.WxShopMapper.findShopVoList">
  83. </collection>
  84. <collection column="{merchantId=id}" property="meterList"
  85. ofType="com.iformall.domain.po.kwMeter"
  86. javaType="java.util.List"
  87. select="com.iformall.mapper.KwMerchantMeterMapper.findMeterList">
  88. </collection>
  89. </resultMap>
  90. <sql id="allColumnsVo">
  91. `id`, `tenant_id`, `merchant_id`, `status`, `name`, `link_phone`
  92. </sql>
  93. <select id="findListVo" parameterType="com.iformall.domain.dto.KwMerchantMeterDto" resultMap="BaseResultMapVo">
  94. select <include refid="allColumnsVo"/>
  95. from (
  96. select merchant_id from kw_merchant_meter
  97. where `status` = 0
  98. <if test=" null != tenantId ">
  99. and `tenant_id` = #{tenantId}
  100. </if>
  101. <if test=" null != merchantId ">
  102. and `merchant_id` = #{merchantId}
  103. </if>
  104. group by merchant_id
  105. ) temp
  106. , wx_merchant
  107. where temp.merchant_id = id
  108. </select>
  109. <select id="getById" parameterType="java.lang.Long" resultMap="BaseResultMapVo">
  110. select <include refid="allColumnsVo"/>
  111. from (
  112. select merchant_id from kw_merchant_meter
  113. where `status` = 0
  114. and `merchant_id` = #{merchantId}
  115. group by merchant_id
  116. ) temp
  117. , wx_merchant
  118. where temp.merchant_id = id
  119. </select>
  120. <update id="unbindBatch" parameterType="com.iformall.domain.po.KwMerchantMeter">
  121. update kw_merchant_meter set status = 1
  122. where status = 0
  123. <if test=" null != merchantId ">
  124. and `merchant_id` = #{merchantId}
  125. </if>
  126. <if test=" null != meterId ">
  127. and `meter_id` = #{meterId}
  128. </if>
  129. </update>
  130. </mapper>