|
@@ -20,28 +20,30 @@
|
|
|
</sql>
|
|
|
<delete id="deleteExpiredVisitorRecord">
|
|
|
<![CDATA[
|
|
|
- delete from base_person_device_filter_log
|
|
|
- where datediff(now(),record_time)>1
|
|
|
- and person_id=0
|
|
|
- order by record_time asc limit ${limit}
|
|
|
+
|
|
|
+ delete from base_person_device_filter_log
|
|
|
+ where datediff(now(),record_time)>1
|
|
|
+ and person_id=0
|
|
|
+ order by record_time asc limit ${limit}
|
|
|
+
|
|
|
]]>
|
|
|
</delete>
|
|
|
<resultMap id="PersonDeviceFilterLogMap" type="com.jpsoft.smart.modules.base.entity.PersonDeviceFilterLog">
|
|
|
- <id property="id" column="id_" />
|
|
|
- <result property="createBy" column="create_by" />
|
|
|
- <result property="createTime" column="create_time" />
|
|
|
- <result property="updateBy" column="update_by" />
|
|
|
- <result property="updateTime" column="update_time" />
|
|
|
- <result property="delFlag" column="del_flag" />
|
|
|
- <result property="deviceNo" column="device_no" />
|
|
|
- <result property="personId" column="person_id" />
|
|
|
- <result property="temperature" column="temperature_" />
|
|
|
- <result property="matchStatus" column="match_status" />
|
|
|
- <result property="matchMsg" column="match_msg" />
|
|
|
- <result property="matchFaceId" column="match_face_id" />
|
|
|
- <result property="faceImage" column="face_image" />
|
|
|
- <result property="recordTime" column="record_time" />
|
|
|
- <result property="timeZones" column="time_zones" />
|
|
|
+ <id property="id" column="id_"/>
|
|
|
+ <result property="createBy" column="create_by"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateBy" column="update_by"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ <result property="delFlag" column="del_flag"/>
|
|
|
+ <result property="deviceNo" column="device_no"/>
|
|
|
+ <result property="personId" column="person_id"/>
|
|
|
+ <result property="temperature" column="temperature_"/>
|
|
|
+ <result property="matchStatus" column="match_status"/>
|
|
|
+ <result property="matchMsg" column="match_msg"/>
|
|
|
+ <result property="matchFaceId" column="match_face_id"/>
|
|
|
+ <result property="faceImage" column="face_image"/>
|
|
|
+ <result property="recordTime" column="record_time"/>
|
|
|
+ <result property="timeZones" column="time_zones"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<select id="get" parameterType="long" resultMap="PersonDeviceFilterLogMap">
|
|
@@ -184,38 +186,42 @@
|
|
|
]]>
|
|
|
</if>
|
|
|
</where>
|
|
|
- <foreach item="sort" collection="sortList" open="order by" separator=",">
|
|
|
+ <foreach item="sort" collection="sortList" open="order by" separator=",">
|
|
|
${sort.name} ${sort.order}
|
|
|
</foreach>
|
|
|
</select>
|
|
|
- <select id="temperatureNormalStatistics" resultMap="PersonDeviceFilterLogMap">
|
|
|
+ <select id="temperatureNormalStatistics" resultMap="PersonDeviceFilterLogMap">
|
|
|
<![CDATA[
|
|
|
- select count(*) from base_person_device_filter_log a
|
|
|
- LEFT JOIN base_person_info b on a.person_id=b.id_
|
|
|
- LEFT JOIN base_company_info c on b.company_id=c.id_
|
|
|
- where a.del_flag=false
|
|
|
- and c.code_ like #{companyCode}
|
|
|
- and a.temperature_ < #{temperature}
|
|
|
- and a.record_time >= #{startDate}
|
|
|
- and a.record_time <= #{endDate}
|
|
|
+
|
|
|
+ select count(*) from base_person_device_filter_log a
|
|
|
+ LEFT JOIN base_person_info b on a.person_id=b.id_
|
|
|
+ LEFT JOIN base_company_info c on b.company_id=c.id_
|
|
|
+ where a.del_flag=false
|
|
|
+ and c.code_ like #{companyCode}
|
|
|
+ and a.temperature_ < #{temperature}
|
|
|
+ and a.record_time >= #{startDate}
|
|
|
+ and a.record_time <= #{endDate}
|
|
|
+
|
|
|
]]>
|
|
|
</select>
|
|
|
- <select id="temperatureUnusualStatistics" resultMap="PersonDeviceFilterLogMap">
|
|
|
+ <select id="temperatureUnusualStatistics" resultMap="PersonDeviceFilterLogMap">
|
|
|
<![CDATA[
|
|
|
- select count(*) from base_person_device_filter_log a
|
|
|
- LEFT JOIN base_person_info b on a.person_id=b.id_
|
|
|
- LEFT JOIN base_company_info c on b.company_id=c.id_
|
|
|
- where a.del_flag=false
|
|
|
- and c.code_ like #{companyCode}
|
|
|
- and a.temperature_ >= #{temperature}
|
|
|
- and a.record_time >= #{startDate}
|
|
|
- and a.record_time <= #{endDate}
|
|
|
+
|
|
|
+ select count(*) from base_person_device_filter_log a
|
|
|
+ LEFT JOIN base_person_info b on a.person_id=b.id_
|
|
|
+ LEFT JOIN base_company_info c on b.company_id=c.id_
|
|
|
+ where a.del_flag=false
|
|
|
+ and c.code_ like #{companyCode}
|
|
|
+ and a.temperature_ >= #{temperature}
|
|
|
+ and a.record_time >= #{startDate}
|
|
|
+ and a.record_time <= #{endDate}
|
|
|
+
|
|
|
]]>
|
|
|
</select>
|
|
|
<select id="list" resultMap="PersonDeviceFilterLogMap">
|
|
|
select * from base_person_device_filter_log where del_flag=false
|
|
|
</select>
|
|
|
- <select id="unusualStatistics" resultType="java.util.HashMap">
|
|
|
+ <select id="unusualStatistics" resultType="java.util.HashMap">
|
|
|
<![CDATA[
|
|
|
select
|
|
|
c.id_ as id,
|
|
@@ -232,21 +238,21 @@
|
|
|
and a.record_time < #{endDate}
|
|
|
]]>
|
|
|
and (
|
|
|
- c.code_ like #{companyCode}
|
|
|
+ c.code_ like #{companyCode}
|
|
|
<if test="personId!=null">
|
|
|
or c.id_ in (
|
|
|
- select d.company_id from base_person_company d where d.person_id = #{personId}
|
|
|
+ select d.company_id from base_person_company d where d.person_id = #{personId}
|
|
|
)
|
|
|
</if>
|
|
|
)
|
|
|
GROUP BY c.id_,date_format(a.record_time,'%Y-%m-%d')
|
|
|
</select>
|
|
|
- <select id="lastPersonLog" resultMap="PersonDeviceFilterLogMap">
|
|
|
+ <select id="lastPersonLog" resultMap="PersonDeviceFilterLogMap">
|
|
|
SELECT * FROM base_person_device_filter_log
|
|
|
WHERE del_flag = FALSE AND person_id = #{personId}
|
|
|
ORDER BY record_time desc LIMIT 1
|
|
|
</select>
|
|
|
- <select id="getByPersonIdAndDate" resultMap="PersonDeviceFilterLogMap">
|
|
|
+ <select id="getByPersonIdAndDate" resultMap="PersonDeviceFilterLogMap">
|
|
|
SELECT * FROM base_person_device_filter_log
|
|
|
WHERE del_flag=FALSE AND person_id= #{personId}
|
|
|
<![CDATA[
|
|
@@ -267,17 +273,17 @@
|
|
|
c.code_ like #{companyCode}
|
|
|
<if test="personId!=null">
|
|
|
or c.id_ in (
|
|
|
- select d.company_id from base_person_company d where d.person_id = #{personId}
|
|
|
+ select d.company_id from base_person_company d where d.person_id = #{personId}
|
|
|
)
|
|
|
</if>
|
|
|
)
|
|
|
<if test="status==1">
|
|
|
- <![CDATA[
|
|
|
+ <![CDATA[
|
|
|
and a.temperature_<=#{temperatureMax}
|
|
|
]]>
|
|
|
</if>
|
|
|
<if test="status==-1">
|
|
|
- <![CDATA[
|
|
|
+ <![CDATA[
|
|
|
and a.temperature_>#{temperatureMax}
|
|
|
]]>
|
|
|
</if>
|
|
@@ -295,14 +301,15 @@
|
|
|
)
|
|
|
]]>
|
|
|
and (
|
|
|
- b.code_ like #{companyCode}
|
|
|
-<!-- <if test="personId!=null">
|
|
|
- or b.id_ in (
|
|
|
- select d.company_id from base_person_company d where d.person_id = #{personId}
|
|
|
- )
|
|
|
- </if>-->
|
|
|
+ b.code_ like #{companyCode}
|
|
|
+ <!-- <if test="personId!=null">
|
|
|
+ or b.id_ in (
|
|
|
+ select d.company_id from base_person_company d where d.person_id = #{personId}
|
|
|
+ )
|
|
|
+ </if>-->
|
|
|
<if test="personCompanyList!=null">
|
|
|
- <foreach collection="personCompanyList" index="index" item="item" open=" or b.id_ in(" separator="," close=")">
|
|
|
+ <foreach collection="personCompanyList" index="index" item="item" open=" or b.id_ in(" separator=","
|
|
|
+ close=")">
|
|
|
#{item.companyId}
|
|
|
</foreach>
|
|
|
</if>
|
|
@@ -310,10 +317,12 @@
|
|
|
</select>
|
|
|
<select id="getDayAbnormalNum" resultType="java.lang.Integer">
|
|
|
<![CDATA[
|
|
|
- select count(DISTINCT person_id) from base_person_device_filter_log
|
|
|
- where record_time >=#{startTime}
|
|
|
- and record_time <= #{endTime}
|
|
|
- and temperature_>#{temperatureMax}
|
|
|
+
|
|
|
+ select count(DISTINCT person_id) from base_person_device_filter_log
|
|
|
+ where record_time >=#{startTime}
|
|
|
+ and record_time <= #{endTime}
|
|
|
+ and temperature_>#{temperatureMax}
|
|
|
+
|
|
|
]]>
|
|
|
</select>
|
|
|
<select id="getDayAbnormalNumByCompanyList" resultType="Integer">
|
|
@@ -323,7 +332,7 @@
|
|
|
and a.record_time <= #{endTime}
|
|
|
and a.temperature_>#{temperatureMax}
|
|
|
and b.company_id in
|
|
|
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> #{item.id}
|
|
|
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">#{item.id}
|
|
|
</foreach>
|
|
|
and a.del_flag = 0
|
|
|
</select>
|
|
@@ -334,7 +343,7 @@
|
|
|
where a.record_time >=#{startTime}
|
|
|
and a.record_time <= #{endTime}
|
|
|
and b.company_id in
|
|
|
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> #{item.id}
|
|
|
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">#{item.id}
|
|
|
</foreach>
|
|
|
and a.del_flag = 0
|
|
|
<if test="popedom!=null">
|
|
@@ -353,22 +362,26 @@
|
|
|
</select>
|
|
|
<select id="countDayByPersonIdAndDate" resultType="Integer">
|
|
|
<![CDATA[
|
|
|
- select count(distinct(DATE_FORMAT(a.record_time,'%y-%m-%d'))) from base_person_device_filter_log a
|
|
|
- where a.person_id=#{personId}
|
|
|
- and a.record_time>=#{startDate}
|
|
|
- and a.record_time<#{endDate}
|
|
|
- and a.del_flag=0
|
|
|
+
|
|
|
+ select count(distinct(DATE_FORMAT(a.record_time,'%y-%m-%d'))) from base_person_device_filter_log a
|
|
|
+ where a.person_id=#{personId}
|
|
|
+ and a.record_time>=#{startDate}
|
|
|
+ and a.record_time<#{endDate}
|
|
|
+ and a.del_flag=0
|
|
|
+
|
|
|
]]>
|
|
|
</select>
|
|
|
<select id="countDetectedByCompanyId" resultType="int">
|
|
|
<![CDATA[
|
|
|
- select count(distinct(a.person_id)) from base_person_device_filter_log a
|
|
|
- left join base_person_info b on a.person_id = b.id_
|
|
|
- where b.company_id=#{companyId}
|
|
|
- and a.record_time>=#{startDate}
|
|
|
- and a.record_time<#{endDate}
|
|
|
- and a.del_flag=0
|
|
|
- and b.del_flag=0
|
|
|
+
|
|
|
+ select count(distinct(a.person_id)) from base_person_device_filter_log a
|
|
|
+ left join base_person_info b on a.person_id = b.id_
|
|
|
+ where b.company_id=#{companyId}
|
|
|
+ and a.record_time>=#{startDate}
|
|
|
+ and a.record_time<#{endDate}
|
|
|
+ and a.del_flag=0
|
|
|
+ and b.del_flag=0
|
|
|
+
|
|
|
]]>
|
|
|
</select>
|
|
|
<select id="findUndetectedByCompanyCode"
|
|
@@ -387,13 +400,14 @@
|
|
|
]]>
|
|
|
and (
|
|
|
b.code_ like #{searchParams.companyCode}
|
|
|
-<!-- <if test="personId!=null">
|
|
|
- or b.id_ in (
|
|
|
- select d.company_id from base_person_company d where d.person_id = #{personId}
|
|
|
- )
|
|
|
- </if>-->
|
|
|
+ <!-- <if test="personId!=null">
|
|
|
+ or b.id_ in (
|
|
|
+ select d.company_id from base_person_company d where d.person_id = #{personId}
|
|
|
+ )
|
|
|
+ </if>-->
|
|
|
<if test="searchParams.personCompanyList!=null">
|
|
|
- <foreach collection="searchParams.personCompanyList" index="index" item="item" open=" or b.id_ in(" separator="," close=")">
|
|
|
+ <foreach collection="searchParams.personCompanyList" index="index" item="item" open=" or b.id_ in("
|
|
|
+ separator="," close=")">
|
|
|
#{item.companyId}
|
|
|
</foreach>
|
|
|
</if>
|
|
@@ -403,15 +417,36 @@
|
|
|
|
|
|
<select id="getDayCheckedPersonByCompanyList" resultMap="PersonDeviceFilterLogMap">
|
|
|
<![CDATA[
|
|
|
- select * from base_person_device_filter_log a left join base_person_info b
|
|
|
- on a.person_id = b.id_
|
|
|
- where a.record_time>=#{startDate}
|
|
|
- and a.record_time<#{endDate}
|
|
|
- and a.del_flag=0
|
|
|
- and b.company_id = #{companyInfo.id}
|
|
|
|
|
|
+ select * from base_person_device_filter_log a left join base_person_info b
|
|
|
+ on a.person_id = b.id_
|
|
|
+ where a.record_time>=#{startDate}
|
|
|
+ and a.record_time<#{endDate}
|
|
|
+ and a.del_flag=0
|
|
|
+ and b.company_id = #{companyInfo.id}
|
|
|
+
|
|
|
+ ]]>
|
|
|
+
|
|
|
+ group by a.person_id order by a.record_time desc
|
|
|
+</select>
|
|
|
+
|
|
|
+ <select id="countDetectedByCompanyIds" resultType="long">
|
|
|
+ <![CDATA[
|
|
|
+ select count(*) from (
|
|
|
+ SELECT count(*) from base_person_device_filter_log a ,base_person_info b
|
|
|
+ where a.person_id = b.id_
|
|
|
+ and a.del_flag = 0
|
|
|
+ and b.del_flag = 0
|
|
|
+ and a.record_time>=#{startTime}
|
|
|
+ and a.record_time<=#{endTime}
|
|
|
]]>
|
|
|
|
|
|
- group by a.person_id order by a.record_time desc
|
|
|
+ <foreach collection="companyIds" index="index" item="item" open="and b.company_id in(" separator=","
|
|
|
+ close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ group by person_id ) m
|
|
|
+
|
|
|
+
|
|
|
</select>
|
|
|
</mapper>
|