33 lines
1.2 KiB
XML
33 lines
1.2 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"https://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.zioinfo.mall.admin.mapper.AuditLogMapper">
|
|
|
|
<resultMap id="auditMap" type="com.zioinfo.mall.admin.dto.AuditLog">
|
|
<id property="id" column="id"/>
|
|
<result property="actor" column="actor"/>
|
|
<result property="action" column="action"/>
|
|
<result property="target" column="target"/>
|
|
<result property="detail" column="detail"/>
|
|
<result property="createdAt" column="created_at"/>
|
|
</resultMap>
|
|
|
|
<insert id="insert" parameterType="com.zioinfo.mall.admin.dto.AuditLog"
|
|
useGeneratedKeys="true" keyProperty="id">
|
|
INSERT INTO mall_audit_log (actor, action, target, detail)
|
|
VALUES (#{actor}, #{action}, #{target}, #{detail})
|
|
</insert>
|
|
|
|
<select id="find" resultMap="auditMap">
|
|
SELECT id, actor, action, target, detail, created_at
|
|
FROM mall_audit_log
|
|
<where>
|
|
<if test="action != null and action != ''">AND action = #{action}</if>
|
|
<if test="actor != null and actor != ''">AND actor = #{actor}</if>
|
|
</where>
|
|
ORDER BY id DESC
|
|
LIMIT #{limit}
|
|
</select>
|
|
|
|
</mapper>
|