<?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.miaxis.goods.mapper.GoodsInfoMapper">

    <resultMap type="GoodsInfo" id="GoodsInfoResult">
        <result property="id"    column="id"    />
        <result property="goodsName"    column="goods_name"    />
        <result property="goodsPrice"    column="goods_price"    />
        <result property="goodsLink"    column="goods_link"    />
        <result property="goodsDescribe"    column="goods_describe"    />
        <result property="goodsPicture"    column="goods_picture"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="topicId"    column="topic_id"    />
        <result property="status"    column="status"    />
    </resultMap>

    <sql id="selectGoodsInfoVo">
        select id, goods_name, goods_price, goods_link, goods_describe, goods_picture, create_time, update_time,topic_id ,status from goods_info
    </sql>

    <select id="selectGoodsInfoList" parameterType="GoodsInfo" resultMap="GoodsInfoResult">
        <include refid="selectGoodsInfoVo"/>
        <where>
            <if test="goodsName != null  and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
            <if test="goodsPrice != null "> and goods_price = #{goodsPrice}</if>
            <if test="goodsLink != null  and goodsLink != ''"> and goods_link = #{goodsLink}</if>
            <if test="goodsDescribe != null  and goodsDescribe != ''"> and goods_describe = #{goodsDescribe}</if>
            <if test="goodsPicture != null "> and goods_picture = #{goodsPicture}</if>
            <if test="topicId != null "> and topic_id = #{topicId}</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
    </select>

</mapper>
