<?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.njcn.device.pq.mapper.PqsTerminalLogsMapper">

    <!--<select id="getList" resultType="com.njcn.device.pq.pojo.vo.LogsListVO">
        SELECT
        sdd.`Name` "type",
        ptl.Create_By "updateBy",
        ptl.Create_Time "updateTime",
        ptl.`Terminal_Describe` "remark"
        FROM
        pqs_terminal_logs ptl
        LEFT JOIN sys_dict_data sdd ON sdd.Id = ptl.`Terminal_Type`
        <where>
            <if test="logsListParam.searchBeginTime != null and logsListParam.searchBeginTime != ''">
                and date_format(ptl.Create_Time,'%y%m%d') &gt;= date_format(#{logsListParam.searchBeginTime},'%y%m%d')
            </if>
            <if test="logsListParam.searchEndTime != null and logsListParam.searchEndTime != ''">
                and date_format(ptl.Create_Time,'%y%m%d') &lt;= date_format(#{logsListParam.searchEndTime},'%y%m%d')
            </if>
            <if test="logsListParam.searchValue !=null and logsListParam.searchValue !=''">
                and (ptl.Terminal_Describe like CONCAT('%', #{logsListParam.searchValue},'%')
            </if>
            <if test="logsListParam.type !=null and logsListParam.type !=''">
                and sdd.Code = #{logsListParam.type}
            </if>
        </where>
        ORDER BY ptl.Create_Time DESC
        LIMIT #{page.current},#{page.size}
    </select>-->
    <select id="getList" resultType="com.njcn.device.pq.pojo.vo.LogsListVO">
        SELECT
        sdd.`Name` "type",
        ptl.Create_By "updateBy",
        ptl.Create_Time "updateTime",
        ptl.`Terminal_Describe` "remark"
        FROM
        pqs_terminal_logs ptl
        LEFT JOIN sys_dict_data sdd ON sdd.Id = ptl.`Terminal_Type`
        <where>
            <if test="logsListParam.searchBeginTime != null and logsListParam.searchBeginTime != ''">
                and date_format(ptl.Create_Time,'%y%m%d') &gt;= date_format(#{logsListParam.searchBeginTime},'%y%m%d')
            </if>
            <if test="logsListParam.searchEndTime != null and logsListParam.searchEndTime != ''">
                and date_format(ptl.Create_Time,'%y%m%d') &lt;= date_format(#{logsListParam.searchEndTime},'%y%m%d')
            </if>
            <if test="logsListParam.searchValue !=null and logsListParam.searchValue !=''">
                and ptl.Terminal_Describe like CONCAT('%', #{logsListParam.searchValue},'%')
            </if>
            <if test="logsListParam.type !=null and logsListParam.type !=''">
                and sdd.Code = #{logsListParam.type}
            </if>
        </where>
        ORDER BY ptl.Create_Time DESC
    </select>
</mapper>
