forked from kidgrow-microservices-platform

zxh
2020-08-25 2151f9f08df8e60370efdb312a1814f4a78023a6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?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.kidgrow.filecenter.mapper.FileMapper">
 
    <sql id="where">
        <where>
            <if test="f.name != null and f.name != ''">
                and t.name like concat('%', #{f.name}, '%')
            </if>
            <if test="f.beginTime != null and f.beginTime != ''">
                and t.create_time &gt;= #{f.beginTime}
            </if>
            <if test="f.endTime != null and f.endTime != ''">
                and t.create_time &lt;= #{f.endTime}
            </if>
            <if test="f.searchKey != null and f.searchKey != ''">
                and t.name like concat('%', #{f.searchKey}, '%')
            </if>
        </where>
    </sql>
 
    <select id="findList" resultType="com.kidgrow.filecenter.model.FileInfo">
        select * from file_info t
        <include refid="where" />
        order by t.create_time desc
    </select>
</mapper>