Files
smartservice_web/smartservice_backend/src/main/resources/mapper/OperatingHistory.xml
T
2026-05-19 20:58:19 +09:00

44 lines
1.5 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.handong.smartservice.mapper.OperatingHistoryMapper">
<select id="selectOperatingHistory" resultType="map">
SELECT
<choose>
<when test="isCount == true">
COUNT(*)
</when>
<otherwise>
OH.operating_history_id, OH.reg_time, OH.type, OH.action, A.gid, A.user_id, A.nick_name
</otherwise>
</choose>
FROM operating_history OH
JOIN account A ON A.gid = OH.gid
WHERE 1=1
<if test="date_start != null and date_start != ''">
AND #{date_start} &lt;= DATE(OH.reg_time)
</if>
<if test="date_end != null and date_end != ''">
AND DATE(OH.reg_time) &lt;= #{date_end}
</if>
<if test="action != null and action != ''">
AND OH.action like CONCAT('%', #{action}, '%')
</if>
<if test="isCount == false and is_excel == false">
ORDER BY OH.operating_history_id DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
<insert id="insertOperatingHistory">
INSERT INTO operating_history
<trim prefix="(" suffix=")" suffixOverrides=",">
type, action, gid,
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{type}, #{action}, #{gid},
</trim>
</insert>
</mapper>