jl-jjsp-service/securityControl-modules/securityControl-proteam/target/classes/mapper/DeviceLedgerMapper.xml

66 lines
2.7 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.sercurityControl.proteam.mapper.DeviceLedgerMapper">
<select id="getDeviceLedgerList" resultType="com.sercurityControl.proteam.domain.vo.DeviceLedGer"
parameterType="com.sercurityControl.proteam.domain.vo.DeviceLedGer">
SELECT
sbbm.BZ_USER_NAME AS manage,
sbbm.BID_NAME AS bName,
sbbm.BID_NO AS bidNo,
sbbm.PUID AS puId,
sbbm.CREATE_TIME AS createDay,
sbbm.UPDATE_TIME AS operTime
FROM
sgwpdm_bz_baill_mill sbbm
WHERE 1=1
<if test="bName!=null and bName!=''">
and sbbm.BID_NAME like concat('%',concat(#{bName},'%'))
</if>
<if test="bidNo!=null and bidNo!=''">
and sbbm.BID_NO like concat('%',concat(#{bidNo},'%'))
</if>
<if test="puId!=null and puId!=''">
and sbbm.PUID like concat('%',concat(#{puId},'%'))
</if>
<if test="manage!=null and manage!=''">
and sbbm.BZ_USER_NAME like concat('%',concat(#{manage},'%'))
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
and DATE_FORMAT(sbbm.UPDATE_TIME,'%Y-%m-%d') between #{startTime} and #{endTime}
</if>
</select>
<select id="getDeviceNum" resultType="java.util.Map">
SELECT
( SELECT count(*) FROM t_device td WHERE td.is_flag='0'
<if test="deviceType!=null and deviceType!=''">
and td.type_code =#{deviceType}
</if>) AS deviceNum,
( SELECT count(*) FROM t_device td WHERE td.state = 1 And td.is_flag = '0'
<if test="deviceType!=null and deviceType!=''">
and td.type_code =#{deviceType}
</if>) onlineNum,
(SELECT
count(*)
FROM
t_device td
WHERE td.is_flag = '0' and td.state = 0
<if test="deviceType!=null and deviceType!=''">
and td.type_code =#{deviceType}
</if>
AND td.update_time BETWEEN DATE_FORMAT( curdate() - INTERVAL 1 MONTH, '%Y-%m-%d' ) AND DATE_FORMAT( curdate(),
'%Y-%m-%d' )) offlineNum,
(
SELECT
count(*)
FROM
t_device td
WHERE td.is_flag = '0' and td.state = 0
<if test="deviceType!=null and deviceType!=''">
and td.type_code =#{deviceType}
</if>
AND (td.update_time NOT BETWEEN DATE_FORMAT( curdate() - INTERVAL 1 MONTH, '%Y-%m-%d' )
AND DATE_FORMAT( curdate(), '%Y-%m-%d' ) or td.update_time is NULL )) AS longOfflineNum
</select>
</mapper>