|
@@ -40,26 +40,31 @@
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
<select id="page" resultMap="queryPageMap">
|
|
<select id="page" resultMap="queryPageMap">
|
|
- select di.*,
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ di.*,
|
|
ds.net_state,
|
|
ds.net_state,
|
|
dsim.id, dsim.type, dsim.activate_time, dsim.timeout, dsim.last_renewal_time, dsim.create_time as dsim_create_time,
|
|
dsim.id, dsim.type, dsim.activate_time, dsim.timeout, dsim.last_renewal_time, dsim.create_time as dsim_create_time,
|
|
dsys.sim_iccid
|
|
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.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>
|
|
|
|
|
|
+ FROM
|
|
|
|
+ device_sim dsim
|
|
|
|
+ left join device_sysinfo dsys on(dsim.id = dsys.sim_iccid)
|
|
|
|
+ left join device_info di on(dsys.device_id = di.device_id)
|
|
|
|
+ left join device_status ds on (di.device_id = ds.device_id)
|
|
where
|
|
where
|
|
1 = 1
|
|
1 = 1
|
|
<if test="queryPage.isBind == false">
|
|
<if test="queryPage.isBind == false">
|
|
- and di.device_id is null
|
|
|
|
|
|
+ AND NOT EXISTS (
|
|
|
|
+ SELECT 1
|
|
|
|
+ FROM device_sysinfo dsys
|
|
|
|
+ WHERE dsim.id = dsys.sim_iccid
|
|
|
|
+ )
|
|
</if>
|
|
</if>
|
|
<if test="queryPage.isBind == true">
|
|
<if test="queryPage.isBind == true">
|
|
- and dsys.sim_iccid is not null
|
|
|
|
|
|
+ AND EXISTS (
|
|
|
|
+ SELECT 1
|
|
|
|
+ FROM device_sysinfo dsys
|
|
|
|
+ WHERE dsim.id = dsys.sim_iccid
|
|
|
|
+ )
|
|
<if test="queryPage.mercId != null">
|
|
<if test="queryPage.mercId != null">
|
|
and di.merc_id = #{queryPage.mercId}
|
|
and di.merc_id = #{queryPage.mercId}
|
|
</if>
|
|
</if>
|
|
@@ -93,22 +98,26 @@
|
|
|
|
|
|
<select id="pageCount" resultType="int">
|
|
<select id="pageCount" resultType="int">
|
|
select count(*)
|
|
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>
|
|
|
|
|
|
+ FROM
|
|
|
|
+ device_sim dsim
|
|
|
|
+ left join device_sysinfo dsys on(dsim.id = dsys.sim_iccid)
|
|
|
|
+ left join device_info di on(dsys.device_id = di.device_id)
|
|
|
|
+ left join device_status ds on (di.device_id = ds.device_id)
|
|
where
|
|
where
|
|
1 = 1
|
|
1 = 1
|
|
<if test="queryPage.isBind == false">
|
|
<if test="queryPage.isBind == false">
|
|
- and di.device_id is null
|
|
|
|
|
|
+ AND NOT EXISTS (
|
|
|
|
+ SELECT 1
|
|
|
|
+ FROM device_sysinfo dsys
|
|
|
|
+ WHERE dsim.id = dsys.sim_iccid
|
|
|
|
+ )
|
|
</if>
|
|
</if>
|
|
<if test="queryPage.isBind == true">
|
|
<if test="queryPage.isBind == true">
|
|
- and dsys.sim_iccid is not null
|
|
|
|
|
|
+ AND EXISTS (
|
|
|
|
+ SELECT 1
|
|
|
|
+ FROM device_sysinfo dsys
|
|
|
|
+ WHERE dsim.id = dsys.sim_iccid
|
|
|
|
+ )
|
|
<if test="queryPage.mercId != null">
|
|
<if test="queryPage.mercId != null">
|
|
and di.merc_id = #{queryPage.mercId}
|
|
and di.merc_id = #{queryPage.mercId}
|
|
</if>
|
|
</if>
|