PageViewMapper.xml 1.8 KB
<?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.sincere.wechatbusiness.mapper.PageViewMapper">
  <resultMap id="BaseResultMap" type="com.sincere.wechatbusiness.model.PageView">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="channel_id" jdbcType="INTEGER" property="channelId" />
    <result column="agent_id" jdbcType="INTEGER" property="agentId" />
    <result column="channel_product_id" jdbcType="INTEGER" property="channelProductId" />
    <result column="look_number" jdbcType="INTEGER" property="lookNumber" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select *
    from page_view
    where id = #{id,jdbcType=INTEGER}
  </select>

  <insert id="insert" parameterType="com.sincere.wechatbusiness.model.PageView">
    insert into page_view (channel_id, agent_id,
      channel_product_id, look_number, create_time
      )
    values ( #{channelId,jdbcType=INTEGER}, #{agentId,jdbcType=INTEGER},
      #{channelProductId,jdbcType=INTEGER}, #{lookNumber,jdbcType=INTEGER}, getdate()
      )
  </insert>

  <select id="getDetail" parameterType="com.sincere.wechatbusiness.model.PageView" resultMap="BaseResultMap">
    select * from page_view
    where channel_id = #{channelId} and agent_id = #{agentId} and channel_product_id = #{channelProductId}
  </select>
  
  <update id="updateLook" parameterType="com.sincere.wechatbusiness.model.PageView">
    update page_view set look_number = look_number + 1
        where channel_id = #{channelId} and agent_id = #{agentId} and channel_product_id = #{channelProductId}
  </update>
</mapper>