<?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.reptileclient.jlifeapp.dao.hm.HmRequestMapper">

    <insert id="insertNum" parameterType="com.reptileclient.jlifeapp.entity.hm.HmBookOrder">
        insert into hm_request(request_url,request_date,request_num)
           values (#{url},#{date},1)
    </insert>

    <update id="updateNum">
        update hm_request set request_num=request_num+1 where request_url=#{url} and request_date=#{date}
    </update>

    <select id="selectRequestNum" resultType="java.lang.Integer">
        select sum(request_num) from hm_request
         where request_date=#{date}
        <if test="url!=null and url!=''">
          and request_url=#{url}
        </if>
    </select>


</mapper>
