<?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.sckw.product.dao.KwpGoodsMapper">


    <select id="getGoodsLists" resultType="com.sckw.product.model.KwpGoods">
        select
        id, ent_id,supply_ent_id,code,name, type_id, amount, unit, spec, tax_rate, trading, advance_price, manager,
        performed_amount,thumb,added_time,shelf_time,remark,status, create_by, create_time, update_by, update_time,del_flag
        from kwp_goods
        <where>
            del_flag = 0 and ent_id = #{entId}
            <if test="queryParam.keywords != null and queryParam.keywords != ''">
                and name LIKE concat('%',#{queryParam.keywords},'%')
            </if>
            <if test="queryParam.startCreateTime != null ">
                and create_time &gt;= #{queryParam.startCreateTime}
            </if>
            <if test="queryParam.endCreateTime != null ">
                and create_time &lt;= #{queryParam.endCreateTime}
            </if>
            <if test="queryParam.status != null and queryParam.status.size() > 0 ">
                and status in
                <foreach item="item" index="index" collection="#{queryParam.status}" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
            <if test="queryParam.goodsTypes != null and queryParam.goodsTypes.size() > 0 ">
                and goods_type in
                <foreach item="item" index="index" collection="#{queryParam.goodsTypes}" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
            <if test="queryParam.tradings != null and queryParam.tradings.size() > 0 ">
                and trading in
                <foreach item="item" index="index" collection="#{queryParam.tradings}" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>

        </where>
        ORDER BY create_time desc


    </select>
</mapper>