<?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.slodon.b2b2c.dao.read.api.EnquiryApiMapper">
    <resultMap id="BaseResultMap" type="com.slodon.b2b2c.vo.api.EnquiryInfoVO">
        <id column="id" jdbcType="BIGINT" property="id" />
        <result column="name" jdbcType="VARCHAR" property="name" />
        <result column="email" jdbcType="VARCHAR" property="email" />
        <result column="phone" jdbcType="VARCHAR" property="phone" />
        <result column="message" jdbcType="VARCHAR" property="message" />
<!--        <result column="page_url" jdbcType="VARCHAR" property="pageUrl" />-->
        <result column="create_time" jdbcType="VARCHAR" property="createTime" />

    </resultMap>

    <select id="getEnquiryByStoreId" resultMap="BaseResultMap">
        SELECT id,name,email,phone,message,DATE_FORMAT(create_time, '%Y/%m/%d %H:%i:%s') AS create_time
        FROM enquiry
        where store_id = #{storeId} and valid_status = 0
        order by last_time desc
        limit #{pageNo},#{pageSize}
    </select>

    <select id="countEnquiryByStoreId" resultType="java.lang.Long">
        SELECT count(1)
        FROM enquiry
        where store_id = #{storeId} and valid_status = 0
    </select>

</mapper>