1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee
Files
epp/backend/microservice-provider-access-8002/src/main/resources/mybatis/mapper/AccessLogDao.xml

55 lines
2.1 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cxyxiaomo.epp.access.dao.AccessLogDao">
<insert id="addAccessLog" parameterType="com.cxyxiaomo.epp.common.pojo.AccessLog">
INSERT INTO access_log (id, time, user_id, user_real_name, gate_id, type)
VALUES (#{id}, #{time}, #{userId}, #{userRealName}, #{gateId}, #{type})
</insert>
<update id="updateAccessLog" parameterType="com.cxyxiaomo.epp.common.pojo.AccessLog">
UPDATE access_log
<set>
<if test="time != null">time = #{time},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userRealName != null and userRealName != ''">user_real_name = #{userRealName},</if>
<if test="gateId != null">gate_id = #{gateId},</if>
<if test="type != null and type != ''">type = #{type}</if>
</set>
WHERE id = #{id}
</update>
<select id="getAccessLogList" resultType="com.cxyxiaomo.epp.common.pojo.AccessLog">
SELECT * FROM access_log
<where>
1 = 1
<if test="id != null">
AND id = #{id}
</if>
<if test="startTime != null and endTime != null">
AND time BETWEEN from_unixtime(#{startTime}/1000) AND from_unixtime(#{endTime}/1000)
</if>
<if test="userId != null">
AND user_id = #{userId}
</if>
<if test="userRealName != null and userRealName != ''">
AND user_real_name LIKE concat('%',#{userRealName},'%')
</if>
<if test="gateId != null">
AND gate_id = #{gateId}
</if>
<if test="type != null and type != ''">
AND type = #{type}
</if>
</where>
order by time desc
</select>
<delete id="deleteAccessLogById">
DELETE
FROM access_log
WHERE id = #{id}
</delete>
</mapper>