<?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.data.db.mapper.VoteOptionMapper">
    <insert id="save" useGeneratedKeys="true" keyProperty="id">
        insert into aaa_vote_option
        (`vote_id`,`option_id`,`pos`,`name`)
        values 
        (#{voteId},#{optionId},#{pos},#{name})
    </insert>
    
    <select id="findAll" resultType="cn.reghao.tnb.content.app.data.model.po.VoteOption">
        select *
        from aaa_vote_option
        limit 10
    </select>
    <select id="findByVoteId" resultType="cn.reghao.tnb.content.app.data.model.po.VoteOption">
        select *
        from aaa_vote_option
        where vote_id=#{voteId}
        order by pos asc
    </select>
</mapper>
