|
|
|
@@ -56,15 +56,39 @@ |
|
|
|
<include refid="dynamicWhereConditions"/> |
|
|
|
</select> |
|
|
|
|
|
|
|
<resultMap id="MeterBaseResultMap" type="com.iformall.domain.po.KwMeter"> |
|
|
|
<id column="id" jdbcType="BIGINT" property="id"/> |
|
|
|
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> |
|
|
|
<result column="address" jdbcType="BIGINT" property="address"/> |
|
|
|
<result column="brand" jdbcType="VARCHAR" property="brand"/> |
|
|
|
<result column="place" jdbcType="VARCHAR" property="place"/> |
|
|
|
<result column="model" jdbcType="VARCHAR" property="model"/> |
|
|
|
<result column="protocol" jdbcType="INTEGER" property="protocol"/> |
|
|
|
<result column="bandrate" jdbcType="INTEGER" property="bandrate"/> |
|
|
|
<result column="last_online_time" jdbcType="TIMESTAMP" property="lastOnlineTime"/> |
|
|
|
<result column="online_status" jdbcType="INTEGER" property="onlineStatus"/> |
|
|
|
<result column="config" jdbcType="VARCHAR" property="config"/> |
|
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> |
|
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> |
|
|
|
<result column="box_id" jdbcType="BIGINT" property="boxId"/> |
|
|
|
<result column="status" jdbcType="INTEGER" property="status"/> |
|
|
|
<result column="bind_status" jdbcType="INTEGER" property="bindStatus"/> |
|
|
|
</resultMap> |
|
|
|
|
|
|
|
<select id="findMeterList" parameterType="java.util.Map" resultMap="MeterBaseResultMap"> |
|
|
|
select m.* from kw_merchant_meter mm |
|
|
|
left join kw_meter m on mm.`meter_id` = m.id |
|
|
|
where mm.`status` = 0 and m.`bind_status` = 0 |
|
|
|
<if test=" null != merchantId "> |
|
|
|
and mm.`merchant_id` = #{merchantId} |
|
|
|
</if> |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<resultMap id="BaseResultMapVo" type="com.iformall.domain.vo.KwMerchantMeterVo"> |
|
|
|
<id column="id" jdbcType="BIGINT" property="id"/> |
|
|
|
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> |
|
|
|
<result column="meter_id" jdbcType="BIGINT" property="meterId"/> |
|
|
|
<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> |
|
|
|
<result column="status" jdbcType="INTEGER" property="status"/> |
|
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> |
|
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> |
|
|
|
|
|
|
|
<result column="name" jdbcType="VARCHAR" property="merchantName"/> |
|
|
|
<result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/> |
|
|
|
@@ -75,55 +99,37 @@ |
|
|
|
select="com.iformall.mapper.WxShopMapper.findShopVoList"> |
|
|
|
</collection> |
|
|
|
|
|
|
|
<collection column="{merchantId=id}" property="shopVoList" |
|
|
|
ofType="com.iformall.domain.vo.WxShopVo" |
|
|
|
<collection column="{merchantId=id}" property="meterList" |
|
|
|
ofType="com.iformall.domain.po.kwMeter" |
|
|
|
javaType="java.util.List" |
|
|
|
select="com.iformall.mapper.WxShopMapper.findShopVoList"> |
|
|
|
select="com.iformall.mapper.KwMerchantMeterMapper.findMeterList"> |
|
|
|
</collection> |
|
|
|
|
|
|
|
</resultMap> |
|
|
|
|
|
|
|
<sql id="allColumnsVo"> |
|
|
|
`id`,`tenant_id`,`meter_id`,`merchant_id`,`status`,`create_time`,`update_time`, `name`, `link_phone` |
|
|
|
`id`, `tenant_id`, `merchant_id`, `status`, `name`, `link_phone` |
|
|
|
</sql> |
|
|
|
|
|
|
|
<sql id="dynamicWhereConditionsVo"> |
|
|
|
where 1 = 1 |
|
|
|
|
|
|
|
<if test=" null != id "> |
|
|
|
and `id` = #{id} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != tenantId "> |
|
|
|
and `tenant_id` = #{tenantId} |
|
|
|
</if> |
|
|
|
<select id="findListVo" parameterType="com.iformall.domain.dto.KwMerchantMeterDto" resultMap="BaseResultMapVo"> |
|
|
|
select <include refid="allColumnsVo"/> |
|
|
|
from ( |
|
|
|
select merchant_id from kw_merchant_meter |
|
|
|
where `status` = 0 |
|
|
|
|
|
|
|
<if test=" null != merchantId "> |
|
|
|
and `merchant_id` = #{merchantId} |
|
|
|
</if> |
|
|
|
<if test=" null != tenantId "> |
|
|
|
and `tenant_id` = #{tenantId} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != meterId "> |
|
|
|
and `meter_id` = #{meterId} |
|
|
|
</if> |
|
|
|
<if test=" null != merchantId "> |
|
|
|
and `merchant_id` = #{merchantId} |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != status "> |
|
|
|
and `status` = #{status} |
|
|
|
</if> |
|
|
|
group by merchant_id |
|
|
|
) temp |
|
|
|
, wx_merchant |
|
|
|
where temp.merchant_id = id |
|
|
|
|
|
|
|
<if test=" null != ids "> |
|
|
|
and id in |
|
|
|
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> |
|
|
|
#{idItem} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test=" null != sortColumns">order by ${sortColumns}</if> |
|
|
|
</sql> |
|
|
|
|
|
|
|
<select id="findListVo" parameterType="com.iformall.domain.dto.KwMerchantMeterDto" resultMap="BaseResultMap"> |
|
|
|
select |
|
|
|
<include refid="allColumnsVo"/> |
|
|
|
from kw_merchant_meter, wx_merchant |
|
|
|
<include refid="dynamicWhereConditionsVo"/> |
|
|
|
</select> |
|
|
|
|
|
|
|
<update id="unbindBatch" parameterType="com.iformall.domain.po.KwMerchantMeter"> |
|
|
|
|