|
@@ -388,6 +388,131 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
+
|
|
|
+ <!-- 分页查询统计 -->
|
|
|
+ <select id="pageCountForPc" resultType="com.xy.dto.DeviceInfoDto$PageCount">
|
|
|
+ SELECT
|
|
|
+ COUNT(*) AS total,
|
|
|
+ SUM(CASE WHEN status.net_state = 'online' THEN 1 ELSE 0 END) AS onlineNum,
|
|
|
+ SUM(CASE WHEN status.net_state = 'offline' THEN 1 ELSE 0 END) AS offLineNum,
|
|
|
+ SUM(CASE WHEN info.active_state = 1 THEN 1 ELSE 0 END) AS activeNum,
|
|
|
+ SUM(CASE WHEN info.active_state = 0 THEN 1 ELSE 0 END) AS noActiveNum
|
|
|
+ FROM device_info info
|
|
|
+ JOIN device_status status ON info.device_id = status.device_id
|
|
|
+ join device_sysinfo sysinfo on info.device_id = sysinfo.device_id
|
|
|
+
|
|
|
+ <where>
|
|
|
+ <if test="queryPage.isBindMerc != null">
|
|
|
+ <choose>
|
|
|
+ <when test="queryPage.isBindMerc == true">
|
|
|
+ and info.merc_id is not null
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and (info.merc_id is null or info.merc_id = '')
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.isHaveNfc != null">
|
|
|
+ and sysinfo.is_have_alipay_npad= #{queryPage.isHaveNfc}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.keyword != null and queryPage.keyword != ''">
|
|
|
+ and CONCAT(IFNULL(info.device_name, ''), IFNULL(info.device_id, '')) LIKE
|
|
|
+ CONCAT('%',#{queryPage.keyword},'%')
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.showStatus != null">
|
|
|
+ and info.show_status = #{queryPage.showStatus}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.deviceIdName != null and queryPage.deviceIdName != ''">
|
|
|
+ and (
|
|
|
+ LOCATE(#{queryPage.deviceIdName}, info.device_id) > 0 or
|
|
|
+ LOCATE(#{queryPage.deviceIdName}, info.device_name)
|
|
|
+ > 0
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.deviceId != null">
|
|
|
+ and LOCATE(#{queryPage.deviceId}, info.device_id) > 0
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.deviceIdList != null">
|
|
|
+ and info.device_id IN
|
|
|
+ <foreach collection="queryPage.deviceIdList" item="deviceId" open="(" close=")" separator=",">
|
|
|
+ #{deviceId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="queryPage.deviceName != null and queryPage.deviceName != ''">
|
|
|
+ and LOCATE(#{queryPage.deviceName}, info.device_name) > 0
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.no != null and queryPage.no != ''">
|
|
|
+ and (
|
|
|
+ LOCATE(#{queryPage.no}, info.merc_device_code) > 0 or
|
|
|
+ LOCATE(#{queryPage.no}, sysinfo.device_sn) > 0 or
|
|
|
+ LOCATE(#{queryPage.no}, sysinfo.sim_iccid) > 0
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.activeState != null">
|
|
|
+ and info.active_state = #{queryPage.activeState}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.netState != null">
|
|
|
+ and status.net_state = #{queryPage.netState}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="queryPage.stockStatus != null">
|
|
|
+ and status.stock_status = #{queryPage.stockStatus}
|
|
|
+ </if>
|
|
|
+
|
|
|
+
|
|
|
+ <if test="queryPage.busyState != null">
|
|
|
+ and info.busy_state = #{queryPage.busyState}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.deviceType != null">
|
|
|
+ and info.device_type = #{queryPage.deviceType}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.mercDeviceCode != null and queryPage.mercDeviceCode != ''">
|
|
|
+ and LOCATE(#{queryPage.mercDeviceCode}, info.merc_device_code) > 0
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.mercCode != null and queryPage.mercCode != ''">
|
|
|
+ and info.merc_code = #{queryPage.mercCode}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.mercId != null">
|
|
|
+ and info.merc_id = #{queryPage.mercId}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.merc != null and queryPage.merc != ''">
|
|
|
+ and (
|
|
|
+ info.merc_id = #{queryPage.merc} or info.merc_code like concat(#{queryPage.merc}, '%') or
|
|
|
+ LOCATE(#{queryPage.merc}, mr.name) > 0
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.placeId != null">
|
|
|
+ and info.place_id = #{queryPage.placeId}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.placeLineId != null">
|
|
|
+ and info.place_line_id = #{queryPage.placeLineId}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.districtId != null">
|
|
|
+ and info.district_id = #{queryPage.districtId}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.activeState != null">
|
|
|
+ and info.active_state = #{queryPage.activeState}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.busyState != null">
|
|
|
+ and info.busy_state = #{queryPage.busyState}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.appUpmVersion != null and queryPage.appUpmVersion != ''">
|
|
|
+ and sysinfo.app_upm_version = #{queryPage.appUpmVersion}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.appDownmVersion != null and queryPage.appDownmVersion != ''">
|
|
|
+ and sysinfo.app_downm_version = #{queryPage.appDownmVersion}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.beginActiveTime != null and queryPage.beginActiveTime != ''">
|
|
|
+ and info.active_time >= #{queryPage.beginActiveTime}
|
|
|
+ </if>
|
|
|
+ <if test="queryPage.endActiveTime != null and queryPage.endActiveTime != ''">
|
|
|
+ and info.active_time <= #{queryPage.endActiveTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
<!-- 小程序首页设备列表线路分组 -->
|
|
|
<select id="merHomeCountList" resultType="com.xy.dto.DeviceInfoDto$MercHomeCountVO">
|
|
|
select count(*) deviceNum, IFNULL(district_id, -1) districtId
|