Files
game_server/target/classes/mapper/admin/OperationLogMapper.xml

75 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.gameplatform.server.mapper.admin.OperationLogMapper">
<resultMap id="OperationLogMap" type="com.gameplatform.server.model.entity.admin.OperationLog">
<id property="id" column="id" />
<result property="actorType" column="actor_type" />
<result property="actorId" column="actor_id" />
<result property="codeNo" column="code_no" />
<result property="op" column="op" />
<result property="detail" column="detail" />
<result property="clientIp" column="client_ip" />
<result property="userAgent" column="user_agent" />
<result property="createdAt" column="created_at" />
</resultMap>
<select id="findById" parameterType="long" resultMap="OperationLogMap">
SELECT id, actor_type, actor_id, code_no, op, detail, client_ip, user_agent, created_at
FROM operation_log
WHERE id = #{id}
LIMIT 1
</select>
<insert id="insert" parameterType="com.gameplatform.server.model.entity.admin.OperationLog" useGeneratedKeys="true" keyProperty="id">
INSERT INTO operation_log (actor_type, actor_id, code_no, op, detail, client_ip, user_agent)
VALUES (#{actorType}, #{actorId}, #{codeNo}, #{op}, #{detail}, #{clientIp}, #{userAgent})
</insert>
<select id="findByCodeNo" resultMap="OperationLogMap">
SELECT id, actor_type, actor_id, code_no, op, detail, client_ip, user_agent, created_at
FROM operation_log
WHERE code_no = #{codeNo}
ORDER BY created_at DESC
LIMIT #{size} OFFSET #{offset}
</select>
<select id="countByCodeNo" resultType="long">
SELECT COUNT(1) FROM operation_log WHERE code_no = #{codeNo}
</select>
<select id="findByActorId" resultMap="OperationLogMap">
SELECT id, actor_type, actor_id, code_no, op, detail, client_ip, user_agent, created_at
FROM operation_log
WHERE actor_id = #{actorId}
ORDER BY created_at DESC
LIMIT #{size} OFFSET #{offset}
</select>
<select id="countByActorId" resultType="long">
SELECT COUNT(1) FROM operation_log WHERE actor_id = #{actorId}
</select>
<select id="findByActorType" resultMap="OperationLogMap">
SELECT id, actor_type, actor_id, code_no, op, detail, client_ip, user_agent, created_at
FROM operation_log
WHERE actor_type = #{actorType}
ORDER BY created_at DESC
LIMIT #{size} OFFSET #{offset}
</select>
<select id="countByActorType" resultType="long">
SELECT COUNT(1) FROM operation_log WHERE actor_type = #{actorType}
</select>
<select id="findAll" resultMap="OperationLogMap">
SELECT id, actor_type, actor_id, code_no, op, detail, client_ip, user_agent, created_at
FROM operation_log
ORDER BY created_at DESC
LIMIT #{size} OFFSET #{offset}
</select>
<select id="countAll" resultType="long">
SELECT COUNT(1) FROM operation_log
</select>
</mapper>