91 lines
3.0 KiB
XML
91 lines
3.0 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="ConnectLog">
|
||
|
|
|
||
|
|
<insert id="insertConnectLog" parameterType="ConnectLog">
|
||
|
|
INSERT INTO ConnectLog ( connectLogId, uid, startTime, endTime, timeLength ,areaid ) Values ( #{connectLogId}, #{uid}, #{startTime}, #{endTime}, #{timeLength} , #{areaid} )
|
||
|
|
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="updateConnectLog" parameterType="ConnectLog">
|
||
|
|
|
||
|
|
|
||
|
|
UPDATE ConnectLog SET
|
||
|
|
|
||
|
|
connectLogId = #{connectLogId}, uid = #{uid}, startTime = #{startTime}, endTime = #{endTime}, timeLength = #{timeLength} , areaid= #{areaid}
|
||
|
|
where connectLogId=#{connectLogId}
|
||
|
|
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<select id="getConnectLogByKey" parameterType="java.lang.Integer" resultType="ConnectLog">
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
SELECT connectLogId , uid , startTime , endTime , timeLength , areaid
|
||
|
|
FROM ConnectLog WHERE connectLogId=#{connectLogId}
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
<select id="getSeqConnectLog" resultType="Long" useCache="false" flushCache="true">
|
||
|
|
|
||
|
|
SELECT nextval('seq_connectLogId') ;
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
<select id="getConnectLogsCountByUid" parameterType="java.util.Map" resultType="Integer">
|
||
|
|
|
||
|
|
SELECT count(*) as howmuch from ConnectLog
|
||
|
|
WHERE uid=#{uid} and areaid = #{areaid}
|
||
|
|
|
||
|
|
</select>
|
||
|
|
<select id="getConnectLogsByUid" parameterType="java.util.Map" resultType="ConnectLog">
|
||
|
|
|
||
|
|
|
||
|
|
SELECT connectLogId , uid , startTime , endTime , timeLength
|
||
|
|
FROM ConnectLog
|
||
|
|
WHERE uid=#{uid} and areaid = #{areaid}
|
||
|
|
ORDER BY connectLogId desc
|
||
|
|
LIMIT #{pageSize} OFFSET #{offset}
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getConnectLogsCountByWeek" parameterType="java.util.Map" resultType="java.util.HashMap">
|
||
|
|
select extract(WEEK from starttime) subtime,count( distinct uid) howmuch from
|
||
|
|
|
||
|
|
connectlog where starttime >= #{startTime} and starttime<=#{endTime}
|
||
|
|
|
||
|
|
group by subtime order by subtime
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getConnectLogsCountByMonth" parameterType="java.util.Map" resultType="java.util.HashMap">
|
||
|
|
select extract(MONTH from starttime) subtime,count( distinct uid) howmuch from
|
||
|
|
|
||
|
|
connectlog where starttime >= #{startTime} and starttime<=#{endTime}
|
||
|
|
|
||
|
|
group by subtime order by subtime
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getConnectLogsCountByTime" parameterType="java.util.Map" resultType="java.lang.Integer">
|
||
|
|
select count( distinct uid) howmuch from
|
||
|
|
|
||
|
|
connectlog where starttime >= #{startTime} and starttime<=#{endTime}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getConnectLogsCountByDay" parameterType="java.util.Map" resultType="java.util.HashMap">
|
||
|
|
select extract(doy from starttime) subtime,count( distinct uid) howmuch from
|
||
|
|
|
||
|
|
connectlog where starttime >= #{startTime} and starttime<=#{endTime}
|
||
|
|
|
||
|
|
group by subtime order by subtime
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
</mapper>
|