<?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.ruoyi.ibs.datavisual.mapper.VisitTrajectoryMapper">
    <select id="getVisitTrajectory" parameterType="VisitTrajectoryDTO" resultType="VisitTrajectory">
        SELECT * FROM visit_trajectory
        WHERE 1=1
        <if test="timeInterval != null">
            AND date >= (CURDATE() - INTERVAL #{timeInterval} DAY)
        </if>
        <if test="date != null and date != ''">
            AND date = #{date}
        </if>
        <if test="branchId != null">
            AND branch_id = #{branchId}
        </if>
        <if test="outletId != null">
            AND outlet_id = #{outletId}
        </if>
        <if test="userName != null and userName != ''">
            AND user_name = #{userName}
        </if>
    </select>

</mapper>