|
@@ -31,37 +31,41 @@
|
|
|
</association>
|
|
|
<association property="sim" javaType="com.xy.dto.DeviceSimDto$Vo">
|
|
|
<id column="id" property="id"/>
|
|
|
- <result column="type" property="type" />
|
|
|
- <result column="activate_time" property="activateTime" />
|
|
|
- <result column="timeout" property="timeout" />
|
|
|
- <result column="last_renewal_time" property="lastRenewalTime" />
|
|
|
+ <result column="type" property="type"/>
|
|
|
+ <result column="activate_time" property="activateTime"/>
|
|
|
+ <result column="timeout" property="timeout"/>
|
|
|
+ <result column="last_renewal_time" property="lastRenewalTime"/>
|
|
|
+ <result column="dsim_create_time" property="createTime"/>
|
|
|
</association>
|
|
|
</resultMap>
|
|
|
|
|
|
<select id="page" resultMap="queryPageMap">
|
|
|
select di.*,
|
|
|
ds.net_state,
|
|
|
- dsim.id, dsim.type, dsim.activate_time, dsim.timeout, dsim.last_renewal_time,
|
|
|
+ dsim.id, dsim.type, dsim.activate_time, dsim.timeout, dsim.last_renewal_time, dsim.create_time as dsim_create_time,
|
|
|
dsys.sim_iccid
|
|
|
from device_info di
|
|
|
join device_status ds on (di.device_id = ds.device_id)
|
|
|
join device_sysinfo dsys on(di.device_id = dsys.device_id)
|
|
|
- <if test="queryPage.isActivate == null or queryPage.isActivate == false">
|
|
|
- left join device_sim dsim on(dsim.id = dsys.sim_iccid)
|
|
|
+ <if test="queryPage.isBind == false">
|
|
|
+ right join device_sim dsim on(dsim.id = dsys.sim_iccid)
|
|
|
</if>
|
|
|
- <if test="queryPage.isActivate != null and queryPage.isActivate == true">
|
|
|
+ <if test="queryPage.isBind == true">
|
|
|
join device_sim dsim on(dsim.id = dsys.sim_iccid)
|
|
|
</if>
|
|
|
where
|
|
|
- dsys.sim_iccid is not null
|
|
|
- <if test="queryPage.isActivate != null and queryPage.isActivate == false">
|
|
|
- and dsim.id is null
|
|
|
+ 1 = 1
|
|
|
+ <if test="queryPage.isBind == false">
|
|
|
+ and di.device_id is null
|
|
|
</if>
|
|
|
- <if test="queryPage.mercId != null">
|
|
|
- and di.merc_id = #{queryPage.mercId}
|
|
|
- </if>
|
|
|
- <if test="queryPage.deviceId != null">
|
|
|
- and di.device_id = #{queryPage.deviceId}
|
|
|
+ <if test="queryPage.isBind == true">
|
|
|
+ and dsys.sim_iccid is not null
|
|
|
+ <if test="queryPage.mercId != null">
|
|
|
+ and di.merc_id = #{queryPage.mercId}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.deviceId != null">
|
|
|
+ and di.device_id = #{queryPage.deviceId}
|
|
|
+ </if>
|
|
|
</if>
|
|
|
<if test="queryPage.simId != null and queryPage.simId != ''">
|
|
|
and dsim.id = #{queryPage.simId}
|
|
@@ -76,15 +80,72 @@
|
|
|
and dsim.timeout <= #{queryPage.thisTime}
|
|
|
</if>
|
|
|
</if>
|
|
|
+ <if test="queryPage.isActivate != null">
|
|
|
+ <if test="queryPage.isActivate == true">
|
|
|
+ and dsim.activate_time is not null
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.isActivate == false">
|
|
|
+ and dsim.activate_time is null
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
order by dsim.timeout asc
|
|
|
</select>
|
|
|
|
|
|
+ <select id="pageCount" resultType="int">
|
|
|
+ select count(*)
|
|
|
+ from device_info di
|
|
|
+ join device_status ds on (di.device_id = ds.device_id)
|
|
|
+ join device_sysinfo dsys on(di.device_id = dsys.device_id)
|
|
|
+ <if test="queryPage.isBind == false">
|
|
|
+ right join device_sim dsim on(dsim.id = dsys.sim_iccid)
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.isBind == true">
|
|
|
+ join device_sim dsim on(dsim.id = dsys.sim_iccid)
|
|
|
+ </if>
|
|
|
+ where
|
|
|
+ 1 = 1
|
|
|
+ <if test="queryPage.isBind == false">
|
|
|
+ and di.device_id is null
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.isBind == true">
|
|
|
+ and dsys.sim_iccid is not null
|
|
|
+ <if test="queryPage.mercId != null">
|
|
|
+ and di.merc_id = #{queryPage.mercId}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.deviceId != null">
|
|
|
+ and di.device_id = #{queryPage.deviceId}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.simId != null and queryPage.simId != ''">
|
|
|
+ and dsim.id = #{queryPage.simId}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.chargingStatus != null and queryPage.chargingStatus != ''">
|
|
|
+ <!-- 即将过期 -->
|
|
|
+ <if test="queryPage.chargingStatus == 1">
|
|
|
+ and dsim.timeout >= #{queryPage.thisTime} and dsim.timeout <= #{queryPage.theTime}
|
|
|
+ </if>
|
|
|
+ <!-- 已过期 -->
|
|
|
+ <if test="queryPage.chargingStatus == 2">
|
|
|
+ and dsim.timeout <= #{queryPage.thisTime}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.isActivate != null">
|
|
|
+ <if test="queryPage.isActivate == true">
|
|
|
+ and dsim.activate_time is not null
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.isActivate == false">
|
|
|
+ and dsim.activate_time is null
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="deviceSimTimeout" resultType="java.lang.Long">
|
|
|
select merc_id
|
|
|
from device_sysinfo dsi
|
|
|
join device_info di on(dsi.device_id = di.device_id)
|
|
|
join device_sim dsim on(dsi.sim_iccid = dsim.id)
|
|
|
- left join merc_msg_info mmi on(di.merc_id = mmi.merc_id and mmi.create_time >= #{query.mmiTime} and mmi.type = 2 and mmi.work_type = #{query.workType})
|
|
|
+ left join merc_msg_info mmi on(di.merc_id = mmi.merc_id and mmi.create_time >= #{query.mmiTime} and mmi.type = 2
|
|
|
+ and mmi.work_type = #{query.workType})
|
|
|
where
|
|
|
mmi.id is null
|
|
|
<if test="query.begin != null">
|