<?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.pcloud.book.pcloudkeyword.dao.impl.PcloudRobotQrcodeDaoImpl" >
  <resultMap id="BaseResultMap" type="PcloudRobotQrcode" >
      <id column="id" jdbcType="BIGINT" property="id" />
      <result column="robot_type" jdbcType="INTEGER" property="robotType" />
      <result column="link_url" jdbcType="VARCHAR" property="linkUrl" />
      <result column="qrcode_url" jdbcType="VARCHAR" property="qrcodeUrl" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, robot_type, link_url, qrcode_url
  </sql>

  <insert id="insert" parameterType="PcloudRobotQrcode" useGeneratedKeys="true" keyProperty="id">
    insert into pcloud_robot_qrcode (
        robot_type,
        link_url,
        qrcode_url
      )
    values (
      #{robotType,jdbcType=INTEGER},
      #{linkUrl,jdbcType=VARCHAR},
      #{qrcodeUrl,jdbcType=VARCHAR}
      )
  </insert>

    <select id="getByRobotType" parameterType="int" resultMap="BaseResultMap">
        select <include refid="Base_Column_List"/>
        from pcloud_robot_qrcode
        where robot_type = #{robotType}
        limit 1
    </select>

</mapper>