|
|
|
@@ -10,7 +10,6 @@ |
|
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> |
|
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> |
|
|
|
|
|
|
|
|
|
|
|
</resultMap> |
|
|
|
|
|
|
|
<sql id="allColumns"> |
|
|
|
@@ -73,10 +72,22 @@ |
|
|
|
<result column="box_id" jdbcType="BIGINT" property="boxId"/> |
|
|
|
<result column="status" jdbcType="INTEGER" property="status"/> |
|
|
|
<result column="bind_status" jdbcType="INTEGER" property="bindStatus"/> |
|
|
|
|
|
|
|
<association column="{meterId=id}" property="latestRecord" |
|
|
|
select="com.iformall.mapper.KwMeterDataMapper.findLastRecordList"> |
|
|
|
</association > |
|
|
|
|
|
|
|
</resultMap> |
|
|
|
|
|
|
|
<select id="findMeterList" parameterType="java.util.Map" resultMap="MeterBaseResultMap"> |
|
|
|
select m.* from kw_merchant_meter mm |
|
|
|
<resultMap id="MeterSimpleResultMap" type="com.iformall.domain.po.KwMeter"> |
|
|
|
<id column="id" jdbcType="BIGINT" property="id"/> |
|
|
|
<association column="{meterId=id}" property="latestRecord" |
|
|
|
select="com.iformall.mapper.KwMeterDataMapper.findLastRecordList"> |
|
|
|
</association > |
|
|
|
</resultMap> |
|
|
|
|
|
|
|
<select id="findSimpleMeterList" parameterType="java.util.Map" resultMap="MeterSimpleResultMap"> |
|
|
|
select m.id from kw_merchant_meter mm |
|
|
|
left join kw_meter m on mm.`meter_id` = m.id |
|
|
|
where mm.`status` = 0 |
|
|
|
<if test=" null != merchantId "> |
|
|
|
@@ -84,8 +95,16 @@ |
|
|
|
</if> |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="countMeterList" parameterType="java.util.Map" resultType="java.lang.Integer"> |
|
|
|
select count(*) from kw_merchant_meter mm |
|
|
|
left join kw_meter m on mm.`meter_id` = m.id |
|
|
|
where mm.`status` = 0 |
|
|
|
<if test=" null != merchantId "> |
|
|
|
and mm.`merchant_id` = #{merchantId} |
|
|
|
</if> |
|
|
|
</select> |
|
|
|
|
|
|
|
<resultMap id="BaseResultMapVo" type="com.iformall.domain.vo.KwMerchantMeterVo"> |
|
|
|
<resultMap id="BaseResultMapListVo" type="com.iformall.domain.vo.KwMerchantMeterVo"> |
|
|
|
<id column="id" jdbcType="BIGINT" property="id"/> |
|
|
|
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> |
|
|
|
<result column="status" jdbcType="INTEGER" property="status"/> |
|
|
|
@@ -93,25 +112,22 @@ |
|
|
|
<result column="name" jdbcType="VARCHAR" property="merchantName"/> |
|
|
|
<result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/> |
|
|
|
|
|
|
|
<collection column="{merchantId=id}" property="shopVoList" |
|
|
|
ofType="com.iformall.domain.vo.WxShopVo" |
|
|
|
javaType="java.util.List" |
|
|
|
select="com.iformall.mapper.WxShopMapper.findShopVoList"> |
|
|
|
</collection> |
|
|
|
<association column="{merchantId=id}" property="meterCount" |
|
|
|
select="com.iformall.mapper.KwMerchantMeterMapper.countMeterList"> |
|
|
|
</association> |
|
|
|
|
|
|
|
<collection column="{merchantId=id}" property="meterList" |
|
|
|
ofType="com.iformall.domain.po.kwMeter" |
|
|
|
javaType="java.util.List" |
|
|
|
select="com.iformall.mapper.KwMerchantMeterMapper.findMeterList"> |
|
|
|
select="com.iformall.mapper.KwMerchantMeterMapper.findSimpleMeterList"> |
|
|
|
</collection> |
|
|
|
|
|
|
|
</resultMap> |
|
|
|
|
|
|
|
<sql id="allColumnsVo"> |
|
|
|
`id`, `tenant_id`, `merchant_id`, `status`, `name`, `link_phone` |
|
|
|
</sql> |
|
|
|
|
|
|
|
<select id="findVoList" parameterType="com.iformall.domain.dto.KwMerchantMeterDto" resultMap="BaseResultMapVo"> |
|
|
|
<select id="findVoList" parameterType="com.iformall.domain.dto.KwMerchantMeterDto" resultMap="BaseResultMapListVo"> |
|
|
|
select <include refid="allColumnsVo"/> |
|
|
|
from ( |
|
|
|
select merchant_id from kw_merchant_meter |
|
|
|
@@ -133,8 +149,8 @@ |
|
|
|
and `name` like concat('%', #{merchantName},'%') |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != linkPhone and ''!=linkPhone "> |
|
|
|
and `link_phone` like concat('%', #{linkPhone},'%') |
|
|
|
<if test=" null != merchantLinkPhone and ''!=merchantLinkPhone "> |
|
|
|
and `link_phone` like concat('%', #{merchantLinkPhone},'%') |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test=" null != merchantStatus "> |
|
|
|
@@ -147,6 +163,49 @@ |
|
|
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
<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 |
|
|
|
<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="status" jdbcType="INTEGER" property="status"/> |
|
|
|
|
|
|
|
<result column="name" jdbcType="VARCHAR" property="merchantName"/> |
|
|
|
<result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/> |
|
|
|
|
|
|
|
<collection column="{merchantId=id}" property="shopVoList" |
|
|
|
ofType="com.iformall.domain.vo.WxShopVo" |
|
|
|
javaType="java.util.List" |
|
|
|
select="com.iformall.mapper.WxShopMapper.findShopVoList"> |
|
|
|
</collection> |
|
|
|
|
|
|
|
<collection column="{merchantId=id}" property="meterList" |
|
|
|
ofType="com.iformall.domain.po.kwMeter" |
|
|
|
javaType="java.util.List" |
|
|
|
select="com.iformall.mapper.KwMerchantMeterMapper.findMeterList"> |
|
|
|
</collection> |
|
|
|
</resultMap> |
|
|
|
|
|
|
|
<select id="getById" parameterType="Long" resultMap="BaseResultMapVo"> |
|
|
|
select <include refid="allColumnsVo"/> |
|
|
|
from ( |
|
|
|
select merchant_id from kw_merchant_meter |
|
|
|
where `status` = 0 |
|
|
|
and `merchant_id` = #{merchantId} |
|
|
|
group by merchant_id |
|
|
|
) temp |
|
|
|
, wx_merchant |
|
|
|
where temp.merchant_id = id |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<sql id="dynamicWhereConditionsVo"> |
|
|
|
where 1 = 1 |
|
|
|
@@ -240,18 +299,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getById" parameterType="java.lang.Long" resultMap="BaseResultMapVo"> |
|
|
|
select <include refid="allColumnsVo"/> |
|
|
|
from ( |
|
|
|
select merchant_id from kw_merchant_meter |
|
|
|
where `status` = 0 |
|
|
|
and `merchant_id` = #{merchantId} |
|
|
|
group by merchant_id |
|
|
|
) temp |
|
|
|
, wx_merchant |
|
|
|
where temp.merchant_id = id |
|
|
|
</select> |
|
|
|
|
|
|
|
<update id="unbindBatch" parameterType="java.lang.Long"> |
|
|
|
update kw_merchant_meter set status = 1 |
|
|
|
where status = 0 |
|
|
|
|