102 lines
3.1 KiB
XML
102 lines
3.1 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.cm.serviceusercenter.dao.logger.ILoginLoggerDao">
|
|
|
|
<cache/>
|
|
|
|
<resultMap id="loginLoggerDTO" type="com.cm.serviceusercenter.pojo.dtos.logger.LoginLoggerDTO">
|
|
<result column="login_address" property="loginAddress"/>
|
|
<result column="login_type" property="loginType"/>
|
|
<result column="gmt_create" property="gmtCreate"/>
|
|
<result column="creator_name" property="creatorName"/>
|
|
</resultMap>
|
|
|
|
<!-- 新增登录日志 -->
|
|
<insert id="saveLoginLogger" parameterType="map" flushCache="true">
|
|
INSERT INTO log_loginlogger(
|
|
loginlogger_id,
|
|
login_address,
|
|
login_type,
|
|
creator,
|
|
gmt_create,
|
|
creator_name
|
|
) VALUES(
|
|
#{loginLoggerId},
|
|
#{loginAddress},
|
|
#{loginType},
|
|
#{creator},
|
|
#{gmtCreate},
|
|
#{creatorName}
|
|
)
|
|
</insert>
|
|
|
|
<!-- 登录日志统计 -->
|
|
<select id="countLoginLogger" parameterType="map" resultType="Integer" useCache="true">
|
|
SELECT
|
|
COUNT(*)
|
|
FROM
|
|
log_loginlogger
|
|
WHERE
|
|
1 = 1
|
|
<if test="currentDay != null and currentDay != ''">
|
|
AND
|
|
LEFT(gmt_create, 10) = #{currentDay}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 登录日志列表 -->
|
|
<select id="listLoginLogger" parameterType="map" resultMap="loginLoggerDTO" useCache="true">
|
|
SELECT
|
|
login_address,
|
|
login_type,
|
|
LEFT(gmt_create, 19) gmt_create,
|
|
creator_name
|
|
FROM
|
|
log_loginlogger
|
|
WHERE
|
|
1 = 1
|
|
<if test="loginType != null and loginType != ''">
|
|
AND
|
|
login_type = #{loginType}
|
|
</if>
|
|
<if test="keywords != null and keywords != ''">
|
|
AND (
|
|
creator_name LIKE CONCAT('%', #{keywords}, '%')
|
|
)
|
|
</if>
|
|
<if test="startTime != null and startTime != ''">
|
|
AND
|
|
LEFT(gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
|
</if>
|
|
<if test="endTime != null and endTime != ''">
|
|
AND
|
|
LEFT(gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
|
</if>
|
|
ORDER BY
|
|
gmt_create DESC, id DESC
|
|
</select>
|
|
|
|
<!-- 用户登录次数统计列表 -->
|
|
<select id="listCountLoginCountPO" parameterType="map" resultType="com.cm.serviceusercenter.pojo.dtos.count.IdCountPO">
|
|
SELECT
|
|
creator userId,
|
|
count(creator) total
|
|
FROM
|
|
log_loginlogger
|
|
<where>
|
|
<if test="userId != null and userId != ''">
|
|
creator = #{userId}
|
|
</if>
|
|
<if test="userIds != null and userIds.size > 0">
|
|
AND
|
|
creator IN
|
|
<foreach collection="userIds" index="index" open="(" separator="," close=")">
|
|
#{userIds[${index}]}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
GROUP BY
|
|
creator
|
|
</select>
|
|
|
|
</mapper> |