xubinbin
2023-12-12 42a2772d1aa7493bcc4fac3e24ee8eda4eebc23d
src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java
old mode 100644 new mode 100755
@@ -1,10 +1,10 @@
package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
import com.genersoft.iot.vmp.storager.dao.dto.LogDto;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
@@ -17,21 +17,21 @@
@Repository
public interface LogMapper {
    @Insert("insert into log ( name, type, uri, address, result, timing, username, createTime) " +
            "values ('${name}', '${type}', '${uri}', '${address}', '${result}', ${timing}, '${username}', '${createTime}')")
    @Insert("insert into wvp_log ( name,type,uri,address,result,timing,username,create_time) " +
            "values (#{name}, #{type}, #{uri}, #{address}, #{result}, #{timing}, #{username}, #{createTime})")
    int add(LogDto logDto);
    @Select(value = {"<script>" +
            " SELECT * FROM log " +
            " SELECT * FROM wvp_log " +
            " WHERE 1=1 " +
            " <if test=\"query != null\"> AND (name LIKE '%${query}%')</if> " +
            " <if test=\"type != null\" >  AND type = '${type}'</if>" +
            " <if test=\"startTime != null\" >  AND createTime &gt;= '${startTime}' </if>" +
            " <if test=\"endTime != null\" >  AND createTime &lt;= '${endTime}' </if>" +
            " ORDER BY createTime DESC " +
            " <if test=\"query != null\"> AND (name LIKE concat('%',#{query},'%'))</if> " +
            " <if test=\"type != null\" >  AND type = #{type}</if>" +
            " <if test=\"startTime != null\" >  AND create_time &gt;= #{startTime} </if>" +
            " <if test=\"endTime != null\" >  AND create_time &lt;= #{endTime} </if>" +
            " ORDER BY create_time DESC " +
            " </script>"})
    List<LogDto> query(String query, String type, String startTime, String endTime);
    List<LogDto> query(@Param("query") String query, @Param("type") String type, @Param("startTime") String startTime, @Param("endTime") String endTime);
    @Delete("DELETE FROM log")
    @Delete("DELETE FROM wvp_log")
    int clear();
}