<?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="cn.reghao.tnb.content.app.geo.db.mapper.MallReplyMapper">
    <insert id="save" useGeneratedKeys="true" keyProperty="id">
        insert ignore into geo_mall_reply
        (`item_type`,`item_id`,`reply_id`,`reply_content`,`extra`,`reply_date`,`user_id`,`username`,`avatar_url`)
        values 
        (#{itemType},#{itemId},#{replyId},#{replyContent},#{extra},#{replyDate},#{userId},#{username},#{avatarUrl})
    </insert>

    <update id="updateSetCup">
        update geo_mall_reply
        set cup=#{cup}
        where reply_id=#{replyId}
    </update>

    <select id="findAll" resultType="cn.reghao.tnb.content.app.geo.model.po.MallReply">
        select *
        from geo_mall_reply
        where item_type=4 and cup is null
    </select>
    <select id="findByReplyId" resultType="cn.reghao.tnb.content.app.geo.model.po.MallReply">
        select *
        from geo_mall_reply
        where reply_id=#{reply_id}
    </select>
</mapper>
