<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cxyxiaomo.epp.shop.dao.GoodsDao">
    <!--<insert id="insert" parameterType="com.cxyxiaomo.epp.common.pojo.Good">-->
    <!--    INSERT INTO report (`user_id`, `name`, `address`, `time`, `temperature`)-->
    <!--    VALUES (#{userId}, #{name}, #{address}, #{time}, #{temperature})-->
    <!--</insert>-->
    <select id="list" resultType="com.cxyxiaomo.epp.common.pojo.Good">
        SELECT *
        FROM goods
        WHERE 1 = 1
        <if test="cateId != null">
            AND category_id = #{cateId}
        </if>
        <if test="searchText != null">
            AND goods_name LIKE concat('%',#{searchText,jdbcType=VARCHAR},'%')
        </if>
        order by `sort_order` asc
    </select>
    <select id="getById" parameterType="java.lang.Long" resultType="com.cxyxiaomo.epp.common.pojo.Good">
        SELECT *
        FROM goods
        WHERE id = #{id}
        order by `sort_order` asc
    </select>
</mapper>
