<?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.example.recommend.dal.ShopModelMapper">
    <resultMap id="BaseResultMap" type="com.example.recommend.model.ShopModel">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
          This element was generated on Tue Oct 10 13:20:51 CST 2023.
        -->
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="created_at" jdbcType="TIMESTAMP" property="createdAt"/>
        <result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt"/>
        <result column="name" jdbcType="VARCHAR" property="name"/>
        <result column="remark_score" jdbcType="DECIMAL" property="remarkScore"/>
        <result column="price_per_man" jdbcType="INTEGER" property="pricePerMan"/>
        <result column="latitude" jdbcType="DECIMAL" property="latitude"/>
        <result column="longitude" jdbcType="DECIMAL" property="longitude"/>
        <result column="category_id" jdbcType="INTEGER" property="categoryId"/>
        <result column="tags" jdbcType="VARCHAR" property="tags"/>
        <result column="start_time" jdbcType="VARCHAR" property="startTime"/>
        <result column="end_time" jdbcType="VARCHAR" property="endTime"/>
        <result column="address" jdbcType="VARCHAR" property="address"/>
        <result column="seller_id" jdbcType="INTEGER" property="sellerId"/>
        <result column="icon_url" jdbcType="VARCHAR" property="iconUrl"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
          This element was generated on Tue Oct 10 13:20:51 CST 2023.
        -->
        id, created_at, updated_at, name, remark_score, price_per_man, latitude, longitude,
        category_id, tags, start_time, end_time, address, seller_id, icon_url
    </sql>
    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
          This element was generated on Tue Oct 10 13:20:51 CST 2023.
        -->
        select
        <include refid="Base_Column_List"/>
        from shop
        where id = #{id,jdbcType=INTEGER}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
          This element was generated on Tue Oct 10 13:20:51 CST 2023.
        -->
        delete from shop
        where id = #{id,jdbcType=INTEGER}
    </delete>
    <insert id="insert" parameterType="com.example.recommend.model.ShopModel">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
          This element was generated on Tue Oct 10 13:20:51 CST 2023.
        -->
        <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
            SELECT LAST_INSERT_ID()
        </selectKey>
        insert into shop (created_at, updated_at, name,
        remark_score, price_per_man, latitude,
        longitude, category_id, tags,
        start_time, end_time, address,
        seller_id, icon_url)
        values (#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{name,jdbcType=VARCHAR},
        #{remarkScore,jdbcType=DECIMAL}, #{pricePerMan,jdbcType=INTEGER}, #{latitude,jdbcType=DECIMAL},
        #{longitude,jdbcType=DECIMAL}, #{categoryId,jdbcType=INTEGER}, #{tags,jdbcType=VARCHAR},
        #{startTime,jdbcType=VARCHAR}, #{endTime,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
        #{sellerId,jdbcType=INTEGER}, #{iconUrl,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.example.recommend.model.ShopModel">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
          This element was generated on Tue Oct 10 13:20:51 CST 2023.
        -->
        <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
            SELECT LAST_INSERT_ID()
        </selectKey>
        insert into shop
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="createdAt != null">
                created_at,
            </if>
            <if test="updatedAt != null">
                updated_at,
            </if>
            <if test="name != null">
                name,
            </if>
            <if test="remarkScore != null">
                remark_score,
            </if>
            <if test="pricePerMan != null">
                price_per_man,
            </if>
            <if test="latitude != null">
                latitude,
            </if>
            <if test="longitude != null">
                longitude,
            </if>
            <if test="categoryId != null">
                category_id,
            </if>
            <if test="tags != null">
                tags,
            </if>
            <if test="startTime != null">
                start_time,
            </if>
            <if test="endTime != null">
                end_time,
            </if>
            <if test="address != null">
                address,
            </if>
            <if test="sellerId != null">
                seller_id,
            </if>
            <if test="iconUrl != null">
                icon_url,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="createdAt != null">
                #{createdAt,jdbcType=TIMESTAMP},
            </if>
            <if test="updatedAt != null">
                #{updatedAt,jdbcType=TIMESTAMP},
            </if>
            <if test="name != null">
                #{name,jdbcType=VARCHAR},
            </if>
            <if test="remarkScore != null">
                #{remarkScore,jdbcType=DECIMAL},
            </if>
            <if test="pricePerMan != null">
                #{pricePerMan,jdbcType=INTEGER},
            </if>
            <if test="latitude != null">
                #{latitude,jdbcType=DECIMAL},
            </if>
            <if test="longitude != null">
                #{longitude,jdbcType=DECIMAL},
            </if>
            <if test="categoryId != null">
                #{categoryId,jdbcType=INTEGER},
            </if>
            <if test="tags != null">
                #{tags,jdbcType=VARCHAR},
            </if>
            <if test="startTime != null">
                #{startTime,jdbcType=VARCHAR},
            </if>
            <if test="endTime != null">
                #{endTime,jdbcType=VARCHAR},
            </if>
            <if test="address != null">
                #{address,jdbcType=VARCHAR},
            </if>
            <if test="sellerId != null">
                #{sellerId,jdbcType=INTEGER},
            </if>
            <if test="iconUrl != null">
                #{iconUrl,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.example.recommend.model.ShopModel">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
          This element was generated on Tue Oct 10 13:20:51 CST 2023.
        -->
        update shop
        <set>
            <if test="createdAt != null">
                created_at = #{createdAt,jdbcType=TIMESTAMP},
            </if>
            <if test="updatedAt != null">
                updated_at = #{updatedAt,jdbcType=TIMESTAMP},
            </if>
            <if test="name != null">
                name = #{name,jdbcType=VARCHAR},
            </if>
            <if test="remarkScore != null">
                remark_score = #{remarkScore,jdbcType=DECIMAL},
            </if>
            <if test="pricePerMan != null">
                price_per_man = #{pricePerMan,jdbcType=INTEGER},
            </if>
            <if test="latitude != null">
                latitude = #{latitude,jdbcType=DECIMAL},
            </if>
            <if test="longitude != null">
                longitude = #{longitude,jdbcType=DECIMAL},
            </if>
            <if test="categoryId != null">
                category_id = #{categoryId,jdbcType=INTEGER},
            </if>
            <if test="tags != null">
                tags = #{tags,jdbcType=VARCHAR},
            </if>
            <if test="startTime != null">
                start_time = #{startTime,jdbcType=VARCHAR},
            </if>
            <if test="endTime != null">
                end_time = #{endTime,jdbcType=VARCHAR},
            </if>
            <if test="address != null">
                address = #{address,jdbcType=VARCHAR},
            </if>
            <if test="sellerId != null">
                seller_id = #{sellerId,jdbcType=INTEGER},
            </if>
            <if test="iconUrl != null">
                icon_url = #{iconUrl,jdbcType=VARCHAR},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.example.recommend.model.ShopModel">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
          This element was generated on Tue Oct 10 13:20:51 CST 2023.
        -->
        update shop
        set created_at = #{createdAt,jdbcType=TIMESTAMP},
        updated_at = #{updatedAt,jdbcType=TIMESTAMP},
        name = #{name,jdbcType=VARCHAR},
        remark_score = #{remarkScore,jdbcType=DECIMAL},
        price_per_man = #{pricePerMan,jdbcType=INTEGER},
        latitude = #{latitude,jdbcType=DECIMAL},
        longitude = #{longitude,jdbcType=DECIMAL},
        category_id = #{categoryId,jdbcType=INTEGER},
        tags = #{tags,jdbcType=VARCHAR},
        start_time = #{startTime,jdbcType=VARCHAR},
        end_time = #{endTime,jdbcType=VARCHAR},
        address = #{address,jdbcType=VARCHAR},
        seller_id = #{sellerId,jdbcType=INTEGER},
        icon_url = #{iconUrl,jdbcType=VARCHAR}
        where id = #{id,jdbcType=INTEGER}
    </update>
    <select id="selectAll" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from shop order by id ASC
    </select>
    <select id="countAllShop" resultType="java.lang.Integer">
        select count(1)
        from shop
    </select>
</mapper>