2026-03-10 14:30:24 +08:00

81 lines
2.6 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="AdminOperLog">
<insert id="addAdminOperLog" parameterType="AdminOperLog">
INSERT INTO AdminOperLog ( logId,type,adminId,created,description,orderno )
Values ( #{logId},#{type},#{adminId},#{created},#{description},#{orderno})
</insert>
<update id="editAdminOperLog" parameterType="AdminOperLog">
UPDATE AdminOperLog
SET logId=#{logId},type=#{type},adminId=#{adminId},created=#{created},description=#{description},orderno=#{orderno}
WHERE logId=#{logId}
</update>
<select id="getAdminOperLog" parameterType="java.lang.Integer" resultType="AdminOperLog">
SELECT logId,type,adminId,created,description,orderno
FROM AdminOperLog
WHERE logId=#{logId}
</select>
<select id="getSeqAdminOperLog" resultType="java.lang.Integer" useCache="false" flushCache="true">
SELECT nextval('seq_adminoperlogid') ;
</select>
<insert id="addAdminOperLogs" parameterType="java.util.List">
INSERT INTO adminoperlog ( logid, type, adminid, created, description, orderno ) Values
<foreach collection="list" index="index" item="item" separator=",">
( #{item.logId}, #{item.type}, #{item.adminId}, #{item.created}, #{item.description}, #{item.orderno} )
</foreach>
</insert>
<select id="getAdminOperLogs" parameterType="java.util.Map" resultType="java.util.Map">
with temp as (SELECT logId,type,adminId,created,description,orderno
FROM AdminOperLog
where 1=1
<if test="adminId!=null">
and adminId=#{adminId}
</if>
<if test="types!=null">
and type in
<foreach collection="types" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
order by logid desc
<if test="pageSize!=null">
LIMIT #{pageSize}
</if>
<if test="offset!=null">
OFFSET #{offset}
</if>
)
select t.logId,t.type,t.adminId ,t.created,t.description,t.orderno,a.truename
from temp t left join admin a on t.adminid=a.adminid
</select>
<select id="getAdminOperLogsCount" parameterType="java.util.Map" resultType="java.lang.Integer">
select count(logId) from adminOperLog
where 1=1
<if test="adminId!=null">
and adminId=#{adminId}
</if>
<if test="types!=null">
and type in
<foreach collection="types" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
</mapper>