<?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.zhushi.mapper.InventoryMapper">

    <select id="getInventoriesByParam" resultType="com.ruoyi.zhushi.entity.Inventory">
        SELECT b.*
        FROM inventory b
        <where>
           1=1
            <if test="type != null and type != ''">
                AND b.type = #{type}
            </if>
            <if test="queryDate != null and queryDate != ''">
                AND substr(b.create_date,1,10) = #{queryDate}
            </if>
            <if test="queryWord != null and queryWord != ''">
                AND b.title LIKE CONCAT('%', #{queryWord}, '%')
            </if>
        </where>
        order by b.update_date desc
    </select>

</mapper>
