Browse Source

[电表][修改]:增加所属商户字段

release_toaliyun_real
hupeng 6 years ago
parent
commit
85191f1f10
2 changed files with 24 additions and 15 deletions
  1. +2
    -1
      mallinkService/src/main/java/com/iformall/domain/po/KwMeter.java
  2. +22
    -14
      mallinkService/src/main/resources/mapper/KwMeterMapper.xml

+ 2
- 1
mallinkService/src/main/java/com/iformall/domain/po/KwMeter.java View File

@@ -87,9 +87,10 @@ public class KwMeter extends BaseEntity {
private Integer bandrate; private Integer bandrate;


@Excel(name = "商户", width = 20, orderNum = "8") @Excel(name = "商户", width = 20, orderNum = "8")
@Transient
private String merchantName; private String merchantName;


private Long merchantId;

@Transient @Transient
private Integer merchantMeterStatus; private Integer merchantMeterStatus;




+ 22
- 14
mallinkService/src/main/resources/mapper/KwMeterMapper.xml View File

@@ -17,64 +17,69 @@
<result column="box_id" jdbcType="BIGINT" property="boxId"/> <result column="box_id" jdbcType="BIGINT" property="boxId"/>
<result column="status" jdbcType="INTEGER" property="status"/> <result column="status" jdbcType="INTEGER" property="status"/>
<result column="bind_status" jdbcType="INTEGER" property="bindStatus"/> <result column="bind_status" jdbcType="INTEGER" property="bindStatus"/>

<result column="merchant_name" jdbcType="VARCHAR" property="merchantName"/>
<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
</resultMap> </resultMap>
<sql id="allColumns"> <sql id="allColumns">
`id`,`tenant_id`,`address`,`brand`,`model`,`place`,`last_online_time`,`total_power`,`online_status`,`config`,`create_time`,`update_time`,`box_id`,`status`,`bind_status`
`kw_meter`.`id`,`kw_meter`.`tenant_id`,`kw_meter`.`address`,`kw_meter`.`brand`,`kw_meter`.`model`,
`kw_meter`.`place`,`kw_meter`.`last_online_time`,`kw_meter`.`total_power`,`kw_meter`.`online_status`,
`kw_meter`.`config`,`kw_meter`.`create_time`,`kw_meter`.`update_time`,`kw_meter`.`box_id`,`kw_meter`.`status`,`kw_meter`.`bind_status`
</sql> </sql>
<sql id="dynamicWhereConditions"> <sql id="dynamicWhereConditions">
where 1 = 1 where 1 = 1
<if test=" null != id "> <if test=" null != id ">
and `id` = #{id}
and `kw_meter`.`id` = #{id}
</if> </if>
<if test=" null != tenantId "> <if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
and `kw_meter`.`tenant_id` = #{tenantId}
</if> </if>
<if test=" null != address"> <if test=" null != address">
and `address` like concat('%', #{address},'%')
and `kw_meter`.`address` like concat('%', #{address},'%')
</if> </if>
<if test=" null != brand and '' != brand "> <if test=" null != brand and '' != brand ">
and `brand` like concat('%', #{brand},'%')
and `kw_meter`.`brand` like concat('%', #{brand},'%')
</if> </if>
<if test=" null != place and '' != place "> <if test=" null != place and '' != place ">
and `place` like concat('%', #{place},'%')
and `kw_meter`.`place` like concat('%', #{place},'%')
</if> </if>
<if test=" null != model "> <if test=" null != model ">
and `model` = #{model}
and `kw_meter`.`model` = #{model}
</if> </if>
<if test=" null != onlineStatus "> <if test=" null != onlineStatus ">
and `online_status` = #{onlineStatus}
and `kw_meter`.`online_status` = #{onlineStatus}
</if> </if>


<if test=" null != boxId "> <if test=" null != boxId ">
and `box_id` = #{boxId}
and `kw_meter`.`box_id` = #{boxId}
</if> </if>


<if test=" null != status "> <if test=" null != status ">
and `status` = #{status}
and `kw_meter`.`status` = #{status}
</if> </if>


<if test=" null != bindStatus "> <if test=" null != bindStatus ">
and `bind_status` = #{bindStatus}
and `kw_meter`.`bind_status` = #{bindStatus}
</if> </if>


<if test=" null != merchantMeterStatus and 1 == merchantMeterStatus"> <if test=" null != merchantMeterStatus and 1 == merchantMeterStatus">
and `id` not in (select meter_id from kw_merchant_meter where status = 0)
and `kw_meter`.`id` not in (select meter_id from kw_merchant_meter where status = 0)
</if> </if>
<if test=" null != merchantMeterStatus and 0 == merchantMeterStatus"> <if test=" null != merchantMeterStatus and 0 == merchantMeterStatus">
and `id` in (select meter_id from kw_merchant_meter where status = 0)
and `kw_meter`.`id` in (select meter_id from kw_merchant_meter where status = 0)
</if> </if>


<if test=" null != ids "> <if test=" null != ids ">
and id in
and `kw_meter`.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem} #{idItem}
</foreach> </foreach>
@@ -85,7 +90,10 @@
<select id="findList" parameterType="com.iformall.domain.po.KwMeter" resultMap="BaseResultMap"> <select id="findList" parameterType="com.iformall.domain.po.KwMeter" resultMap="BaseResultMap">
select select
<include refid="allColumns"/> <include refid="allColumns"/>
,mm.merchant_id as merchant_id, m.name as merchant_name
from kw_meter from kw_meter
left join kw_merchant_meter mm on kw_meter.id = mm.meter_id and mm.status = 0
inner join wx_merchant m on m.id = mm.merchant_id
<include refid="dynamicWhereConditions"/> <include refid="dynamicWhereConditions"/>
</select> </select>




Loading…
Cancel
Save